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

matrix = [[0 for j in range(26)] for i in range(26)]
n = int(input())
s = input()
max_i, max_j, max_v = 0, 0, 0
for i in range(1, n):
    x, y = s[i - 1], s[i]
    i_alph = ord(x) - ord('A')
    j_alph = ord(y) - ord('A')
    matrix[i_alph][j_alph] += 1
    if max_v < matrix[i_alph][j_alph]:
        max_v, max_i, max_j = matrix[i_alph][j_alph], i_alph, j_alph
first = chr(ord('A') + max_i)
second = chr(ord('A') + max_j)
print(first + second)
