#include <bits/stdc++.h>
using namespace std;
map<string, int> a;
string b, c;
int n;
void work(void) {
  map<string, int>::iterator p;
  int i, t;
  t = 0;
  for (i = 0; i <= n - 2; i++) {
    c = b[i];
    c += b[i + 1];
    a[c]++;
  }
  for (p = a.begin(); p != a.end(); p++)
    if (p->second > t) {
      t = p->second;
      c = p->first;
    }
  cout << c;
}
int main(void) {
  cin >> n;
  cin >> b;
  work();
  return 0;
}
