#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, cnt[30][30] = {0}, subcnt = 0, strf = 0, strl = 0;
  string s;
  cin >> n >> s;
  for (int i = 0; i < n - 1; i++) {
    int x = s[i] - 'A';
    int y = s[i + 1] - 'A';
    cnt[x][y]++;
  }
  for (int i = 0; i < 26; i++) {
    for (int j = 0; j < 26; j++) {
      if (cnt[i][j] > subcnt) {
        strf = i;
        strl = j;
        subcnt = cnt[i][j];
      }
    }
  }
  printf("%c%c\n", strf + 'A', strl + 'A');
  return 0;
}
