#include <bits/stdc++.h>
const int Max = 2e5 + 100;
using namespace std;
char str[Max];
int vis[Max];
int main() {
  int n;
  cin >> n >> str;
  for (int a = 0; a < n - 1; a++) {
    int tmp = (str[a] - 'A') * 26 + str[a + 1] - 'A';
    vis[tmp]++;
  }
  int maxs = 0, id = 0;
  for (int a = 0; a < Max; a++) {
    if (vis[a] > maxs) maxs = vis[a], id = a;
  }
  char ans[3];
  ans[1] = (char)(id % 26 + 'A');
  ans[2] = 0;
  ans[0] = char(id / 26 + 'A');
  cout << ans << endl;
  return 0;
}
