#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, mx = 0;
  string s;
  pair<char, char> ans;
  map<pair<char, char>, int> mp;
  cin >> n >> s;
  for (int i = 1; i < n; i++) {
    pair<char, char> curr = make_pair(s[i - 1], s[i]);
    mp[curr]++;
    if (mp[curr] > mx) mx = mp[curr], ans = curr;
  }
  cout << ans.first << ans.second << endl;
  return 0;
}
