#include <bits/stdc++.h>
char a[1005];
int sum[50][50] = {};
int main() {
  int n;
  scanf("%d", &n);
  scanf("%s", a);
  for (int i = 0; i < n - 1; i++) {
    int x, y;
    x = a[i] - 'A';
    y = a[i + 1] - 'A';
    sum[x][y]++;
  }
  int mmax = 0, flag = 0, MMAX1, MMAX2;
  for (int i = 0; i < 28; i++) {
    for (int j = 0; j < 28; j++) {
      if (sum[i][j] > mmax) {
        mmax = sum[i][j];
        MMAX1 = i;
        MMAX2 = j;
      }
    }
  }
  char w, e;
  w = MMAX1 + 'A';
  e = MMAX2 + 'A';
  printf("%c%c", w, e);
  return 0;
}
