#include <bits/stdc++.h>
#include <climits>
#include <string>
using namespace std;
string ss;
unordered_map<string,int> res;
struct WORD{
    string s;
    int num;
    bool operator<(const WORD W)const
    {
        if(num==W.num)
        {
            return s<W.s;
        }
        return num>W.num;
    }
}word[110000];
int main()
{
    getline(cin,ss);
    int n=ss.size();
    ss+=' ';
    int i=0;
    while(i<n)
    {
        while(i<n&&ss[i]==' ')
        {
            i++;
        }
        if(i>=n)
        {
            break;
        }
        int j=i;
        while(ss[i]!=' ')
        {
            i++;
        }
        string tmp=ss.substr(j,i-j);
        res[tmp]++;
    }
    i=0;
    vector<WORD> ress;
    for(auto c:res)
    {
        ress.push_back({c.first,c.second});
    }
    sort(ress.begin(),ress.end());
    for(auto c :ress)
    {
        if(c.num<3)
        {
            break;
        }
        cout<<c.s<<endl;
    }
    return 0;
}