#include <bits/stdc++.h>
using namespace std;
string s;
map<string, int> m;
int main() {
  int n, maxnum = 0;
  string ed;
  cin >> n >> s;
  for (int i = 0; i < n - 1; i++) {
    string ss;
    ss.push_back(s[i]);
    ss.push_back(s[i + 1]);
    m[ss]++;
    if (m[ss] > maxnum) {
      maxnum = m[ss];
      ed = ss;
    }
  }
  cout << ed << endl;
  return 0;
}
