#include <bits/stdc++.h>
using namespace std;
map<string, int> mp;
int main() {
  int n, c = 0;
  cin >> n;
  string s;
  cin >> s;
  string res;
  for (int i = 0; i < n - 1; i++) {
    string temp;
    temp.push_back(s[i]);
    temp.push_back(s[i + 1]);
    mp[temp]++;
    c = max(c, mp[temp]);
    if (c == mp[temp]) res = temp;
  }
  cout << res;
  return 0;
}
