stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include <iostream>

#include <algorithm>

#include <string>

#include <math.h>

#include <cstdint>

#include <sstream>

#include <map>

#include <cstring>

#include <vector>

#include <queue>

#include <iomanip>



using namespace std;

typedef long long ll;



ll ans, mx, sum, mn = 1e8, cnt;



string c[200001];

ll idx;

int main(){

	ll n;

	cin>>n;

	map<string,ll> mp;

	for(ll i=0; i<n; i++){

		string s;

		cin>>s;

		mp[s]++;

	}

	for(auto i : mp){

		mx = max(mx,i.second);

	}

	for(auto i : mp){

		if(i.second==mx) c[idx++]=i.first;

	}

	sort(c,c+idx);

	for(ll i=0; i<idx; i++){ 

		cout<<c[i]<<endl;

	}

	

}

// Faster C++ solution for the same problem (measured speedup: 8.03443828438083x):
#include<bits/stdc++.h>

using namespace std;



#define ll long long

#define fast_in_out  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);



int main()

{

    fast_in_out;

    map <string,int> m;

    map <string,int> :: iterator it;

    multimap <int,string> x;

    multimap <int,string> :: iterator xt;

    set <string> st;

    set <string> :: iterator si;

    int n;

    cin >> n;

    for(int i = 0; i < n; i++)

    {

        string s;

        cin >> s;

        it = m.find(s);

        if(it == m.end())

        {

            m.insert(make_pair(s,1));

        }

        else

        {

            m[s]++;

        }

    }

    for(it = m.begin(); it != m.end(); it++)

    {

        x.insert(make_pair(it -> second, it -> first));

    }

    xt = x.end();

    xt--;

    int maxi = xt -> first;

    for(xt = x.begin(); xt != x.end(); xt++)

    {

        if(xt -> first == maxi)

        {

            st.insert(xt -> second);

        }

    }

    for(si = st.begin(); si != st.end(); si++)

    {

        cout << *si << "\n";

    }

}
// Slower C++ solution:
#include <iostream>

#include <algorithm>

#include <string>

#include <math.h>

#include <cstdint>

#include <sstream>

#include <map>

#include <cstring>

#include <vector>

#include <queue>

#include <iomanip>



using namespace std;

typedef long long ll;



ll ans, mx, sum, mn = 1e8, cnt;



string c[200001];

ll idx;

int main(){

	ll n;

	cin>>n;

	map<string,ll> mp;

	for(ll i=0; i<n; i++){

		string s;

		cin>>s;

		mp[s]++;

	}

	for(auto i : mp){

		mx = max(mx,i.second);

	}

	for(auto i : mp){

		if(i.second==mx) c[idx++]=i.first;

	}

	sort(c,c+idx);

	for(ll i=0; i<idx; i++){ 

		cout<<c[i]<<endl;

	}

	

}

// Faster C++ solution for the same problem (measured speedup: 8.106879461274218x):
#include <functional>  

#include <iostream>    

#include <map>       

#include <set>        

#include <string>     

#include <utility>     

#include <vector>      



using namespace std;

#define endl '\n'

typedef long long ll;

typedef vector<int> vi;

typedef vector<ll> vl;

#define pb push_back

#define lb lower_bound

#define ub upper_bound

#define MOD 1000000007

#define pi acos(-1.0)

#define MAX 10000001

//////////////////////////////////////////////////////////////////////////

/* Custom function starts here */



/* Custom function ends here: */

//////////////////////////////////////////////////////////////////////////////



int main() {

  ios_base::sync_with_stdio(false);

  cin.tie(0);

  cout.precision(20);



  /* MAIN Code STARTS here: */

  map<string, int> mm;

  int cases;

  cin >> cases;

  while (cases--) {



    string s;

    cin >> s;



    if (mm.find(s) == mm.end()) {

      mm[s] = 1;

    } else {

      mm[s]++;

    }

  }



  set<int, greater<int>> sss;

  for (auto itr : mm) {

    sss.insert(itr.second);

  }

  auto store = *sss.begin();

//   cout << store << endl;

  



for(auto itr : mm){

    // cout << itr.first << " ----" << itr.second << endl;

    if(itr.second == store){

        cout << itr.first << endl;

    }

}



  /* MAIN Code ENDS here: */

  

}
// Slower C++ solution:
#include <bits/stdc++.h>



using namespace std;



int c[200005];



string s[200005];



int main()

{

    string str;

    int n,a=0,b=1;

    cin>>n;

    for(int i=0; i<n; i++)

    {

        cin>>s[i];

    }



    sort(s,s+n);



    str=s[0];

    for(int i=1; i<n; i++)

    {

        if(s[i]!=str)

        {

            str=s[i];

            c[a]=b;

            a++;

            b=1;

        }

        else

        {

            b++;

        }

    }

    c[a]=b;

    sort(c,c+a+1);





    int y=c[a],k=1;



    if(y==1)

    {

        cout<<s[0]<<endl;

    }

    for(int i=1; i<n; i++)

    {

        if(s[i-1]==s[i])

        {

            k++;

        }

        else

        {

            k=1;

        }

        if(k==y)

        {

            cout<<s[i]<<endl;

        }

    }



    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 8.093937885398457x):
#include <functional>  

#include <iostream>    

#include <map>       

#include <set>        

#include <string>     

#include <utility>     

#include <vector>      



using namespace std;

#define endl '\n'

typedef long long ll;

typedef vector<int> vi;

typedef vector<ll> vl;

#define pb push_back

#define lb lower_bound

#define ub upper_bound

#define MOD 1000000007

#define pi acos(-1.0)

#define MAX 10000001

//////////////////////////////////////////////////////////////////////////

/* Custom function starts here */



/* Custom function ends here: */

//////////////////////////////////////////////////////////////////////////////



int main() {

  ios_base::sync_with_stdio(false);

  cin.tie(0);

  cout.precision(20);



  /* MAIN Code STARTS here: */

  map<string, int> mm;

  int cases;

  cin >> cases;

  while (cases--) {



    string s;

    cin >> s;



    if (mm.find(s) == mm.end()) {

      mm[s] = 1;

    } else {

      mm[s]++;

    }

  }



  set<int, greater<int>> sss;

  for (auto itr : mm) {

    sss.insert(itr.second);

  }

  auto store = *sss.begin();

//   cout << store << endl;

  



for(auto itr : mm){

    // cout << itr.first << " ----" << itr.second << endl;

    if(itr.second == store){

        cout << itr.first << endl;

    }

}



  /* MAIN Code ENDS here: */

  

}
// Slower C++ solution:
#include <iostream>

#include <algorithm>

#include <string>

#include <math.h>

#include <cstdint>

#include <sstream>

#include <map>

#include <cstring>

#include <vector>

#include <queue>

#include <iomanip>



using namespace std;

typedef long long ll;



ll ans, mx, sum, mn = 1e8, cnt;



string c[200001];

ll idx;

int main(){

	ll n;

	cin>>n;

	map<string,ll> mp;

	for(ll i=0; i<n; i++){

		string s;

		cin>>s;

		mp[s]++;

	}

	for(auto i : mp){

		mx = max(mx,i.second);

	}

	for(auto i : mp){

		if(i.second==mx) c[idx++]=i.first;

	}

	sort(c,c+idx);

	for(ll i=0; i<idx; i++){ 

		cout<<c[i]<<endl;

	}

	

}

// Faster C++ solution for the same problem (measured speedup: 8.017903810721839x):
#include<iostream>

#include<map>

#include<algorithm>

#include<vector>

using namespace std;



map<string, int> Nvotes;

vector<pair<string, int>> votes;



bool cmp(pair<string, int> &v1, pair<string, int> &v2)

{

        if(v1.second!=v2.second)return v1.second>v2.second;

        if(v1.first!=v2.first)return v1.first<v2.first;

}



void preenche()

{

    votes.reserve(Nvotes.size());

    map<string, int>::iterator i;

    for(i = Nvotes.begin(); i!=Nvotes.end(); i++)

    {

        votes.push_back(make_pair(i->first, i->second));

    }

    sort(votes.begin(), votes.end(), cmp);

}



int main()

{

    ios_base::sync_with_stdio(false);

    cin.tie(NULL);



    int N;

    cin>>N;

    string s;

    while(N--)

    {

        cin>>s;

        Nvotes.insert( make_pair(s, Nvotes[s]++) );

    }

    preenche();



    int I = 0;



    while(votes[I].second == votes[0].second)

    {

        cout<<votes[I].first<<endl;

        I++;

    }

    return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>



using namespace std;



int c[200005];



string s[200005];



int main()

{

    string str;

    int n,a=0,b=1;

    cin>>n;

    for(int i=0; i<n; i++)

    {

        cin>>s[i];

    }



    sort(s,s+n);



    str=s[0];

    for(int i=1; i<n; i++)

    {

        if(s[i]!=str)

        {

            str=s[i];

            c[a]=b;

            a++;

            b=1;

        }

        else

        {

            b++;

        }

    }

    c[a]=b;

    sort(c,c+a+1);





    int y=c[a],k=1;



    if(y==1)

    {

        cout<<s[0]<<endl;

    }

    for(int i=1; i<n; i++)

    {

        if(s[i-1]==s[i])

        {

            k++;

        }

        else

        {

            k=1;

        }

        if(k==y)

        {

            cout<<s[i]<<endl;

        }

    }



    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 8.005104272869243x):
#include<iostream>

#include<map>

#include<algorithm>

#include<vector>

using namespace std;



map<string, int> Nvotes;

vector<pair<string, int>> votes;



bool cmp(pair<string, int> &v1, pair<string, int> &v2)

{

        if(v1.second!=v2.second)return v1.second>v2.second;

        if(v1.first!=v2.first)return v1.first<v2.first;

}



void preenche()

{

    votes.reserve(Nvotes.size());

    map<string, int>::iterator i;

    for(i = Nvotes.begin(); i!=Nvotes.end(); i++)

    {

        votes.push_back(make_pair(i->first, i->second));

    }

    sort(votes.begin(), votes.end(), cmp);

}



int main()

{

    ios_base::sync_with_stdio(false);

    cin.tie(NULL);



    int N;

    cin>>N;

    string s;

    while(N--)

    {

        cin>>s;

        Nvotes.insert( make_pair(s, Nvotes[s]++) );

    }

    preenche();



    int I = 0;



    while(votes[I].second == votes[0].second)

    {

        cout<<votes[I].first<<endl;

        I++;

    }

    return 0;

}
// Slower C++ solution:
#include <iostream>

#include <algorithm>

#include <string>

#include <math.h>

#include <cstdint>

#include <sstream>

#include <map>

#include <cstring>

#include <vector>

#include <queue>

#include <iomanip>



using namespace std;

typedef long long ll;



ll ans, mx, sum, mn = 1e8, cnt;



string c[200001];

ll idx;

int main(){

	ll n;

	cin>>n;

	map<string,ll> mp;

	for(ll i=0; i<n; i++){

		string s;

		cin>>s;

		mp[s]++;

	}

	for(auto i : mp){

		mx = max(mx,i.second);

	}

	for(auto i : mp){

		if(i.second==mx) c[idx++]=i.first;

	}

	sort(c,c+idx);

	for(ll i=0; i<idx; i++){ 

		cout<<c[i]<<endl;

	}

	

}

// Faster C++ solution for the same problem (measured speedup: 8.123860338743565x):


#include <bits/stdc++.h>

#include<algorithm>

#include<cstring>

#include<cmath>

#include<cstdlib>

#include<string.h>

using namespace std;

#define pb push_back

#define all(v) v. begin(),v. end()

#define  rep(i,n,v) for(i=n;i<v;i++)

#define per(i,n,v) for(i=n;i>v;i--)

#define ff first 

#define ss second 

#define pp pair<ll,ll>

#define ll  long long

#define endl '\n'

void solve()

{

  ll n, a,m=1,b=1, c,k=0, i, j,l=1e9+7;

  string s, r, y;

  cin>>n;

  vector<string>v;

  map<string,int>hash;

  rep(i,0,n) {cin>>s;hash[s]++;}

  for(auto x:hash)

  {

    if(x.ss>k)k=x.ss;

  }

  for(auto it=hash.begin();it!=hash.end();it++)

  {

    if(it->ss==k) cout<<it->ff<<endl;

  }

  /*rep(i,0,v.size()) hash[v[i]]++;

  int max_count = 0, res = -1; 



    for (auto i : hash) { 



        if (max_count < i.second) { 



            //res = i.first; 



            max_count = i.second; 



        } 



    }

    vector<string>vec;

    for (auto i : hash) { 



        if (max_count == i.second) { */

/*r=i.first;

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

            cout<<r<<endl;*/

            /*  vec. pb(i.first);



            max_count = i.second; 



        } }

        rep(i,0,vec.size()) cout<<vec[i]<<endl;*/

    

  /*sort(all(v));

  rep(i,0,v.size())

  {

    if(v[i]==v[i+1] && i+1<v.size()) {k++;continue;}

    if(k>m) {m=k;k=0;}

  }

  k=0;

  rep(i,0,v.size())

  {

    if(v[i]==v[i+1] && i+1<v.size()) {k++;continue;}

    if(k==m) {sort(v[i].begin(),v[i].end());cout<<v[i]<<endl;}

    k=0;

  }*/

  

  /*sort(r.begin(),r. end());

  cout<<r;*/

}

int main()

{

 ios_base::sync_with_stdio(false);

  cin. tie(0);cout. tie(0);

    ll t=1;

   //cin>>t;

    while(t--)

    {

      solve();

    }

    return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>



using namespace std;



int c[200005];



string s[200005];



int main()

{

    string str;

    int n,a=0,b=1;

    cin>>n;

    for(int i=0; i<n; i++)

    {

        cin>>s[i];

    }



    sort(s,s+n);



    str=s[0];

    for(int i=1; i<n; i++)

    {

        if(s[i]!=str)

        {

            str=s[i];

            c[a]=b;

            a++;

            b=1;

        }

        else

        {

            b++;

        }

    }

    c[a]=b;

    sort(c,c+a+1);





    int y=c[a],k=1;



    if(y==1)

    {

        cout<<s[0]<<endl;

    }

    for(int i=1; i<n; i++)

    {

        if(s[i-1]==s[i])

        {

            k++;

        }

        else

        {

            k=1;

        }

        if(k==y)

        {

            cout<<s[i]<<endl;

        }

    }



    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 8.11089165511133x):


#include <bits/stdc++.h>

#include<algorithm>

#include<cstring>

#include<cmath>

#include<cstdlib>

#include<string.h>

using namespace std;

#define pb push_back

#define all(v) v. begin(),v. end()

#define  rep(i,n,v) for(i=n;i<v;i++)

#define per(i,n,v) for(i=n;i>v;i--)

#define ff first 

#define ss second 

#define pp pair<ll,ll>

#define ll  long long

#define endl '\n'

void solve()

{

  ll n, a,m=1,b=1, c,k=0, i, j,l=1e9+7;

  string s, r, y;

  cin>>n;

  vector<string>v;

  map<string,int>hash;

  rep(i,0,n) {cin>>s;hash[s]++;}

  for(auto x:hash)

  {

    if(x.ss>k)k=x.ss;

  }

  for(auto it=hash.begin();it!=hash.end();it++)

  {

    if(it->ss==k) cout<<it->ff<<endl;

  }

  /*rep(i,0,v.size()) hash[v[i]]++;

  int max_count = 0, res = -1; 



    for (auto i : hash) { 



        if (max_count < i.second) { 



            //res = i.first; 



            max_count = i.second; 



        } 



    }

    vector<string>vec;

    for (auto i : hash) { 



        if (max_count == i.second) { */

/*r=i.first;

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

            cout<<r<<endl;*/

            /*  vec. pb(i.first);



            max_count = i.second; 



        } }

        rep(i,0,vec.size()) cout<<vec[i]<<endl;*/

    

  /*sort(all(v));

  rep(i,0,v.size())

  {

    if(v[i]==v[i+1] && i+1<v.size()) {k++;continue;}

    if(k>m) {m=k;k=0;}

  }

  k=0;

  rep(i,0,v.size())

  {

    if(v[i]==v[i+1] && i+1<v.size()) {k++;continue;}

    if(k==m) {sort(v[i].begin(),v[i].end());cout<<v[i]<<endl;}

    k=0;

  }*/

  

  /*sort(r.begin(),r. end());

  cout<<r;*/

}

int main()

{

 ios_base::sync_with_stdio(false);

  cin. tie(0);cout. tie(0);

    ll t=1;

   //cin>>t;

    while(t--)

    {

      solve();

    }

    return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

const int N=2e5+5;

char tmp[N];

pair<int,string> A[N];

map<string , int> idx;

map<string , int>mp;

map<int,vector<string> > rmp;

int main()

{

    int n,mx=-1;

    scanf("%d",&n);

    string s;

    for(int i=0;i<n;++i){

        scanf("%s",tmp);

        string s(tmp);

        mx = max(mx,++mp[s]);

        rmp[mp[s]].push_back(s);

    }

    sort(rmp[mx].begin(),rmp[mx].end());

    for(auto x:rmp[mx]){

        printf("%s\n",x.c_str());

    }



    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 9.966671172292594x):


#include<iostream>

#include<vector>

#include<map>

#include<algorithm>

#include<cmath>

using namespace std;

bool chk(string str1 , string str2)

{

    if (str1 > str2)

    {

        return false;

    }

    else

    {

        return true;

    }

}

int main()

{

    int N;

    cin >> N;

    map<string, int> Map;

    for (int i = 0; i <N; i++)

    {

        string x;

        cin >> x;

        Map[x]++;

    }

    int Max = 0;

    for (auto it : Map)

    {

        Max = max(Max, it.second);

    }

    vector<string> str;

    for (auto it : Map)

    {

        if (it.second == Max)

            str.push_back(it.first);

    }

    sort(str.begin(), str.end(), chk);

    for (int i = 0; i < str.size(); i++)

    {

        cout << str[i] << endl;

    }

    return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

const int N=2e5+5;

char tmp[N];

pair<int,string> A[N];

map<string , int> idx;

map<string , int>mp;

map<int,vector<string> > rmp;

int main()

{

    int n,mx=-1;

    scanf("%d",&n);

    string s;

    for(int i=0;i<n;++i){

        scanf("%s",tmp);

        string s(tmp);

        mx = max(mx,++mp[s]);

        rmp[mp[s]].push_back(s);

    }

    sort(rmp[mx].begin(),rmp[mx].end());

    for(auto x:rmp[mx]){

        printf("%s\n",x.c_str());

    }



    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 9.861128524686977x):
#include <bits/stdc++.h>



using namespace std;



typedef long long int64;

typedef vector<int64> vi;

typedef pair<int, int> pii;



const int oo = 0x3f3f3f3f;

const double pi = acos(-1);

const double eps = 1e-9;



#define endl '\n'





int main() {

	ios_base::sync_with_stdio(0);

	cin.tie(0);



	int n;

	cin >> n;



	map<string, int> m;

	vector<string> S(n);



	vector<string> ans;

	int mx = 0;



	for (int i = 0; i < n; ++i){

		cin >> S[i];

		m[S[i]]++;



		if (m[S[i]] > mx){

			ans = vector<string>();

			mx = m[S[i]];

		}

		if (m[S[i]] == mx){

			ans.push_back(S[i]);

		}

	}



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

	for (int i = 0; i < ans.size(); ++i)

		cout << ans[i] << endl;



	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

const int N=2e5+5;

char tmp[N];

pair<int,string> A[N];

map<string , int> idx;

map<string , int>mp;

map<int,vector<string> > rmp;

int main()

{

    int n,mx=-1;

    scanf("%d",&n);

    string s;

    for(int i=0;i<n;++i){

        scanf("%s",tmp);

        string s(tmp);

        mx = max(mx,++mp[s]);

        rmp[mp[s]].push_back(s);

    }

    sort(rmp[mx].begin(),rmp[mx].end());

    for(auto x:rmp[mx]){

        printf("%s\n",x.c_str());

    }



    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 9.885943090863227x):
#pragma GCC optimize("O3")



#include <bits/stdc++.h>



typedef long long ll;

typedef unsigned long long ull;

typedef long double ld;

#define F first

#define S second

#define pii pair<int,int>

#define pll pair<ll, ll>

#define vi vector<int>

#define vll vector<ll>

#define vii vector<pii>

#define read(FILE)  freopen(FILE, "r", stdin);

#define out(FILE) freopen(FILE, "w", stdout);

#define clr(x, y) memset(x,y,sizeof(x));

#define IO ios_base::sync_with_stdio(0);cin.tie(0); cout.tie(0);

#define all(x) x.begin(),x.end()

#define rep(i, m, n) for(int i=m ; i<n ; i++)

#define forr(i, m, n) for(ll i=m ; i<=n ; i++)

#define endl '\n'

#define pb push_back

#define re return

const int N = 2e5 + 5;

const ll OO = 1e9 + 7;

using namespace std;





int main() {

    IO;

    int n;

    cin >> n;

    map<string, int> cnt;

    vector<string> ans;

    rep(i, 0, n) {

        string s;

        cin >> s;

        cnt[s]++;

    }

    int mx = 0;

    for (auto i:cnt) mx = max(mx, i.S);



    for (auto i:cnt) {

        if (i.S == mx) {

            ans.pb(i.F);

        }

    }

    for (auto i:ans) cout << i << endl;



}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

const int N=2e5+5;

char tmp[N];

pair<int,string> A[N];

map<string , int> idx;

map<string , int>mp;

map<int,vector<string> > rmp;

int main()

{

    int n,mx=-1;

    scanf("%d",&n);

    string s;

    for(int i=0;i<n;++i){

        scanf("%s",tmp);

        string s(tmp);

        mx = max(mx,++mp[s]);

        rmp[mp[s]].push_back(s);

    }

    sort(rmp[mx].begin(),rmp[mx].end());

    for(auto x:rmp[mx]){

        printf("%s\n",x.c_str());

    }



    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 9.92189905574118x):
#include <bits/stdc++.h>



using namespace std;



map < string, int > mp;

map < string, int > :: iterator it;

int n, maxi=0;

string s;



int main()

{

    cin >> n;

    while (n--){

        cin >> s;

        mp[s]++;

    if (mp[s] > maxi) maxi = mp[s];

    }



    for (it = mp.begin (); it!= mp.end(); it++) if (it -> second == maxi) cout << it -> first <<endl;



    return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

const int N=2e5+5;

char tmp[N];

pair<int,string> A[N];

map<string , int> idx;

map<string , int>mp;

map<int,vector<string> > rmp;

int main()

{

    int n,mx=-1;

    scanf("%d",&n);

    string s;

    for(int i=0;i<n;++i){

        scanf("%s",tmp);

        string s(tmp);

        mx = max(mx,++mp[s]);

        rmp[mp[s]].push_back(s);

    }

    sort(rmp[mx].begin(),rmp[mx].end());

    for(auto x:rmp[mx]){

        printf("%s\n",x.c_str());

    }



    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 9.880271783707073x):
#include<bits/stdc++.h>

#define FastRead ios_base::sync_with_stdio(false);cin.tie(0),cout.tie(0);cin.tie(0),cout.tie(0);

#define ll long long int

#define Endl cout<<"\n"

using namespace std;

int main()

{

    FastRead;

    ll i,j,n,mn=0,t,c,x,y;

    string a;

    cin>>t;

    map< string,ll >mp;

    while(t--){

        ll z=0,tw=0;

        cin>>a;

        mp[a]++;

        mn=max(mn,mp[a]);



    }

    for(auto i:mp){

        if(i.second==mn){

            cout<<i.first<<endl;

        }

    }





    return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

const int N=2e5+5;

char tmp[N];

pair<int,string> A[N];

map<string , int> idx;

map<string , int>mp;

map<int,vector<string> > rmp;

int main()

{

    int n,mx=-1;

    scanf("%d",&n);

    string s;

    for(int i=0;i<n;++i){

        scanf("%s",tmp);

        string s(tmp);

        mx = max(mx,++mp[s]);

        rmp[mp[s]].push_back(s);

    }

    sort(rmp[mx].begin(),rmp[mx].end());

    for(auto x:rmp[mx]){

        printf("%s\n",x.c_str());

    }



    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 9.96422501536834x):
#include<bits/stdc++.h>

using namespace std;

int main()

{

    map < string , int > mp;

    int n;

    scanf("%d",&n);

    int mx=0;

    while(n--)

    {

        string s;

        cin>>s;

        mp[s]++;

        mx=max(mx,mp[s]);

    }

    for(auto i : mp)

    {

        if(i.second==mx)

        {

            cout<<i.first<<endl;

        }

    }

    cout<<endl;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

const int N=2e5+5;

char tmp[N];

pair<int,string> A[N];

map<string , int> idx;

map<string , int>mp;

map<int,vector<string> > rmp;

int main()

{

    int n,mx=-1;

    scanf("%d",&n);

    string s;

    for(int i=0;i<n;++i){

        scanf("%s",tmp);

        string s(tmp);

        mx = max(mx,++mp[s]);

        rmp[mp[s]].push_back(s);

    }

    sort(rmp[mx].begin(),rmp[mx].end());

    for(auto x:rmp[mx]){

        printf("%s\n",x.c_str());

    }



    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 9.752634182392141x):
#include<bits/stdc++.h>

using namespace std;

typedef long long int ll;

typedef long double lld;

ll MOD = (1e9)+7;

//#pragma GCC target ("avx2")

//#pragma GCC optimization ("O3")

//#pragma GCC optimization ("unroll-loops")

inline void fastIO(){

  ios_base::sync_with_stdio(0);cin.tie(0);

}



int main(){

  fastIO();

  int n;

  cin>>n;

  map<string,int>rep;

  vector<pair<int,string>>ans;

  for(int i=0;i<n;i++){

    string s;

    cin>>s;

    rep[s]++;

  }

  for(auto k:rep){

    ans.push_back(make_pair(k.second,k.first));

  }

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

  int x=ans[ans.size()-1].first;

  vector<string>final;

  for(int i=ans.size()-1;i>=0;i--){

    if(ans[i].first==x){

      final.push_back(ans[i].second);

    }

  }

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

  for(int i=0;i<final.size();i++){

    cout<<final[i]<<endl;

  }

  return 0;

}