#include <bits/stdc++.h>
using namespace std;
string itosm(long long x) {
  if (x == 0) return "0";
  string ans = "";
  while (x > 0) {
    ans += ((x % 10) + '0');
    x /= 10;
  }
  reverse(ans.begin(), ans.end());
  return ans;
}
long long stoim(string str) {
  long long ans = 0;
  long long k = 1;
  int p = 0;
  if (str[0] == '-') p++;
  for (int i = str.length() - 1; i >= p; i--) {
    ans += (str[i] - '0') * k;
    k *= 10;
  }
  return ans;
}
const long long infll = 1e18 + 3;
const int inf = 1009000999;
const long double eps = 1e-7;
const int maxn = 1e6 + 1146;
const int baseint = 1000200013;
const long long basell = 1e18 + 3;
const long double PI = acos(-1.0);
const long long mod = 1e9 + 9;
void solve() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  string ans = "AA";
  int f = 0;
  for (char c1 = 'A'; c1 <= 'Z'; c1++) {
    for (char c2 = 'A'; c2 <= 'Z'; c2++) {
      int ff = 0;
      for (int i = 1; i < n; i++) {
        if (s[i - 1] == c1 && s[i] == c2) ff++;
      }
      if (ff > f) {
        f = ff;
        ans = c1;
        ans += c2;
      }
    }
  }
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  ;
  cin.tie(0);
  cout.tie(0);
  solve();
  return 0;
}
