15
MIRZOYANOVECLOX
 23
AABBBAAACCCCCAAADDDDDDD
 2
QA
 11
GGRRAATTZZZ
 6
AZAZAZ
 10
SQSQSQSQTG
 3
KEK
 100
URXCAIZFIBNJTPCZHBQIBCILLPXZCFGMKKZMNPLCYGAVJVIBMCZEBSJWPSCPQDYCTTKPOKIJRSKIZPDGCHVOUTMPNECYORSFZFNC
 3
LOL
 2
WW
 8
PUTINVOR
 26
QWERTYUIOPASDFGHJKLZXCVBNM
 5
AZAZA
 9
EGORLETOV
 7
KADUROV
 9
MIKEPIDOR
 9
AAAAAAAAA
 100
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
 5
FUFEL
 50
NYQAHBYYOXLTRYQDMVENEMAQNBAKGLGQOLXNAIFNQTOCLNNQIA

MI
 DD
 QA
 ZZ
 AZ
 SQ
 KE
 IB
 LO
 WW
 PU
 QW
 AZ
 EG
 KA
 MI
 AA
 AA
 FU
 YQ

#include <bits/stdc++.h>
using namespace std;
int inc[26];
int decr[26];
int equl[26];
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  memset(equl, 0, sizeof equl);
  memset(inc, 0, sizeof inc);
  memset(decr, 0, sizeof decr);
  for (int i = 0; i < n - 1; i++) {
    if (s[i] == s[i + 1] - 1) {
      inc[s[i] - 'A']++;
    } else if (s[i] == s[i + 1] + 1) {
      decr[s[i] - 'A']++;
    } else if (s[i] == s[i + 1]) {
      equl[s[i] - 'A']++;
    }
  }
  int maxer = 0;
  char sb;
  int incflag = 0;
  for (int i = 0; i < 26; i++) {
    if (inc[i] >= maxer) {
      maxer = inc[i];
      sb = 'A' + i;
    }
  }
  for (int i = 0; i < 26; i++) {
    if (decr[i] >= maxer) {
      maxer = decr[i];
      sb = 'A' + i;
      incflag = 1;
    }
  }
  for (int i = 0; i < 26; i++) {
    if (equl[i] >= maxer) {
      maxer = equl[i];
      sb = 'A' + i;
      incflag = 2;
    }
  }
  if (incflag == 0) {
    string ans;
    ans += sb;
    ans += (sb + 1);
    cout << ans << endl;
  } else if (incflag == 1) {
    string ans;
    ans += sb;
    ans += (sb - 1);
    cout << ans << endl;
  } else {
    string ans;
    ans += sb;
    ans += sb;
    cout << ans << endl;
  }
  return 0;
}
