#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  char a[n];
  cin >> a;
  int count[26][26] = {0};
  int max = 0;
  int ai, aj;
  for (int i = 0; i < n - 1; i++) {
    count[a[i] - 65][a[i + 1] - 65]++;
    if (count[a[i] - 65][a[i + 1] - 65] > max) {
      ai = a[i] - 65;
      aj = a[i + 1] - 65;
      max = count[a[i] - 65][a[i + 1] - 65];
    }
  }
  cout << char(ai + 65) << char(aj + 65);
  return 0;
}
