#include <iostream>
using namespace std;
#define LL long long

#include <algorithm>
#include <vector>
void _150() {
    LL n;
    cin >> n;

    // int p[8];
    // int q[8];
    int temp;
    vector<int> p, q;
    vector<int> perm_base;
    for (int i = 0; i < n; ++i) {
        cin >> temp;
        p.push_back(temp);
        perm_base.push_back(i + 1);
    }
    for (int i = 0; i < n; ++i) {
        cin >> temp;
        q.push_back(temp);
    }

    LL a, b, index;
    a = -1;
    b = -1;
    index = 0;
    do {
        if (perm_base == p) {
            a = index;
        }

        if (perm_base == q) {
            b = index;
        }

        if (a != -1 && b != -1) {
            break;
        }

        index++;
    } while (next_permutation(perm_base.begin(), perm_base.end()));

    cout << abs(a - b) << endl;
}

#include <string>
void _151() {
    int n, m;
    cin >> n >> m;
    int p[100000] = {0};
    int correct[100000] = {0};
    int penalty_counts[100000] = {0};
    string temp;
    int correct_count = 0;
    for (int i = 0; i < m; ++i) {
        cin >> p[i] >> temp;
        if (temp == "AC") {
            if (correct[p[i] - 1] != 1) {
                correct_count++;
                correct[p[i] - 1] = 1;
            }
        } else {
            if (correct[p[i] - 1] != 1) {
                penalty_counts[p[i] - 1]++;
            }
        }
    }
    int penalty_count = 0;
    for (int i = 0; i < n; ++i) {
        if (correct[i] == 1) {
            penalty_count += penalty_counts[i];
        }
    }
    cout << correct_count << " " << penalty_count << endl;
}

#include <limits>
void _152_() { 
    int n;
    cin >> n;
    int temp;
    vector<int> p;
    int min_val = numeric_limits<int>::max();
    int count = 0;
    for (int i = 0; i < n; ++i) {
        cin >> temp;
        if (min_val >= temp) {
            min_val = temp;
            count++;
        }
    }
    cout << count << endl;
}

void _153() {
    int n, k;
    cin >> n >> k;

    vector<int> h(n);
    for (int i = 0; i < n; ++i) {
        cin >> h[i];
    }

    if (n <= k) {
        cout << 0 << endl;
        return;
    }

    sort(h.begin(), h.end());

    int num_monsters = n - k;
    LL count = 0;
    for (int i = 0; i < num_monsters; ++i) {
        count += h[i];
    }
    cout << count << endl;
}

#include <set>
void _154() {
    int n;
    cin >> n;
    int temp;
    set<int> b;
    for (int i = 0; i < n; ++i) {
        cin >> temp;
        b.insert(temp);
    }

    if (b.size() != n) {
        cout << "NO" << endl;
    } else {
        cout << "YES" << endl;
    }

}

#include <map>
void _155() {
    int n;
    cin >> n;

    string temp;
    map<string, int> data;
    vector<string>::iterator itr;
    vector<int> counts;
    int prev_count, temp_count;
    for (int i = 0; i < n; ++i) { 
        cin >> temp;
        temp_count = data[temp];
        data[temp] = ++temp_count;
    }

    int max_count = 0;
    vector<string> candidate;
    for (auto itr = data.begin(); itr != data.end(); ++itr) {
        // cout << itr->first << " " << itr->second << " " << max_count << endl;
        if (itr->second > max_count) {
            max_count = itr->second;
            candidate.clear();
            candidate.push_back(itr->first);
        } else if (itr->second == max_count) {
            candidate.push_back(itr->first);
        }
    }

    // cout << candidate.size() << endl;
    sort(candidate.begin(), candidate.end());
    for (int i = 0; i < candidate.size(); ++i) {
        cout << candidate[i] << endl;
    }
}

int main()
{
    _155();
    return 0;
}



Measured memory_bytes: 26868