#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  map<string, int> m;
  int groot = 0;
  string p = "";
  vector<string> vec;
  for (int i = 1; i < s.size(); i++) {
    p.push_back(s[i - 1]);
    p.push_back(s[i]);
    m[p]++;
    groot = max(groot, m[p]);
    vec.push_back(p);
    p = "";
  }
  for (int i = 0; i < vec.size(); i++) {
    if (m[vec[i]] == groot) {
      cout << vec[i] << endl;
      break;
    }
  }
  return 0;
}
