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;
set<char> s1;
set<char>::iterator it1, it2;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  int a, b, i, j, k, n, m, p, q, x, y, ct1, ct2, t, w, sum;
  string str, str1, str2;
  char ch1, ch2;
  while (cin >> n) {
    s1.clear();
    cin >> str;
    char ans[2];
    for (i = 0; str[i]; i++) {
      s1.insert(str[i]);
    }
    int len = str.length();
    int mx = 0;
    for (it1 = s1.begin(); it1 != s1.end(); it1++) {
      ch1 = *it1;
      for (it2 = s1.begin(); it2 != s1.end(); it2++) {
        ch2 = *it2;
        ct1 = 0, ct2 = 0;
        for (i = 1; i < len; i++) {
          if (str[i - 1] == ch1 && str[i] == ch2)
            ++ct1;
          else if (str[i - 1] == ch2 && str[i] == ch1)
            ++ct2;
        }
        if (mx < ct1) {
          ans[0] = ch1, ans[1] = ch2;
          mx = ct1;
        } else if (mx < ct2) {
          ans[0] = ch2, ans[1] = ch1;
          mx = ct2;
        }
      }
    }
    ans[2] = '\0';
    cout << ans << endl;
  }
}
