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;
const int inf = 0x3f3f3f3f;
const long long mod = 2147493647;
const int maxn = 1000 + 10;
int main() {
  int n;
  char s[1000 + 10];
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%c", &s[i]);
  }
  s[n] = '\0';
  char str[3];
  int maxx = 0;
  for (int i = 0; i < n - 1; i++) {
    int cnt = 0;
    char s1[3];
    s1[0] = s[i];
    s1[1] = s[i + 1];
    s1[2] = '\0';
    for (int j = 0; j < n - 1; j++) {
      if (s1[0] == s[j] && s1[1] == s[j + 1]) cnt++;
    }
    if (cnt >= maxx) {
      str[0] = s1[0];
      str[1] = s1[1];
      str[2] = s1[2];
      maxx = cnt;
    }
  }
  printf("%s\n", str);
  return 0;
}
