#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  map<string, int> grams;
  for (int i = 0; i < n - 1; i++) {
    string k;
    k.push_back(s[i]);
    k.push_back(s[i + 1]);
    if (grams.count(k) == 0)
      grams[k] = 1;
    else
      grams[k] += 1;
  }
  int maxi = -1;
  string gram = "";
  for (auto e : grams) {
    if (e.second > maxi) {
      maxi = e.second;
      gram = e.first;
    }
  }
  cout << gram << endl;
  return 0;
}
