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 N;
char s[10005];
int cnt;
char mch[100005];
int ans;
char ss[1005];
int main() {
  int i, j, k;
  cin >> N;
  for (i = 1; i <= N; i++) {
    cin >> s[i];
  }
  for (i = 1; i <= N - 1; i++) {
    mch[++cnt] = s[i];
    mch[++cnt] = s[i + 1];
  }
  for (i = 1; i <= cnt; i += 2) {
    char ft = mch[i];
    char lt = mch[i + 1];
    int ret = 0;
    for (j = 1; j < N; j++) {
      if (s[j] == ft && s[j + 1] == lt) ret++;
    }
    if (ret > ans) {
      ans = ret;
      ss[0] = ft;
      ss[1] = lt;
    }
  }
  cout << ss[0] << ss[1] << endl;
}
