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

lch = input()
ch=""
while len(ch)!=int(lch):
  ch=input()
z=0
a=""
liste = []
for i in range(len(ch)):
  if(i!=len(ch)):
    a=ch[z:i+1]
    liste.append(a)
    z=i
#print(liste)
del liste[0]
#print(liste)
listeocc=[]
for i in range(len(liste)):
  val=liste[i]
  occ=0
  for j in range(len(liste)): 
    if(val==liste[j]):
      occ=occ+1
  listeocc.append(occ)
#print(listeocc)
maxocc=int(listeocc[0])
savepos=0
for i in range(len(listeocc)): 
  if(int(listeocc[i])>int(maxocc)):
    maxocc=listeocc[i]
    savepos=i
print(liste[savepos])