#include <iostream>
#include <map>
#include <string>
using namespace std;
int main()
{
int n;
cin >> n;
string s;
map<string, int> s_set;
int k = n;
for (; k >= 0; k--)
{
getline(cin, s);
if (s_set.find(s) == s_set.end())
s_set[s] = 0;
else
s_set[s] += 1;
}
map<string, int>::iterator it = s_set.begin();
for (it++; it != s_set.end(); it++)
if (it->second > 0)
{
for(int i = 0; i<= it->second; i++)
cout << it->first << endl;
}
else
cout << it->first << endl;
return 0;
}