#include <bits/stdc++.h>
using namespace std;
int m[28][28];
char s[103];
int maxi, maxj;
int main() {
  int n;
  scanf("%d", &n);
  getchar();
  scanf("%c", &s[0]);
  for (int i = 1; i < n; i++) {
    scanf("%c", &s[i]);
    ++m[(int)s[i - 1] - (int)'A'][(int)s[i] - (int)'A'];
  }
  for (int i = 0; i < 28; i++)
    for (int j = 0; j < 28; j++)
      if (m[i][j] > m[maxi][maxj]) {
        maxi = i;
        maxj = j;
      }
  cout << (char)(maxi + (int)'A') << (char)(maxj + (int)'A');
  return 0;
}
