#include <bits/stdc++.h>
using namespace std;
int main() {
  int64_t n;
  string s;
  cin >> n;
  cin >> s;
  std::map<int, int> compteur;
  int64_t max = 0;
  string max_s;
  for (int64_t i = 0; i < n - 1; i++) {
    compteur[(s[i] - 'A') * 26 + (s[i + 1] - 'A')]++;
    if (compteur[(s[i] - 'A') * 26 + (s[i + 1] - 'A')] > max) {
      max++;
      max_s = s.substr(i, 2);
    }
  }
  cout << max_s;
  return 0;
}
