import java.util.*;
import java.util.stream.Collectors;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int n = scanner.nextInt();

        Map<String, Integer> map = new HashMap<>();
        for (int i = 0; i < n; i++) {
            String s = scanner.next();
            if (map.containsKey(s)) {
                int count = map.get(s) + 1;
                map.put(s, count);
            } else {
                map.put(s, 1);
            }
        }

        List<Map.Entry<String, Integer>> entryList = map.entrySet().stream()
                .sorted(java.util.Collections.reverseOrder(java.util.Map.Entry.comparingByValue()))
                .collect(Collectors.toList());

        int max = 0;
        List<String> list = new ArrayList<>();
        for (Map.Entry<String, Integer> entry : entryList) {
            int count = entry.getValue();
            if (max <= count) {
                max = count;
                list.add(entry.getKey());
            }
        }
        Collections.sort(list);

        for (String s : list) {
            System.out.println(s);
        }
    }
} import java.util.*; util.* java import java.util.stream.Collectors; Collectors java.util.stream public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int n = scanner.nextInt();

        Map<String, Integer> map = new HashMap<>();
        for (int i = 0; i < n; i++) {
            String s = scanner.next();
            if (map.containsKey(s)) {
                int count = map.get(s) + 1;
                map.put(s, count);
            } else {
                map.put(s, 1);
            }
        }

        List<Map.Entry<String, Integer>> entryList = map.entrySet().stream()
                .sorted(java.util.Collections.reverseOrder(java.util.Map.Entry.comparingByValue()))
                .collect(Collectors.toList());

        int max = 0;
        List<String> list = new ArrayList<>();
        for (Map.Entry<String, Integer> entry : entryList) {
            int count = entry.getValue();
            if (max <= count) {
                max = count;
                list.add(entry.getKey());
            }
        }
        Collections.sort(list);

        for (String s : list) {
            System.out.println(s);
        }
    }
} Main public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int n = scanner.nextInt();

        Map<String, Integer> map = new HashMap<>();
        for (int i = 0; i < n; i++) {
            String s = scanner.next();
            if (map.containsKey(s)) {
                int count = map.get(s) + 1;
                map.put(s, count);
            } else {
                map.put(s, 1);
            }
        }

        List<Map.Entry<String, Integer>> entryList = map.entrySet().stream()
                .sorted(java.util.Collections.reverseOrder(java.util.Map.Entry.comparingByValue()))
                .collect(Collectors.toList());

        int max = 0;
        List<String> list = new ArrayList<>();
        for (Map.Entry<String, Integer> entry : entryList) {
            int count = entry.getValue();
            if (max <= count) {
                max = count;
                list.add(entry.getKey());
            }
        }
        Collections.sort(list);

        for (String s : list) {
            System.out.println(s);
        }
    } main {
        Scanner scanner = new Scanner(System.in);

        int n = scanner.nextInt();

        Map<String, Integer> map = new HashMap<>();
        for (int i = 0; i < n; i++) {
            String s = scanner.next();
            if (map.containsKey(s)) {
                int count = map.get(s) + 1;
                map.put(s, count);
            } else {
                map.put(s, 1);
            }
        }

        List<Map.Entry<String, Integer>> entryList = map.entrySet().stream()
                .sorted(java.util.Collections.reverseOrder(java.util.Map.Entry.comparingByValue()))
                .collect(Collectors.toList());

        int max = 0;
        List<String> list = new ArrayList<>();
        for (Map.Entry<String, Integer> entry : entryList) {
            int count = entry.getValue();
            if (max <= count) {
                max = count;
                list.add(entry.getKey());
            }
        }
        Collections.sort(list);

        for (String s : list) {
            System.out.println(s);
        }
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int n = scanner.nextInt(); n scanner.nextInt() scanner.nextInt scanner Map<String, Integer> map = new HashMap<>(); map new HashMap<>() for (int i = 0; i < n; i++) {
            String s = scanner.next();
            if (map.containsKey(s)) {
                int count = map.get(s) + 1;
                map.put(s, count);
            } else {
                map.put(s, 1);
            }
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            String s = scanner.next();
            if (map.containsKey(s)) {
                int count = map.get(s) + 1;
                map.put(s, count);
            } else {
                map.put(s, 1);
            }
        } {
            String s = scanner.next();
            if (map.containsKey(s)) {
                int count = map.get(s) + 1;
                map.put(s, count);
            } else {
                map.put(s, 1);
            }
        } String s = scanner.next(); s scanner.next() scanner.next scanner if (map.containsKey(s)) {
                int count = map.get(s) + 1;
                map.put(s, count);
            } else {
                map.put(s, 1);
            } map.containsKey(s) map.containsKey map s {
                int count = map.get(s) + 1;
                map.put(s, count);
            } int count = map.get(s) + 1; count map.get(s) + 1 map.get(s) map.get map s 1 map.put(s, count) map.put map s count {
                map.put(s, 1);
            } map.put(s, 1) map.put map s 1 List<Map.Entry<String, Integer>> entryList = map.entrySet().stream()
                .sorted(java.util.Collections.reverseOrder(java.util.Map.Entry.comparingByValue()))
                .collect(Collectors.toList()); entryList map.entrySet().stream()
                .sorted(java.util.Collections.reverseOrder(java.util.Map.Entry.comparingByValue()))
                .collect(Collectors.toList()) map.entrySet().stream()
                .sorted(java.util.Collections.reverseOrder(java.util.Map.Entry.comparingByValue()))
                .collect map.entrySet().stream()
                .sorted(java.util.Collections.reverseOrder(java.util.Map.Entry.comparingByValue())) map.entrySet().stream()
                .sorted map.entrySet().stream() map.entrySet().stream map.entrySet() map.entrySet map java.util.Collections.reverseOrder(java.util.Map.Entry.comparingByValue()) java.util.Collections.reverseOrder java.util.Collections java.util java java.util java.util.Collections java.util.Map.Entry.comparingByValue() java.util.Map.Entry.comparingByValue java.util.Map.Entry java.util.Map java.util java java.util java.util.Map java.util.Map.Entry Collectors.toList() Collectors.toList Collectors int max = 0; max 0 List<String> list = new ArrayList<>(); list new ArrayList<>() for (Map.Entry<String, Integer> entry : entryList) {
            int count = entry.getValue();
            if (max <= count) {
                max = count;
                list.add(entry.getKey());
            }
        } Map.Entry<String, Integer> entry entryList {
            int count = entry.getValue();
            if (max <= count) {
                max = count;
                list.add(entry.getKey());
            }
        } {
            int count = entry.getValue();
            if (max <= count) {
                max = count;
                list.add(entry.getKey());
            }
        } int count = entry.getValue(); count entry.getValue() entry.getValue entry if (max <= count) {
                max = count;
                list.add(entry.getKey());
            } max <= count max count {
                max = count;
                list.add(entry.getKey());
            } max = count max count list.add(entry.getKey()) list.add list entry.getKey() entry.getKey entry Collections.sort(list) Collections.sort Collections list for (String s : list) {
            System.out.println(s);
        } String s list {
            System.out.println(s);
        } {
            System.out.println(s);
        } System.out.println(s) System.out.println System.out System System.out s String[] args args public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int n = scanner.nextInt();

        Map<String, Integer> map = new HashMap<>();
        for (int i = 0; i < n; i++) {
            String s = scanner.next();
            if (map.containsKey(s)) {
                int count = map.get(s) + 1;
                map.put(s, count);
            } else {
                map.put(s, 1);
            }
        }

        List<Map.Entry<String, Integer>> entryList = map.entrySet().stream()
                .sorted(java.util.Collections.reverseOrder(java.util.Map.Entry.comparingByValue()))
                .collect(Collectors.toList());

        int max = 0;
        List<String> list = new ArrayList<>();
        for (Map.Entry<String, Integer> entry : entryList) {
            int count = entry.getValue();
            if (max <= count) {
                max = count;
                list.add(entry.getKey());
            }
        }
        Collections.sort(list);

        for (String s : list) {
            System.out.println(s);
        }
    }
} public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int n = scanner.nextInt();

        Map<String, Integer> map = new HashMap<>();
        for (int i = 0; i < n; i++) {
            String s = scanner.next();
            if (map.containsKey(s)) {
                int count = map.get(s) + 1;
                map.put(s, count);
            } else {
                map.put(s, 1);
            }
        }

        List<Map.Entry<String, Integer>> entryList = map.entrySet().stream()
                .sorted(java.util.Collections.reverseOrder(java.util.Map.Entry.comparingByValue()))
                .collect(Collectors.toList());

        int max = 0;
        List<String> list = new ArrayList<>();
        for (Map.Entry<String, Integer> entry : entryList) {
            int count = entry.getValue();
            if (max <= count) {
                max = count;
                list.add(entry.getKey());
            }
        }
        Collections.sort(list);

        for (String s : list) {
            System.out.println(s);
        }
    }
} Main
import java.util.*;
import java.util.stream.Collectors;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int n = scanner.nextInt();

        Map<String, Integer> map = new HashMap<>();
        for (int i = 0; i < n; i++) {
            String s = scanner.next();
            if (map.containsKey(s)) {
                int count = map.get(s) + 1;
                map.put(s, count);
            } else {
                map.put(s, 1);
            }
        }

        List<Map.Entry<String, Integer>> entryList = map.entrySet().stream()
                .sorted(java.util.Collections.reverseOrder(java.util.Map.Entry.comparingByValue()))
                .collect(Collectors.toList());

        int max = 0;
        List<String> list = new ArrayList<>();
        for (Map.Entry<String, Integer> entry : entryList) {
            int count = entry.getValue();
            if (max <= count) {
                max = count;
                list.add(entry.getKey());
            }
        }
        Collections.sort(list);

        for (String s : list) {
            System.out.println(s);
        }
    }
}