import java.util.*;
import java.util.Map.*;   // Entryを使うときは、paizaではこれを宣言する

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        
        Map<String, Integer> map = new HashMap<String, Integer>();
        int max = 0;
        while (n-- > 0) {
            String w = sc.next();
            if (!map.containsKey(w)) {
                map.put(w, 1);
                max = Math.max(max, 1);
            } else {
                int v = map.get(w);
                map.put(w, v + 1);
                max = Math.max(max, v + 1);
            }
        }
        
        List<String> list = new ArrayList<String>();
        for (Entry<String, Integer> entry : map.entrySet()) {
            String key = entry.getKey();
            int val = entry.getValue();
            if (val == max) {
                list.add(key);
            }
        }
        list.sort(Comparator.naturalOrder());
        
        for (String s : list) {
            System.out.println(s);
            
        }
    }
}

/tmp/hf-datasets-cache/medium/datasets/42704881117311-config-parquet-and-info-qiankunmu-Project_CodeNet-896c9d36/hub/datasets--qiankunmu--Project_CodeNet_Python800_and_Java250/snapshots/c899fde44a77ba1cc14973ed3de064e4ff3aadc7/Project_CodeNet_Java250.tar.gz