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

string_len = int(input())

string = input()

string_thresh = 0

capital_dict = []
capital_count = []


def add_capital(letter, capital_dict, capital_count):
    capital_dict.append(letter)
    capital_count.append(1)


def check_capital(letter_a, letter_b, capital_dict, capital_count):
    letter = letter_a + letter_b
    try:
        letter_idx = capital_dict.index(letter)
        capital_count[letter_idx] += 1
    except ValueError:
        add_capital(letter, capital_dict, capital_count)


while string_thresh < (string_len - 1):
    check_capital(string[string_thresh], string[string_thresh + 1], capital_dict, capital_count)
    string_thresh += 1

max_value_idx = capital_count.index(max(capital_count))
print(capital_dict[max_value_idx])

	    	 	 	  		   	    				  	 	