#include <iostream>
#include <unordered_map>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
int main() {
//构建unordered_map,记录不同单词的出现次数
unordered_map<string,int> map;
string s;
while(cin >> s){
if(map.count(s)){
map[s]++;
}
else{
map.insert({s, 1});
}
}
//将map的内容复制给另一个vector容器,并按要求排序
vector<pair<string, int>> v(map.begin(),map.end());
sort(v.begin(), v.end(),[](const auto &a, const auto &b){
if(a.second == b.second){
return a.first < b.first;
}
else{
return a.second > b.second;
}
}
);
//输出关键词(到关键词出现次数低于3的就结束)
vector<pair<string, int>>::iterator it;
for(it = v.begin(); it != v.end() && it->second >= 3; it++){
cout << it->first << endl;
}
return 0;
}
// 64 位输出请用 printf("%lld")