#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, count, max = 0;
  cin >> n;
  string s, S0, S1;
  cin >> s;
  for (int i = 0; i < n; i++) {
    count = 0;
    for (int j = 0; j < n; j++) {
      if (s[i] == s[j] && s[i + 1] == s[j + 1]) count++;
    }
    if (count > max) {
      max = count;
      S0 = s[i];
      S1 = s[i + 1];
    }
  }
  cout << S0 << S1;
}
