#include <bits/stdc++.h>
using namespace std;
map<string, int> cnt;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(nullptr);
  int n;
  cin >> n;
  string s;
  cin >> s;
  for (int i = 0; i + 1 < s.size(); ++i) {
    string cur = "";
    cur += s[i];
    cur += s[i + 1];
    cnt[cur]++;
  }
  auto it = cnt.begin();
  string ans = (*it).first;
  for (auto p : cnt) {
    if (cnt[ans] < p.second) ans = p.first;
  }
  cout << ans;
  return 0;
}
