#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int mx = 0;
  char x, y;
  for (char a = 'A'; a <= 'Z'; a++) {
    for (char b = 'A'; b <= 'Z'; b++) {
      int as = 0;
      for (int i = 0; i < s.length() - 1; i++) {
        if (s[i] == a && s[i + 1] == b) as++;
      }
      if (as > mx) {
        mx = as;
        x = a;
        y = b;
      }
    }
  }
  cout << x << y << endl;
  return 0;
}
