#include <bits/stdc++.h>
using namespace std;
long long a[1000006];
int main(int argc, char const *argv[]) {
  string s;
  int n;
  cin >> n;
  map<string, int> mp;
  vector<string> v;
  cin >> s;
  for (int i = 1; i < n; i++) {
    string temp = "";
    temp += s[i - 1];
    temp += s[i];
    mp[temp]++;
    v.push_back(temp);
  }
  int mx = 0;
  string ans;
  for (int i = 0; i < v.size(); i++) {
    if (mp[v[i]] >= mx) {
      ans = v[i];
      mx = mp[v[i]];
    }
  }
  cout << ans << endl;
  return 0;
}
