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

"""Problem B - Two-gram.

http://codeforces.com/contest/977/problem/B

Two-gram is an ordered pair (i.e. string of length two) of capital Latin
letters. For example, "AZ", "AA", "ZA" — three distinct two-grams.

You are given a string $$$s$$$ consisting of $$$n$$$ capital Latin letters.
Your task is to find any two-gram contained in the given string as a substring
(i.e. two consecutive characters of the string) maximal number of times. For
example, for string $$$s$$$ = "BBAABBBA" the answer is two-gram "BB", which
contained in $$$s$$$ three times. In other words, find any most frequent
two-gram.

Note that occurrences of the two-gram can overlap with each other.

Input:

The first line of the input contains integer number $$$n$$$ ($$$2 \le n \le
100$$$) — the length of string $$$s$$$. The second line of the input contains
the string $$$s$$$ consisting of $$$n$$$ capital Latin letters.

Output:

Print the only line containing exactly two capital Latin letters — any
two-gram contained in the given string $$$s$$$ as a substring (i.e. two
consecutive characters of the string) maximal number of times.

"""
import logging
from collections import defaultdict


ch = logging.StreamHandler()
ch.setLevel(logging.DEBUG)

logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
logger.addHandler(ch)


def solve(s):
    m = defaultdict(int)
    for i in range(len(s) - 1):
        m[s[i:i+2]] += 1
    return next(k for k, v in m.items() if v == max(m.values()))


def main():
    _ = input()
    s = input().strip()
    result = solve(s)
    print(result)


if __name__ == '__main__':
    main()
