#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long int n, ans = 0;
  cin >> n;
  string s, t;
  cin >> s;
  vector<pair<long long int, long long int> > v;
  for (long long int i = 0; i < n - 1; i += 1) {
    long long int cnt = 1;
    t = s.substr(i, 2);
    for (long long int j = i + 1; j < n - 1; j += 1) {
      if (t == s.substr(j, 2)) cnt++;
    }
    ans = max(ans, cnt);
    if (cnt == ans) v.push_back(make_pair(cnt, i));
  }
  for (long long int i = 0; i < v.size(); i += 1) {
    if (v[i].first == ans) {
      cout << s[v[i].second] << s[v[i].second + 1];
      break;
    }
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long int t;
  t = 1;
  while (t--) {
    solve();
    cout << '\n';
  }
  return 0;
}
