#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, ans = "";
  int n;
  cin >> n >> s;
  int temp = 0;
  for (int i = 1; i < n; i++) {
    string k = "";
    k += s[i - 1];
    k += s[i];
    int count = 0;
    for (int j = 1; j < n; j++) {
      string z = "";
      z += s[j - 1];
      z += s[j];
      if (k == z) count++;
    }
    if (count > temp) {
      ans.erase();
      temp = count;
      ans += k;
    }
  }
  cout << ans;
}
