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

# -*- coding: utf-8 -*-
"""
Created on Wed Nov 11 22:52:27 2020

@author: moham
"""

import sys
input = sys.stdin.readline

def inp():
    return(int(input()))
    
size = inp()
input_string = input()
frequencies = {}
for i in range(len(input_string)-1):

    couple=input_string[i]+input_string[i+1]
    if couple in frequencies: 
        frequencies[couple] += 1
    else: 
        frequencies[couple] = 1    
    
    
    
'''
for (op, code) in zip(input_string[0::1], input_string[1::2]):
    couple = op+code
    if couple in frequencies: 
        frequencies[couple] += 1
    else: 
        frequencies[couple] = 1
'''
#print(max(list(frequencies.keys())))
#print(max(list(frequencies.values())))

print(list(frequencies.keys())[list(frequencies.values()).index(max(list(frequencies.values())))]) 