#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  while (cin >> n) {
    int map[30][30] = {0};
    string s;
    cin >> s;
    int maxx = 0;
    int maxs;
    for (int i = 0; i < s.size() - 1; i++) {
      map[s[i] - 'A'][s[i + 1] - 'A']++;
      if (map[s[i] - 'A'][s[i + 1] - 'A'] > maxx) {
        maxx = map[s[i] - 'A'][s[i + 1] - 'A'];
        maxs = i;
      }
    }
    cout << s[maxs] << s[maxs + 1] << endl;
  }
  return 0;
}
