#include #include #include using namespace std; int main() { int n; map M; for(cin >> n ; n ; -- n) { string S; assert(cin >> S); M[S] ++; } pair Rez = {"", 0}; for(auto x : M) if(x.second > Rez.second) Rez = x; else if(x.second == Rez.second) if(x.first < Rez.first) Rez = x; cout << Rez.first << " " << Rez.second << "\n"; return 0; }