/*																													   
 Templatka c++ Kacper Fis																							   																											   //
*/																													  
																								   
#include <bits/stdc++.h>																							   
																													   
using namespace std; 																								   
		
const double eps = 1e-9;																							   
const int INF = 1000000001;																						   
const float PI = 3.14;																								   
typedef long long LL;																								   
																													   
typedef vector<int> vi;																								   
typedef list<int> li;																								   
typedef queue<int> qi; 																								   
typedef pair<int,int> ii; 																							   
typedef map<string,int> msi; //np msi['nazwa'] = 'liczba'															   
typedef vector<ii> vii; //vector par<int>, do tworzenia tablicy dla grafów wagowych #dijkstra #Bellman_Ford			   
typedef priority_queue< ii, vector<ii>, greater<ii> > pq; //kolejka priorytetowa vectorów par(top()=min) #dijkstra	   
																													   																				   
vector<ii>::iterator iter;																							   
																													   																				   
#define print_list(x) for(it = (x).begin(); it != (x).end(); it++) {cout << *it << " ";}							   
#define print_vector(x) for(it2 = (x).begin(); it2 != (x).end(); it2++) {cout << *it2 << " ";}						   
#define search_list(x) for(it = (x).begin(); it != (x).end(); it++)													   
#define search_vector(x) for(it2 = (x).begin(); it2 != (x).end(); it2++);											   
#define pb(x) push_back(x) 																							   
#define pf(x) push_front(x)																							   
#define mp(x, y) make_pair(x, y)                                                                                       
///////////////////////////////////////////////GLOBAL DEFINITIONS////////////////////////////////////////////////////////


///////////////////////////////////////////////////FUNCTIONS/////////////////////////////////////////////////////////////


/////////////////////////////////////////////////////MAIN////////////////////////////////////////////////////////////////
int main(int argc, char* argv[])																					 
{ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);                  												       
///////////////////////////////////////////////////////////////////////////////////////////////////////////
   
	map <string, int> MAP;
	int n;
	cin >> n;
	for(int i = 0; i < n; i++){
		string s;
		cin >> s;
		auto it = MAP.find(s);
		if(it != MAP.end()){ //znalazlo
			it->second++;
		}
		MAP.insert(mp(s, 1));
	}
   
	vector< pair<int, string> > V;
	//cout << "MAP: " << endl;
	for(auto it : MAP){
		V.pb(mp(it.second, it.first));
		//cout << it.first << " " << it.second << endl;
	}
	
	sort(V.begin(), V.end());
	reverse(V.begin(), V.end());
	
	auto ite = V[0].first;
	int current = ite;
	//cout << "ite: " << ite << endl;
	//cout << "current: " << current << endl;
	//cout << "V: " << endl;
	vector<string> ans;
	for(auto it : V){
		if(it.first == current){
			ans.pb(it.second);
		}
		else break;
	}
	
	sort(ans.begin(), ans.end());
	for(auto it : ans){
		cout << it << endl;
	}
	
	return 0;
}


Measured memory_bytes: 32236