public class Solution {
    public static Map<String, Integer> resultMap = new HashMap<String, Integer>();

    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String filename ="";
        while(reader.ready()){
            if(reader.readLine().equals("exit")){
                break;
            }
            ReadThread rt = new ReadThread(reader.readLine());
            rt.start();
    }
    reader.close();
    }

    public static class ReadThread extends Thread {
        LinkedHashMap<Integer, Integer> map = new LinkedHashMap<>();
        LinkedHashMap<Integer, Integer> result = new LinkedHashMap<>();

        private String file;

        public ReadThread(String fileName) throws IOException {
            this.file=fileName;

            }
            public void result() throws IOException {
                InputStream in = new FileInputStream(file);
                while(in.available()>0){
                    int a = in.read();
                    if(map.containsKey(a)){
                        map.replace(a, map.get(a)+1);
                    }
                    else map.put(a, 1);
                }
                in.close();
                int a = map.entrySet().stream().max((entry1, entry2) -> entry1.getValue() > entry2.getValue() ? 1 : -1)
                        .get().getValue();
                for (Map.Entry<Integer, Integer> mapp:
                        map.entrySet()){
                    int x = mapp.getValue();
                    if(a==x){
                        resultMap.put(file, mapp.getKey());
                    }
                }
            }

        @Override
        public void run() {
            try {
                result();
            } catch (IOException e) {
                e.printStackTrace();
            }


        }
        // Implement constructor body
        }

        // Implement file reading here
    }