#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <forward_list>

using namespace std;

typedef long long ll;
typedef vector<long long> vi;
typedef pair<long long, long long> ii;
typedef vector<pair<long long, long long>> vii;
typedef stringstream ss;
ll mil() { return numeric_limits<long long>::min(); }
ll mal() { return numeric_limits<long long>::max(); }

#define R3(i, a, b) for (long long i = (a); i < (b); ++i)
#define R2(i, b) for (long long i = 0; i < (b); ++i)
#define R1(b) for (long long i = 0; i < (b); ++i)
#define RR(i, a, b) for (long long i = a; i > b; --i)
#define PB(x) push_back(x)
#define MP(x, y) make_pair(x, y)

// build: ctrl + f9

// run: shift + f10
// sanitize: shift + f11
// debug: shift + f9

template<unsigned int mod_>
struct ModInt{
    using uint = unsigned int;
    using ll = long long;
    using ull = unsigned long long;

    constexpr static uint mod = mod_;

    uint v;
    ModInt():v(0){}
    ModInt(ll _v):v(normS(_v%mod+mod)){}
    explicit operator bool() const {return v!=0;}
    static uint normS(const uint &x){return (x<mod)?x:x-mod;}		// [0 , 2*mod-1] -> [0 , mod-1]
    static ModInt make(const uint &x){ModInt m; m.v=x; return m;}
    ModInt operator+(const ModInt& b) const { return make(normS(v+b.v));}
    ModInt operator-(const ModInt& b) const { return make(normS(v+mod-b.v));}
    ModInt operator-() const { return make(normS(mod-v)); }
    ModInt operator*(const ModInt& b) const { return make((ull)v*b.v%mod);}
    ModInt operator/(const ModInt& b) const { return *this*b.inv();}
    ModInt& operator+=(const ModInt& b){ return *this=*this+b;}
    ModInt& operator-=(const ModInt& b){ return *this=*this-b;}
    ModInt& operator*=(const ModInt& b){ return *this=*this*b;}
    ModInt& operator/=(const ModInt& b){ return *this=*this/b;}
    ModInt& operator++(int){ return *this=*this+1;}
    ModInt& operator--(int){ return *this=*this-1;}
    ll extgcd(ll a,ll b,ll &x,ll &y) const{
        ll p[]={a,1,0},q[]={b,0,1};
        while(*q){
            ll t=*p/ *q;
            R1(3) swap(p[i]-=t*q[i],q[i]);
        }
        if(p[0]<0) R1(3) p[i]=-p[i];
        x=p[1],y=p[2];
        return p[0];
    }
    ModInt inv() const {
        ll x,y;
        extgcd(v,mod,x,y);
        return make(normS(x+mod));
    }
    ModInt pow(ll p) const {
        if(p<0) return inv().pow(-p);
        ModInt a = 1;
        ModInt x = *this;
        while(p){
            if(p&1) a *= x;
            x *= x;
            p >>= 1;
        }
        return a;
    }
    bool operator==(const ModInt& b) const { return v==b.v;}
    bool operator!=(const ModInt& b) const { return v!=b.v;}
    friend istream& operator>>(istream &o,ModInt& x){
        ll tmp;
        o>>tmp;
        x=ModInt(tmp);
        return o;
    }
    friend ostream& operator<<(ostream &o,const ModInt& x){ return o<<x.v;}
};
using mint = ModInt<1000000007>;

mint nCrMod(ll N, ll R) {
    mint res(1);
    for(ll i = N; i > N-R; --i) {
        res*=i;
    }
    for(ll i = R; i > 0; --i) {
        res/=i;
    }

    return res;
}

void A() {
}

void B() {
}

void C() {
    ll N;
    cin >> N;
    map<string, ll> freq;
    map<ll, set<string>> revFreq;
    R1(N) {
        string s;
        cin >> s;
        ++freq[s];
    }

    for(auto e : freq) {
        revFreq[e.second].insert(e.first);
    }

    for(auto e : revFreq.rbegin()->second) {
        cout << e << endl;
    }
}

void D() {
}

void E() {
}

void F() {

}

int main()
{
    C();
}

Measured memory_bytes: 34560