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 main() {
  int n;
  cin >> n;
  string s;
  vector<vector<int> > fre(26, vector<int>(26, 0));
  cin >> s;
  for (int i = 0; i < s.length() - 1; ++i) {
    fre[(int)(s[i] - 'A')][(int)(s[i + 1] - 'A')]++;
  }
  int max_i = 0, max_j = 0;
  for (int i = 0; i < 26; ++i) {
    for (int j = 0; j < 26; ++j) {
      if (fre[i][j] > fre[max_i][max_j]) {
        max_i = i;
        max_j = j;
      }
    }
  }
  char ch1 = 'A' + max_i;
  char ch2 = 'A' + max_j;
  cout << ch1 << ch2;
  return 0;
}
