#include <bits/stdc++.h>
using namespace std;
map<string, int> mp;
int main() {
  int i, n, a, mx = INT_MIN;
  string s, p, x;
  cin >> n >> s;
  for (i = 0; i < n - 1; i++) {
    p.clear();
    p += s[i];
    p += s[i + 1];
    mp[p]++;
    if (mp[p] > mx) {
      mx = mp[p];
      x = p;
    }
  }
  cout << x << "\n";
  return 0;
}
