#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, p = 0, ans = 0;
  string s, dvg, answ, r_dvg;
  cin >> n >> s;
  for (int i = 0; i < n - 1; i++) {
    dvg = s.substr(i, 2);
    for (int j = i; j < n - 1; j++) {
      r_dvg = s.substr(j, 2);
      if (dvg == r_dvg) {
        p++;
      }
    }
    if (p > ans) {
      ans = p;
      answ = dvg;
    }
    p = 0;
  }
  cout << answ << endl;
  return 0;
}
