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.


-----Examples-----
Input
7
ABACABA

Output
AB

Input
5
ZZZAA

Output
ZZ



-----Note-----

In the first example "BA" is also valid answer.

In the second example the only two-gram "ZZ" can be printed because it contained in the string "ZZZAA" two times.

Source: codeforces | Difficulty: EASY
Tags: String algorithms

Implementation


Solutions:
n = int(input())
s = input()
b = []
d = []
c = 0
m = -10
x = 0
for i in range(0, n - 1):
	b.append(s[i] + s[i + 1])
for j in range(0, len(b)):
	c = 0
	for k in range(j + 1, len(b)):
		if b[j] == b[k]:
			c += 1
	d.append(c)
for p in range(0, len(d)):
	if d[p] > m:
		m = d[p]
		x = p
print(b[x])


n = int(input())
s = input()
dct = {}
for i in range(len(s) - 1):
	current = s[i] + s[i + 1]
	if current in dct.keys():
		dct[current] += 1
	else:
		dct[current] = 1
max = 0
ans = 'sharad'
for i in dct:
	if dct[i] > max:
		max = dct[i]
		ans = i
print(ans)


n = int(input())
a = input()
c = b = [*zip(a, a[1:])]
print(''.join(max(b, key=b.count)))


n = int(input())
s = input()
a = [s[i:i + 2] for i in range(len(s))]
print(max(a, key=a.count))


import collections
n = int(input())
s = input()
d = collections.defaultdict(int)
for i in range(n - 1):
	d[s[i:i + 2]] += 1
d = list(d.items())
d.sort(key=lambda x: x[1])
print(d[-1][0])


from collections import Counter
kiek = input()
seka = input()
masyvas = []
for i in range(0, int(kiek) - 1):
	masyvas.append(seka[i:i + 2])
print(max(masyvas, key=masyvas.count))


n = int(input())
s = input()
two_grams = []
for i in range(len(s) - 1):
	found = False
	curr = s[i] + s[i + 1]
	for two_gram in two_grams:
		if two_gram[0] == curr:
			two_gram[1] += two_gram[1]
			found = True
	if not found:
		two_grams.append([curr, 1])
max_ocur = 0
ans = 'oi'
for two_gram in two_grams:
	if two_gram[1] > max_ocur:
		max_ocur = two_gram[1]
		ans = two_gram[0]
print(ans)


import sys

def solve(n: int, s: str):
	A = [[0 for j in range(26)] for i in range(26)]
	for i in range(n - 1):
		A[ord(s[i]) - ord('A')][ord(s[i + 1]) - ord('A')] += 1
	M = 0
	for i in range(26):
		for j in range(26):
			M = max(M, A[i][j])
	for i in range(26):
		for j in range(26):
			if M == A[i][j]:
				print(chr(i + ord('A')) + chr(j + ord('A')))
				return
(n, s) = (int(input()), input())
solve(n, s)


n = int(input())
s = input()
m = dict()
for i in range(n - 1):
	two_gram = s[i:i + 2]
	m[two_gram] = m.get(two_gram, 0) + 1
two_gram = ''
max_number_of_two_grams = 0
for (k, v) in m.items():
	if v > max_number_of_two_grams:
		max_number_of_two_grams = v
		two_gram = k
print(two_gram)


total = int(input())
string = input()
dicio = {}
identificar = []
for i in range(total - 1):
	par = ''
	par += string[i]
	par += string[i + 1]
	if par not in dicio:
		dicio[par] = 1
		identificar.append(par)
	else:
		dicio[par] += 1
valores = list(dicio.values())
print(identificar[valores.index(max(valores))])


l = int(input())
s = input()
d = {}
for i in range(l - 1):
	if s[i:i + 2] not in d:
		d[s[i] + s[i + 1]] = 1
	else:
		d[s[i] + s[i + 1]] += 1
a = dict(sorted(d.items(), reverse=True, key=lambda x: x[1]))
print(next(iter(a.keys())))


from collections import Counter
n = int(input())
s = input()
s1 = s[0:n - 1]
s2 = s[1:n]
s = [m + str(n) for (m, n) in zip(s1, s2)]
s = Counter(s).most_common(1)
print(s[0][0])


n = int(input())
s = input()
a = [[0] * 26 for _ in range(26)]
for i in range(n - 1):
	a[ord(s[i]) - ord('A')][ord(s[i + 1]) - ord('A')] += 1
mx = -1
for i in range(26):
	for j in range(26):
		if a[i][j] > mx:
			mx = a[i][j]
			ans = chr(i + ord('A')) + chr(j + ord('A'))
print(ans)


n = int(input())
s = input().strip()
(d, l) = ({}, [])
for i in range(len(s) - 1):
	temp = s[i] + s[i + 1]
	if temp not in l:
		l.append(temp)
	try:
		d[temp] += 1
	except:
		d.update({temp: 0})
		d[temp] += 1
(m, f) = (0, l[0])
for i in l:
	if d[i] > m:
		(m, f) = (d[i], i)
print(f)


import sys
from collections import Counter
next(sys.stdin)
s = next(sys.stdin).rstrip()

def bigrams(s):
	for i in range(len(s) - 1):
		yield s[i:i + 2]
bigram_counter = Counter(bigrams(s))
print(bigram_counter.most_common(1)[0][0])


from itertools import combinations
from collections import Counter
n = int(input())
s = input()
res = [s[x:y] for (x, y) in combinations(range(len(s) + 1), r=2) if len(s[x:y]) == 2]
a = Counter(res)
print(a.most_common(1)[0][0])


n = int(input())
s = input()[:n]
l = len(s)
i = 0
cnt = 0
gram = ''

def occurrences(string, sub):
	count = start = 0
	while True:
		start = string.find(sub, start) + 1
		if start > 0:
			count += 1
		else:
			return count
while True:
	if i == l - 1:
		break
	gram = s[i] + s[i + 1]
	c = occurrences(s, gram)
	if c > cnt:
		cnt = c
		new_gram = gram
	i = i + 1
print(new_gram)


n = int(input())
s = input()
S = []
for i in range(n - 1):
	a = s[i] + s[i + 1]
	S.append(a)
print(max(set(S), key=S.count))


n = int(input())
s = input()
dic = {}
for i in range(len(s)):
	search = s[i:i + 2]
	if len(search) == 2:
		if search not in dic:
			dic[search] = 1
		else:
			dic[search] += 1
maxm = max(dic.values())
lst = []
for (k, v) in dic.items():
	if v == maxm:
		lst.append(k)
print(sorted(lst)[0])


import sys
n = int(input())
s = input()
ans = '@@'
res = 0
for i in range(n - 1):
	r = s[i] + s[i + 1]
	cnt = 1
	for j in range(i + 1, n - 1):
		if s[j] + s[j + 1] == r:
			cnt += 1
	if cnt > res:
		res = cnt
		ans = r
print(ans)


n = int(input())
s = input()
ans = {}
for i in range(1, n):
	if s[i - 1] + s[i] not in ans:
		ans[s[i - 1] + s[i]] = 1
	else:
		ans[s[i - 1] + s[i]] += 1
gg = list(ans.keys())[0]
for i in ans:
	if ans[i] > ans[gg]:
		gg = i
print(gg)


n = int(input())
s = input()
k = len(s)
jk = dict()
bb = ''
b = 0
for l in range(k - 1):
	hk = s[l] + s[l + 1]
	if jk.get(hk):
		jk[hk] += 1
	else:
		jk[hk] = 1
	if jk[hk] > b:
		b = jk[hk]
		bb = hk
print(bb)


n = int(input())
str = input()
k = {}
for i in range(0, n - 1):
	if str[i:i + 2] in k:
		k[str[i:i + 2]] += +1
	else:
		k[str[i:i + 2]] = 1
maxi = -1
for i in k:
	maxi = max(k[i], maxi)
for i in k:
	if k[i] == maxi:
		print(i)
		break


n = int(input())
line = str(input())
massif = []
maxcounter = 0
answer = ''
for a in range(1, n):
	massif.append(line[a - 1] + line[a])
for a in massif:
	x = massif.count(a)
	if x > maxcounter:
		maxcounter = x
		answer = a
print(answer)


n = int(input())
line = input()
doublegrams = {}
for i in range(n - 1):
	if line[i:i + 2] not in doublegrams.keys():
		doublegrams.update({line[i:i + 2]: 1})
	else:
		doublegrams[line[i:i + 2]] += 1
max_n = 0
max_key = ''
for key in doublegrams.keys():
	if doublegrams[key] > max_n:
		max_n = doublegrams[key]
		max_key = key
print(max_key)


garbage = int(input())
z = input()
max_g = ''
mac = 0
for i in range(len(z) - 1):
	gram = z[i:i + 2]
	count = 0
	for j in range(len(z) - 1):
		if z[j:j + 2] == gram:
			count = count + 1
	if count > mac:
		mac = count
		max_g = gram
print(max_g)


import re
n = int(input())
s = input()
ans = ''
m = 0
for i in range(1, n):
	p = s[int(i - 1):int(i + 1)]
	c = 0
	for j in range(1, n):
		if s[j - 1:j + 1] == p:
			c += 1
	if c > m:
		ans = p
		m = c
print(ans)


n = int(input())
s = input()
d = {}
for i in range(0, n - 1):
	new = s[i:i + 2]
	if new in d:
		d[new] += 1
	else:
		d[new] = 1
d = sorted(d.items(), key=lambda x: x[1], reverse=True)
print(next(iter(d[0])))


def funct(a, b):
	n = len(a)
	e = 0
	for i in range(n - 1):
		if b == a[i:i + 2]:
			e += 1
	return e
n = int(input())
s = input()
e = funct(s, s[:2])
a = s[:2]
for i in range(n - 1):
	if funct(s, s[i:i + 2]) > e:
		e = funct(s, s[i:i + 2])
		a = s[i:i + 2]
print(a)


n = int(input())
l = str(input())
y = []
for i in range(n - 1):
	y.append(l[i:i + 2])
z = list(set(y))
z1 = []
for i in range(len(z)):
	z1.append(y.count(z[i]))
for i in range(len(y)):
	if y.count(y[i]) == max(z1):
		print(y[i])
		break


from collections import Counter
n = int(input())
s = input()
arr = []
for i in range(n - 1):
	s1 = s[i] + s[i + 1]
	arr.append(s1)
c = Counter(arr)
m = 0
for (key, value) in c.items():
	if value > m:
		m = value
		answer = key
print(answer)


n = int(input())
s = input()
s1 = s[0:2]
max = 1
ans = s1
for i in range(0, n - 1):
	s1 = s[i:i + 2]
	cnt = 0
	for j in range(i, n - 1):
		if s[j:j + 2] == s1:
			cnt = cnt + 1
	if max < cnt:
		ans = s1
		max = cnt
print(ans)


n = int(input())
s = input()
d = {}
for i in range(n - 1):
	k = s[i:i + 2]
	d[k] = d.get(k, 0) + 1
print(max(d, key=lambda k: d[k]))


from itertools import combinations
input()
word = input()
res = 0
wres = ''
for i in set(combinations(word, 2)):
	w = ''.join(i)
	count = sum([1 for i in range(len(word) - 1) if w == word[i:i + 2]])
	if count > res:
		res = count
		wres = w
print(wres)


n = int(input())
s = input()
ans = ''
mx = 0
n = len(s)
for i in range(0, 26):
	for j in range(0, 26):
		t = chr(i + ord('A'))
		q = chr(j + ord('A'))
		res = t + q
		cnt = 0
		for k in range(n - 1):
			if s[k] == t and s[k + 1] == q:
				cnt += 1
		if cnt > mx:
			mx = cnt
			ans = res
print(ans)


n = int(input())
a = input()
(l, k) = ([], [])
for x in range(n - 1):
	l.append(a[x] + a[x + 1])
m = list(set(l))
for x in range(len(m)):
	k.append(l.count(m[x]))
print(m[k.index(max(k))])


input()
a = input()
b = {}
for i in range(len(a) - 1):
	j = i + 1
	if a[i] + a[j] in b.keys():
		b[a[i] + a[j]] += 1
	else:
		b[a[i] + a[j]] = 1
xmax = max(b.values())
for i in b.keys():
	if b[i] == xmax:
		print(i)
		break


def two_gram(size, string):
	records = {}
	for i in range(size - 1):
		gram = string[i] + string[i + 1]
		if gram in records:
			records[gram] += 1
		else:
			records[gram] = 1
	maximum = 0
	for key in records:
		if records[key] > maximum:
			maximum = records[key]
			answ = key
	print(answ)
size = int(input())
string = input()
two_gram(size, string)


n = int(input())
s = input()
from collections import Counter
res = Counter((s[idx:idx + 2] for idx in range(len(s) - 1)))
dict1 = dict(res)
print(list(dict1.keys())[list(dict1.values()).index(max(dict1.values()))])


import sys
import math
n = int(input())
stra = str(input())
lista = []
value = []
if n == 2:
	print(stra)
else:
	for i in range(n - 1):
		if lista.count(stra[i:i + 2]) == 0:
			lista.append(stra[i:i + 2])
			value.append(1)
		else:
			value[lista.index(stra[i:i + 2])] += 1
	print(lista[value.index(max(value))])


n = int(input())
s = input()
dick = {}
for i in range(n - 1):
	res = s[i] + s[i + 1]
	if dick.get(res) == None:
		dick[res] = 1
	else:
		dick[res] += 1
ans = 0
string = ''
for (key, value) in dick.items():
	if ans < value:
		ans = value
		string = key
print(string)


n = int(input())
s = input()
hash = dict()
for i in range(len(s) - 1):
	if s[i:i + 2] not in hash:
		hash[s[i:i + 2]] = 0
	else:
		hash[s[i] + s[i + 1]] += 1
print(max(hash, key=hash.get))


n = int(input())
s = input()
array = []
for i in range(1, len(s)):
	array.append(s[i - 1:i + 1])
print(max(array, key=array.count))


n = int(input())
s = input()
d = {}
l = ''
i = 0
while i < n:
	if len(l) < 2:
		l += s[i]
		i += 1
	else:
		if l in d:
			d[l] += 1
		else:
			d[l] = 1
		l = l[1]
if len(l) == 2:
	if l in d:
		d[l] += 1
	else:
		d[l] = 1
	l = l[1]
ma = 0
k = 0
for (key, value) in d.items():
	if ma < value:
		ma = value
		k = key
print(k)


n = int(input())
s = input()
d = {}
for i in range(len(s) - 1):
	s1 = s[i:i + 2]
	if s1 not in d:
		d[s1] = 1
	else:
		d[s1] += 1
print(max(d, key=d.get))


x = int(input())
s = input()
a = []
max = 0
for i in range(x - 1):
	a.append(s[i] + s[i + 1])
for i in range(x - 2):
	if a.count(a[i]) > max:
		max = a.count(a[i])
		s = a[i]
print(s)


from collections import Counter
n = int(input())
string = input()
cnt = Counter([string[i:i + 2] for i in range(n - 1)]).most_common(1)[0][0]
print(cnt)


x = int(input())
y = input()
w = []
most = 0
word = ''
for i in range(x - 1):
	w.append(y[i:i + 2])
for i in set(w):
	num = w.count(i)
	if most < num:
		word = i
		most = num
print(word)


n = int(input())
s = input()
max_cnt = 0
max_string = ''
for i in range(n - 1):
	a = s[i] + s[i + 1]
	cnt = 0
	for j in range(n - 1):
		b = s[j] + s[j + 1]
		if a == b:
			cnt += 1
	if cnt >= max_cnt:
		max_cnt = cnt
		max_string = a
print(max_string)


n = int(input())
s = input()
l = []
t = 1
g = []
for i in range(1, n + 1):
	l.append(s[i - 1:i + 1])
for j in range(len(l)):
	for k in range(j + 1, len(l)):
		if l[j] == l[k]:
			t += 1
	g.append(t)
	t = 1
for r in range(len(g)):
	if g[r] == max(g):
		print(l[r])
		break


n = int(input())
l = []
count = []
for i in range(100):
	count.append(0)
s = input()
for i in range(n - 1):
	if s[i:i + 2] not in l:
		l.append(s[i:i + 2])
		count[len(l) - 1] = 1
	else:
		count[l.index(s[i:i + 2])] += 1
maxx = 0
maxindex = -1
for i in range(100):
	if count[i] > maxx:
		maxx = count[i]
		maxindex = i
print(l[maxindex])


a = int(input())
b = input()
c = list(set([i for i in b]))
li = []
max = 0
cc = len(c)
for i in range(cc):
	for j in range(cc):
		d = b.count(str(str(c[i]) + str(c[j])))
		if d > max:
			li.append([str(c[i]) + str(c[j]), d])
			max = d
print(li[-1][0])


import os
import sys
debug = True
if debug and os.path.exists('input.in'):
	input = open('input.in', 'r').readline
else:
	debug = False
	input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return s[:len(s) - 1]

def invr():
	return map(int, input().split())
test_count = 1
if debug:
	test_count = inp()
for t in range(test_count):
	if debug:
		print('Test Case #', t + 1)
	n = inp()
	a = insr()
	ans = 0
	ans_g = ''
	freq = {}
	for i in range(n - 1):
		g = a[i:i + 2]
		if g not in freq:
			freq[g] = 1
		else:
			freq[g] = freq[g] + 1
		if freq[g] > ans:
			ans = freq[g]
			ans_g = g
	print(ans_g)


n = int(input())
s = input()
d = {}
for i in range(n - 1):
	x = s[i:i + 2]
	d[x] = d.get(x, 0) + 1
print(sorted(zip(d.values(), d.keys()))[-1][1])


from collections import *
from math import *
import sys
input = sys.stdin.readline
n = int(input())
a = input()
f = dict()
for i in range(n - 1):
	z = a[i] + a[i + 1]
	if z in f:
		f[z] += 1
	else:
		f[z] = 1
f1 = max(f.values())
for i in f.keys():
	if f1 == f[i]:
		print(i)
		break


n = int(input())
s = input()
d = {}
for i in range(n - 1):
	if not s[i] + s[i + 1] in d:
		d[s[i] + s[i + 1]] = 1
	else:
		d[s[i] + s[i + 1]] += 1
maxi = list(d.keys())[0]
for i in d:
	if d[i] > d[maxi]:
		maxi = i
print(maxi)


n = int(input())
s = input()
p = {}
for i in range(len(s) - 1):
	now = s[i:i + 2]
	if now in p.keys():
		p[now] += 1
	else:
		p[now] = 1
mx = 0
good = ''
for i in p.keys():
	if p[i] > mx:
		good = i
		mx = p[i]
print(good)


n = int(input())
s = input()
max = 0
a = ''
for i in range(n - 1):
	s1 = s[i] + s[i + 1]
	b = 0
	for j in range(i, n - 1):
		if s[j] + s[j + 1] == s1:
			b += 1
	if b > max:
		max = b
		a = s1
print(a)


n = int(input())
s = input()
mx = 0
ans = ''
for i in range(n - 1):
	dbg = s[i:i + 2]
	count = 1
	for j in range(i + 1, n - 1):
		if dbg == s[j:j + 2]:
			count += 1
	if count > mx:
		mx = count
		ans = dbg
print(ans)


from sys import stdin, stdout

def mode_two_gram(n: int, latin: str) -> str:
	histogram = {}
	for i in range(n - 1):
		two_gram = latin[i] + latin[i + 1]
		if not two_gram in histogram:
			histogram[two_gram] = 1
		else:
			histogram[two_gram] += 1
	return max(histogram, key=lambda k: histogram[k])
n = int(stdin.readline().rstrip())
latin = stdin.readline().rstrip()
stdout.write(mode_two_gram(n, latin) + '\n')


n = int(input())
s = str(input())
m = [[], []]
ma = 0
for i in range(n - 1):
	if s[i:i + 2] in m[0]:
		x = m[0].index(s[i:i + 2])
		m[1][x] += 1
		if m[1][x] > m[1][ma]:
			ma = x
	else:
		m[0].append(s[i:i + 2])
		m[1].append(1)
print(m[0][ma])


n = int(input())
s = input()
x = dict()
for i in range(n - 1):
	string = s[i] + s[i + 1]
	if string in x:
		x[string] += 1
	else:
		x[string] = 1
res = s[0] + s[1]
for i in x:
	if x[i] > x[res]:
		res = i
print(res)


from collections import Counter
n = int(input())
s = input()
c = Counter()
for i in range(n - 1):
	c[s[i:i + 2]] += 1
print(c.most_common(1)[0][0])


ll = input()
st = input()
ltg = []
lw = []
for i in range(int(ll) - 1):
	cs = st[i] + st[i + 1]
	if not cs in ltg:
		ltg.append(cs)
		lw.append(0)
	else:
		lw[ltg.index(cs)] += 1
print(ltg[lw.index(max(lw))])


n = int(input())
s = input()
tg = dict()
for i in range(n - 1):
	tg[s[i:i + 2]] = tg.get(s[i:i + 2], 0) + 1
print(max(tg, key=tg.get))


n = int(input())
s = input()
ok = [s[i - 1:i + 1] for i in range(1, n)]
mp = {}
for strings in ok:
	if mp.get(strings) == None:
		mp[strings] = 1
	else:
		mp[strings] += 1
max_freq_string = max(mp, key=lambda key__: mp[key__])
print(max_freq_string)


n = int(input())
s = input()
a = []
b = []
i = 0
while i < n - 1:
	s1 = s[i] + s[i + 1]
	if s1 not in b:
		a.append([s1, 0])
		b.append(s1)
	else:
		ind = b.index(s1)
		c = a[ind][1]
		a[ind][1] += 1
	i += 1
a.sort(key=lambda x: x[1])
l = len(a)
print(a[l - 1][0])


n = int(input())
string = input()
vals = {}
for i in range(n - 1):
	if string[i:i + 2] not in vals:
		vals[string[i:i + 2]] = 0
	vals[string[i:i + 2]] += 1
(maks, best) = (0, None)
for key in vals:
	if vals[key] > maks:
		(maks, best) = (vals[key], key)
print(best)


n = int(input())
s = input()
d = {}
for i in range(n - 1):
	if s[i:i + 2] in d:
		d[s[i:i + 2]] += 1
	else:
		d[s[i:i + 2]] = 1
d = sorted(d, key=d.get, reverse=True)
print(d[0])


n = int(input())
s = input()
maxi = 0
x = 0
s1 = ''
for i in range(n - 1):
	for j in range(n - 1):
		if s[i] + s[i + 1] == s[j] + s[j + 1]:
			x += 1
	if x > maxi:
		maxi = x
		s1 = s[i] + s[i + 1]
	x = 0
print(s1)


n = int(input())
s = input()
twograms = {}
for i in range(n - 1):
	twogram = s[i] + s[i + 1]
	if twograms.setdefault(twogram, 0) > 0:
		twograms[twogram] += 1
	else:
		twograms[twogram] = 1
max = 0
for x in twograms.keys():
	if twograms[x] > max:
		max = twograms[x]
		key = x
print(key)


from statistics import mode
n = int(input())
a = input()
b = []
i = len(a)
j = 0
while j < i:
	if j <= i - 2:
		b.append(str(a[j]) + str(a[j + 1]))
	j += 1
s = mode(b)
print(s)


def go():
	n = int(input())
	s = input()
	keep = {}
	i = 1
	my_max = 1
	val_max = s[0:2]
	while i < n:
		key = s[i - 1] + s[i]
		keep.setdefault(s[i - 1] + s[i], 0)
		keep[key] += 1
		if keep[key] > my_max:
			my_max = keep[key]
			val_max = key
		i += 1
	return val_max
print(go())


n = int(input())
a = []
s = input()
for i in range(1000):
	a.append(0)
for i in range(len(s) - 1):
	num = (ord(s[i]) - ord('A')) * 26 + (ord(s[i + 1]) - ord('A'))
	a[num] = a[num] + 1
maxx = 0
for i in range(1000):
	maxx = max(maxx, a[i])
for i in range(1000):
	if maxx == a[i]:
		num1 = i % 26
		num2 = i / 26
		ans = chr(int(num2) + ord('A')) + chr(int(num1) + ord('A'))
print(ans)


n = int(input())
d = {}
l = list(input())
for t in range(1, n):
	x = (l[t - 1], l[t])
	if x not in d:
		d[x] = 1
	else:
		d[x] += 1
mx = 0
ans = tuple()
for t in d:
	if d[t] > mx:
		mx = d[t]
		ans = t
print(*ans, sep='')


from itertools import product
size = int(input())
word = input()
ch = ''.join(set(word))
possible = list(product(ch, repeat=2))
pairs = [word[i:i + 2] for i in range(size)]
max_repeated = max([(pairs.count(''.join(i)), ''.join(i)) for i in possible])
print(max_repeated[1])


def main():
	num = int(input())
	sequence = input()
	grams_dict = dict()
	s = 0
	f = 1
	while s < num - 1:
		aux = sequence[s:f + 1]
		if aux in grams_dict:
			grams_dict[aux] += 1
		else:
			grams_dict[aux] = 1
		s += 1
		f += 1
	max = 0
	gram = ''
	for (key, value) in grams_dict.items():
		if value > max:
			max = value
			gram = key
	print(gram)
	return
main()


(g, x, p) = (int(input()), input(), [])
for i in range(g - 1):
	p.append(x[i:i + 2])
print(max(p, key=p.count))


n = int(input())
anss = 0
ch = input()
for i in range(n - 1):
	com = 0
	for j in range(n - 1):
		if ch[i] == ch[j] and ch[i + 1] == ch[j + 1]:
			com += 1
	if com > anss:
		ans = ch[i] + ch[i + 1]
		anss = com
print(ans)


tam = int(input())
(pala, ans) = (input(), '')
di = {}
for j in range(tam - 1):
	try:
		di[pala[j] + pala[j + 1]] += 1
	except:
		di[pala[j] + pala[j + 1]] = 1
maxi = 0
for i in di:
	if di[i] > maxi:
		maxi = di[i]
		ans = i
print(ans)


n = int(input())
s = input()
ans = ''
pre = 0
for i in range(n - 1):
	x = s[i] + s[i + 1]
	count = 0
	for j in range(n - 1):
		y = s[j] + s[j + 1]
		if x == y:
			count += 1
	if count > pre:
		pre = count
		ans = x
print(ans)


n = int(input().strip())
s = input().strip()
mapped = dict()
for i in range(n - 1):
	if s[i] + s[i + 1] not in mapped:
		mapped[s[i] + s[i + 1]] = 1
	else:
		mapped[s[i] + s[i + 1]] += 1
max_ = 0
res = ''
for k in mapped:
	if max_ < mapped[k]:
		max_ = mapped[k]
		res = k
print(res)


n = int(input())
stroke = input()
strokes = []
count = {}

def count_of_str(stroke_per):
	count = 0
	for i in range(len(stroke) - 1):
		if stroke[i] + stroke[i + 1] == stroke_per:
			count += 1
	return count
for i in range(len(stroke) - 1):
	strokes.append(stroke[i] + stroke[i + 1])
for j in strokes:
	count[count_of_str(j)] = j
print(count[max(count.keys())])


def twoGrams(s):
	t = []
	max_m = 0
	result = ''
	for i in range(len(s) - 1):
		t.append(s[i] + s[i + 1])
	r = list(set(t))
	for i in r:
		if t.count(i) > max_m:
			max_m = t.count(i)
			result = i
	return result
n = int(input())
s = input()
print(twoGrams(s))


s = int(input())
ss = input()
i = []
for J in range(1, s):
	i.append(ss[J - 1] + ss[J])
print(max(set(i), key=i.count))


input()
X = input()
Most = str()
MostN = 0
for i in range(0, X.__len__() - 1):
	N = 0
	for j in range(X.__len__() - 1):
		if X[j] == X[i] and X[j + 1] == X[i + 1]:
			N += 1
	if N > MostN:
		Most = X[i] + X[i + 1]
		MostN = N
print(Most)


n = int(input())
s = input()
gram2 = [s[i:i + 2] for i in range(len(s) - 1)]
print(max(gram2, key=gram2.count))


input()
s = input().strip()
anagrams = {}
for i in range(1, len(s)):
	anagrams[s[i - 1:i + 1]] = anagrams.get(s[i - 1:i + 1], 0) + 1
max_pair = ('', 0)
for val in anagrams.items():
	if val[1] > max_pair[1]:
		max_pair = val
print(max_pair[0])


def number(a, k):
	c = 0
	for i in a:
		if i == k:
			c += 1
	return c
input()
s = input()
a = []
for i in range(len(s) - 1):
	a.append(s[i:i + 2])
c = list(set(a))
m = 0
d = ''
for i in c:
	if number(a, i) > m:
		m = number(a, i)
		d = i
print(d)


n = int(input())
s = input()
s = list(s)
new = dict()
for i in range(n - 1):
	new.setdefault(''.join(s[0]) + ''.join(s[1]), 0)
	new[''.join(s[0]) + ''.join(s[1])] += 1
	s.pop(0)
new_s = sorted(new.items(), key=lambda kv: kv[1])
l = len(new_s)
print(new_s[l - 1][0])


n = int(input())
a = input()
b = []
c = []
for i in range(n - 1):
	q = a[i:i + 2]
	if q in b:
		m = b.index(q)
		c[m] = c[m] + 1
	else:
		b.append(q)
		m = b.index(q)
		c.append(1)
y = c.index(max(c))
print(b[y])


n = int(input())
s = input()
dic = {}
for i in range(n - 1):
	sub = s[i:i + 2]
	if sub in dic:
		dic[sub] += 1
	else:
		dic[sub] = 1
ans = ''
max_value = 0
for key in dic.keys():
	if dic[key] > max_value:
		ans = key
		max_value = dic[key]
print(ans)


n = int(input())
letters = list(input())
dic = {}
for r in range(0, len(letters) - 1):
	semistr = letters[r] + letters[r + 1]
	if semistr not in dic:
		dic[semistr] = 1
	else:
		dic[semistr] += 1
lst = list(dic.items())
lst.sort(key=lambda x: x[1])
print(lst[-1][0])


n = int(input())
s = input()
count = {}
maxc = 1
maxg = s[0:2]
for i in range(len(s) - 1):
	gram = s[i:i + 2]
	count[gram] = count.get(gram, 0) + 1
	if count[gram] > maxc:
		maxc = count[gram]
		maxg = gram
print(maxg)


n = int(input())
s = input()
a = []
res = ''
for i in range(len(s) - 1):
	res += s[i] + s[i + 1]
	a.append(res)
	res = ''
print(max(set(a), key=a.count))


import re

def read_numbers():
	return [int(s) for s in input().strip().split(' ')]

def occurrences(text, sub):
	return len(re.findall('(?={0})'.format(re.escape(sub)), text))

def main():
	_ = read_numbers()
	line = input()
	m = 0
	max_pair = None
	for i in range(1, len(line)):
		pair = line[i - 1] + line[i]
		count = occurrences(line, pair)
		if count > m:
			m = count
			max_pair = pair
	print(max_pair)
main()


import math
from collections import Counter

def sol():
	n = int(input())
	s = input()
	A = []
	for i in range(n - 1):
		for j in range(n - 1):
			if i != j and s[i:i + 2] == s[j:j + 2]:
				A.append(s[i:i + 2])
	if len(A) == 0:
		print(s[:2])
	else:
		(most_common, num_most_common) = Counter(A).most_common(1)[0]
		print(most_common)
sol()


n = int(input())
s = input()
a = [c1 + c2 for (c1, c2) in zip(s, s[1:])]
ans = max(a, key=a.count)
print(ans)


L = int(input())
s = input()
freq_map = {}
c = 0
i = 0
while i + 1 < L:
	count = s[i] + s[i + 1]
	if count in freq_map:
		freq_map[count] += 1
	else:
		freq_map[count] = 1
	i += 1
cnt = 0
ans = ''
for (key, value) in freq_map.items():
	if value >= cnt:
		cnt = value
		ans = key
print(ans)


n = int(input())
s = input()
mx = 0
ans = ''
for i in range(n - 1):
	cnt = 0
	for j in range(n - 1):
		if s[i] == s[j] and s[i + 1] == s[j + 1]:
			cnt += 1
		if cnt > mx:
			mx = cnt
			ans = s[i] + s[i + 1]
print(ans)


size = input()
letter = input()
dict = {}
temp = ''
for i in range(1, len(letter)):
	temp = letter[i - 1:i + 1]
	if dict.keys().__contains__(temp):
		dict[temp] += 1
	else:
		dict[temp] = 1
print(max(dict, key=dict.get))


n = int(input())
a = input()
maxi = 0
for i in range(len(a) - 1):
	s = a[i:i + 2]
	ct = 0
	for j in range(len(a) - 1):
		if a[j:j + 2] == s:
			ct += 1
	if ct > maxi:
		maxi = ct
		l = s
print(l)


def most_common(name):
	return max(set(name), key=name.count)
n = int(input(''))
word = input('')
word1 = []
for i in range(len(word) - 1):
	word1.append(word[i:i + 2])
a = most_common(word1)
print(a)


n = int(input())
s = input()
dicti = {}
for i in range(n - 1):
	if s[i:i + 2] in dicti:
		dicti[s[i:i + 2]] += 1
	else:
		dicti[s[i:i + 2]] = 1
maxi = 0
d = ''
for i in dicti:
	if dicti[i] > maxi:
		maxi = dicti[i]
		d = i
print(d)


n = int(input())
s = input()
(ans, curs, maxi) = ('', '', 0)
for i in range(n - 1):
	curs = s[i:i + 2]
	cnt = 0
	for j in range(i, n - 1):
		if s[j:j + 2] == curs:
			cnt += 1
	if cnt > maxi:
		maxi = cnt
		ans = curs
print(ans)


n = int(input())
s = input()
mek = {}
for i in range(1, n):
	if s[i] + s[i - 1] in mek:
		mek[s[i] + s[i - 1]] += 1
	else:
		mek[s[i] + s[i - 1]] = 1
(he, zz) = (0, 0)
for j in mek:
	if mek[j] > he:
		he = mek[j]
		zz = j
print(zz[1] + zz[0])


n = int(input())
s = input()
map_ = dict()
for (i, el) in enumerate(s[1:]):
	try:
		map_[s[i] + el] += 1
	except KeyError:
		map_[s[i] + el] = 1
m = 0
ans = str()
for (k, v) in map_.items():
	if v > m:
		m = v
		ans = k
print(ans)


length = input('')
string = input('')
library = {}
max_str = ''
max_occurance = 0
for i in range(len(string) - 1):
	sub_str = string[i:i + 2]
	if sub_str in library:
		occurance = library[sub_str]
		library[sub_str] = occurance + 1
	else:
		library[sub_str] = 1
	if library[sub_str] > max_occurance:
		max_str = sub_str
		max_occurance = library[sub_str]
print(max_str)


n = int(input())
s = input()
cnt = {}
for i in range(n - 1):
	cnt.setdefault(s[i:i + 2], 0)
	cnt[s[i:i + 2]] += 1
maxi = 0
for i in cnt:
	if cnt[i] > maxi:
		maxp = i
		maxi = cnt[i]
print(maxp)


n = int(input())
s = input()
mx = 0
tg = ''
res = dict()
for i in range(n + 1):
	if i + 1 < n:
		tempTg = s[i:i + 2]
	else:
		break
	if tempTg in res:
		res[tempTg] += 1
	else:
		res[tempTg] = 1
for (key, value) in res.items():
	if value > mx:
		mx = value
		tg = key
print(tg)


n = int(input())
s = input()
cell = []
ans = []
for i in range(1, n):
	for j in range(1, n):
		if s[i - 1:i + 1] == s[j - 1:j + 1]:
			if s[i - 1:i + 1] in cell:
				ans[cell.index(s[i - 1:i + 1])] += 1
			else:
				cell.append(s[i - 1:i + 1])
				ans.append(1)
print(cell[ans.index(max(ans))])


from collections import Counter

def main():
	n = int(input())
	s = input().strip()
	assert len(s) == n
	c = Counter()
	for i in range(n - 1):
		c[s[i:i + 2]] += 1
	print(c.most_common(1)[0][0])
main()


n = int(input())
str1 = input()
dict1 = {}
for i in range(len(str1)):
	m = str1[i:2 + i]
	dict1[m] = dict1.get(m, 0) + 1
key = list(dict1.keys())
value = list(dict1.values())
find = value.index(max(value))
print(key[find])


input()
xs = input()
prev = ''
d = {}
for x in xs:
	a = prev + x
	if a in d:
		d[a] += 1
	else:
		d[a] = 1
	prev = x
max_a = ''
max = -float('inf')
for (k, v) in d.items():
	if v >= max:
		max = v
		max_a = k
print(max_a)


from collections import Counter
n = input()
s = input()
two_gram = []
for i in range(len(s) - 1):
	pair = s[i] + s[i + 1]
	two_gram.append(pair)
ans = Counter(two_gram)
print(ans.most_common(1)[0][0])


def count_substring(string, sub_string):
	count = 0
	beg = 0
	while string.find(sub_string, beg) != -1:
		count = count + 1
		beg = string.find(sub_string, beg)
		beg = beg + 1
	return count
n = int(input())
s = input()
ans = ''
k = 0
for i in range(n - 1):
	t = s[i] + s[i + 1]
	temp = count_substring(s, t)
	if temp > k:
		ans = t
		k = temp
print(ans)


n = int(input())
a = input()
k = [0] * (n - 1)
for i in range(n - 1):
	k[i] = a[i] + a[i + 1]
f = sorted(list(set(k)))
s = [0] * len(f)
for i in range(len(f)):
	s[i] = k.count(f[i])
m = s[0]
answer = 0
for i in range(len(s)):
	if s[i] > m:
		m = s[i]
		answer = i
print(f[answer])


t = int(input(''))
n = input('')
di = dict()
for i in range(0, len(n) - 1, 1):
	word = n[i:i + 2]
	di[word] = di.get(word, 0) + 1
la = 0
lb = None
for (k, v) in di.items():
	if v > la:
		la = v
		lb = k
print(lb)


from collections import defaultdict
n = int(input())
d = defaultdict(int)
t = input()
c = 0
for i in range(n - 1):
	d[t[i] + t[i + 1]] = d[t[i] + t[i + 1]] + 1
d = dict(sorted(d.items(), key=lambda x: x[1], reverse=True))
for (i, j) in d.items():
	print(i)
	break


n = int(input())
s = input('')
d = {}
for i in range(len(s) - 1):
	if s[i] + s[i + 1] in d:
		d[s[i] + s[i + 1]] += 1
	else:
		d[s[i] + s[i + 1]] = 1
max_ = -1
val = 'A'
for i in d:
	if d[i] > max_:
		max_ = d[i]
		val = i
print(val)


from collections import defaultdict

def is_2gram(c1, c2):
	if (c1 + c2).isupper():
		return c1 + c2
	return False
n = int(input())
text = input()
num_ngram = defaultdict(int)
for i in range(n - 1):
	gram = is_2gram(text[i], text[i + 1])
	if gram:
		num_ngram[gram] += 1
print(max(num_ngram, key=num_ngram.get))


from sys import stdin
from collections import defaultdict

def main():
	(_,) = stdin_get_ints_from_line()
	s = stdin_get_string_from_line()
	t = defaultdict(int)
	for x in range(1, len(s)):
		t[s[x - 1] + s[x]] += 1
	print(max(t, key=t.get))

def stdin_get_ints_from_line():
	return (int(x) for x in stdin.readline().strip().split(' '))

def stdin_get_ints_list_from_line():
	return list((int(x) for x in stdin.readline().strip().split(' ')))

def stdin_get_string_from_line():
	return stdin.readline().strip()
main()


n = int(input())
s = input()
result = 0
ans = ''
for i in range(n - 1):
	current = 0
	for j in range(n - 1):
		if s[i] == s[j] and s[i + 1] == s[j + 1]:
			current += 1
	if result < current:
		result = current
		ans = s[i] + s[i + 1]
print(ans)


from collections import Counter
z = int(input())
h = input()
v = []
val = []
for i in range(len(h)):
	v.append(h[i:i + 2])
c = Counter(v)
for hv in c.values():
	val.append(hv)
a = max(val)
for (m, n) in c.items():
	if n == a:
		print(m)
		break


import operator
n = int(input())
s = input()
d = {}
for i in range(n - 1):
	if s[i:i + 2] in d.keys():
		d[s[i:i + 2]] += 1
	else:
		d[s[i:i + 2]] = 1
print(max(d.items(), key=operator.itemgetter(1))[0])


n = int(input())
s = input()
d = {}
for i in range(n - 1):
	key = s[i] + s[i + 1]
	if key not in d:
		d[key] = 1
	else:
		d[key] += 1
km = max(d, key=d.get)
print(km)


import sys
n = sys.stdin.readline()
n = int(n)
string = sys.stdin.readline()
aux = {}
for i in range(n - 1):
	if string[i] + string[i + 1] not in aux.keys():
		aux[string[i] + string[i + 1]] = 0
for i in range(n - 1):
	aux[string[i] + string[i + 1]] += 1
res = []
for key in aux.keys():
	res.append((aux[key], key))
res2 = []
for a in res:
	if a[0] == max(res)[0]:
		res2.append(a[1])
print(sorted(res2)[0])


import sys
import math
import os
from collections import Counter
n = sys.stdin.readline()
s = sys.stdin.readline()
n = int(n)
l = list(s)
dic = {}
for i in range(len(l) - 1):
	subs = l[i] + l[i + 1]
	if subs in list(dic.keys()):
		dic[subs] += 1
	else:
		dic[subs] = 1
print([k for (k, v) in dic.items() if v == max(list(dic.values()))][0])


number = int(input())
string = input()
L = []
maxx = 1
loc = string[0:2]
for i in range(number):
	L.append(string[i:i + 2])
for i in L:
	k = L.count(i)
	if k > maxx:
		maxx = k
		loc = i
print(loc)


tam_vetor = int(input())
vetor = list(input())
auxiliar1 = []
auxiliar2 = []
for i in range(1, tam_vetor):
	auxiliar1.append(vetor[i - 1] + vetor[i])
for i in auxiliar1:
	auxiliar2.append(auxiliar1.count(i))
print(auxiliar1[auxiliar2.index(max(auxiliar2))])


n = int(input())
inps = input()
maps = {}
for i in range(len(inps) - 1):
	key = inps[i] + inps[i + 1]
	if key not in maps:
		maps[key] = 0
	maps[inps[i] + inps[i + 1]] += 1
maxs = None
maxv = 0
a = sorted(maps, key=maps.get)
print(a[-1])


n = input()
s = input()
gg = {}
ma = 0
maS = ''
for i in range(len(s)):
	if i != len(s) - 1:
		try:
			gg[str(s[i] + s[i + 1])] = gg[str(s[i] + s[i + 1])] + 1
			if gg[str(s[i] + s[i + 1])] > ma:
				ma = gg[str(s[i] + s[i + 1])]
				maS = str(s[i] + s[i + 1])
		except:
			gg[str(s[i] + s[i + 1])] = 1
			if gg[str(s[i] + s[i + 1])] > ma:
				ma = gg[str(s[i] + s[i + 1])]
				maS = str(s[i] + s[i + 1])
print(maS)


n = int(input())
s = input()
list1 = []
maximum = 0
s1 = ''
for i in range(n - 1):
	list1.append(s[i:i + 2])
for i in list1:
	if list1.count(i) > maximum:
		maximum = list1.count(i)
		s1 = i
print(s1)


n = int(input())
s = str(input())
d = {}
for i in range(n - 1):
	if s[i:i + 2] in d:
		d[s[i:i + 2]] += 1
	else:
		d[s[i:i + 2]] = 1
m = 0
cur = 0
for i in d:
	if d[i] > m:
		m = d[i]
		cur = i
print(cur)


n = int(input())
x = input()
x += '  '
st = ''
past = ''
flag = False
sc = str
big = 0
for k in range(0, n):
	for i in range(0 + k, 2 + k):
		st += x[i]
	s = x.count(st)
	if s > big or st == past:
		big = s
		sc = st
	past = st
	st = ''
if n == 2:
	print(x)
	flag = True
if not flag:
	print(sc)


num = int(input())
str1 = input()
m = 0
frame = ''
d = {}
for i in range(len(str1) - 1):
	f = str1[i:i + 2]
	if d.get(f) != None:
		d[f] += 1
	else:
		d[f] = 1
for (j, k) in d.items():
	if k > m:
		frame = j
		m = k
print(frame)


n = int(input())
s = input()
d = dict()
for i in range(n - 1):
	if s[i] + s[i + 1] not in d:
		d[s[i] + s[i + 1]] = 1
	else:
		d[s[i] + s[i + 1]] += 1
maxx = -1
strr = ''
for i in d:
	if d[i] > maxx:
		maxx = d[i]
		strr = i
print(strr)


n = int(input())
s = input()
twoGramList = []
for i in range(n):
	if i != n - 1:
		twoGramList.append(s[i:i + 2])
twoGramList.sort()
counter = 0
index = 0
tempCounter = 0
for i in range(len(twoGramList)):
	if i != len(twoGramList) - 1:
		if twoGramList[i] == twoGramList[i + 1]:
			tempCounter += 1
		else:
			tempCounter = 0
	if tempCounter > counter:
		counter = tempCounter
		index = i
		tempCounter = 0
print(twoGramList[index])


n = int(input())
str = input()

def count_substring(string, substring):
	l = len(substring)
	count = 0
	for i in range(len(string) - len(substring) + 1):
		if string[i:i + len(substring)] == substring:
			count += 1
	return count
i = {}
j = 0
while j < len(str) - 1:
	substr = str[j:j + 2]
	i[substr] = count_substring(str, substr)
	j += 1
print(max(i, key=i.get))


n = input()
s = str(input())
cnt = {}
max = 0
ans = s[0:2]
for i in range(int(n) - 1):
	if s[i:i + 2] not in cnt:
		cnt[s[i:i + 2]] = 1
	else:
		cnt[s[i:i + 2]] += 1
	if cnt[s[i:i + 2]] > max:
		max = cnt[s[i:i + 2]]
		ans = s[i:i + 2]
print(ans)


n = int(input())
s = input()
max = 0
maxs = ''
for i in range(n - 1):
	c = s[i] + s[i + 1]
	count = 1
	for j in range(i + 1, n - 1):
		if s[j] + s[j + 1] == c:
			count += 1
	if max < count:
		max = count
		maxs = c
print(maxs)


n = int(input())
s = str(input())
l = []
for z in range(0, n - 1):
	l.append(s[z] + s[z + 1])
maxNum = 0
maxStr = ''
for i in l:
	this = l.count(i)
	if this > maxNum:
		maxNum = this
		maxStr = i
print(maxStr)


from sys import stdin, stdout

def fn(s, s1):
	cnt = 0
	for i in range(n - 1):
		if s[i] + s[i + 1] == s1:
			cnt += 1
	return cnt
for _ in range(1):
	n = int(stdin.readline())
	s = input()
	mx = 0
	for i in range(n - 1):
		s1 = s[i] + s[i + 1]
		if fn(s, s1) > mx:
			mx = fn(s, s1)
			ss = s1
	print(ss)


n = input()
m = input()
max = 0
dic = {}
rs = ''

def findTwoGram():
	for i in range(len(m) - 1):
		global max
		key = m[i:i + 2]
		if key not in dic:
			dic[key] = 1
		else:
			dic[key] += 1
		if dic[key] > max:
			max = dic[key]
			rs = key
	print(rs)
findTwoGram()


import re
n = int(input())
l = str(input())
a = dict()
m = -1
r = ''
for i in range(n - 1):
	s = l[i] + l[i + 1]
	if s in a:
		a[s] += 1
	else:
		a[s] = 1
for i in a:
	if a[i] > m:
		r = i
		m = a[i]
print(r)


num = input()
string = input()
maximum = 0
count = 0
for i in range(0, len(string) - 1):
	count = 0
	string1 = string[i:i + 2]
	for j in range(0, len(string) - 1):
		if string1 == string[j:j + 2]:
			count += 1
	if count > maximum:
		maximum = count
		result = string1
print(result)


def two_gram(n, s):
	a = s[0:2]
	maior = 0
	menor = 0
	for i in range(0, len(s) - 1):
		for j in range(i + 1, len(s) - 1):
			if s[i:i + 2] == s[j:j + 2]:
				menor += 1
		if maior < menor:
			maior = menor
			a = s[i:i + 2]
		menor = 0
	return a
a = int(input())
b = str(input())
print(two_gram(a, b))


import sys
n = int(sys.stdin.readline())
string = sys.stdin.readline()
counter = {}
for i in range(n - 1):
	bigram = string[i] + string[i + 1]
	counter[bigram] = 0
for i in range(n - 1):
	bigram = string[i] + string[i + 1]
	counter[bigram] += 1
max_c = 0
bi = ''
for (key, val) in counter.items():
	if val > max_c:
		max_c = val
		bi = key
print(bi)


d = dict()
n = int(input())
s = input()
mx = 0
mxs = ''
for i in range(1, n):
	d[s[i - 1:i + 1]] = 0
for i in range(1, n):
	d[s[i - 1:i + 1]] += 1
	if d[s[i - 1:i + 1]] > mx:
		mx = d[s[i - 1:i + 1]]
		mxs = s[i - 1:i + 1]
print(mxs)


def count_sub(inp_s, subs):
	l = len(subs)
	ct = 0
	for i in range(0, len(inp_s)):
		if inp_s[i:i + l] == subs:
			ct += 1
	return ct
n = int(input())
s = input()
mx = -1
ans = ''
for i in range(len(s) - 1):
	ss = s[i:i + 2]
	val = count_sub(s, ss)
	if val >= mx:
		mx = val
		ans = ss
print(ans)


n = int(input())
s = str(input())
alist = []
for i in range(n - 1):
	alist.append(s[i] + s[i + 1])
myset = set(alist)
mylist = list(myset)
for item in myset:
	if mylist.index(item) == 0:
		a = alist.count(item)
		result = item
	else:
		new = alist.count(item)
		if a < new:
			a = new
			result = item
print(result)


N = int(input())
S = input()
dict = {'0': 0}
for i in range(0, N - 1):
	l = S[i] + S[i + 1]
	if dict.get(l) == None:
		dict[l] = 0
	dict[l] = dict[l] + 1
maxi = 0
k = 0
for x in dict:
	if maxi < dict[x]:
		maxi = dict[x]
		k = x
print(k)


n = int(input())
line = input()
occ = {}
for k in range(n - 1):
	temp = line[k:k + 2]
	occ[temp] = 0
	for j in range(n - 1):
		if line[j:j + 2] == temp:
			occ[temp] += 1
ma = line[0:2]
for e in occ:
	if occ[e] > occ[ma]:
		ma = e
print(ma)


from collections import Counter
input()
x = input()
l = []
for i in range(len(x) - 1):
	l.append(x[i:i + 2])
c = Counter(l)
print(c.most_common(1)[0][0])


from collections import defaultdict
n = int(input())
c = input()
d = defaultdict(int)
for i in range(n - 1):
	r = c[i] + c[i + 1]
	d[r] += 1
print(max(d, key=d.get))


from collections import Counter
_ = input()
s = input()
counts = Counter()
counts.update((s[i - 1:i + 1] for i in range(1, len(s))))
print(counts.most_common(1)[0][0])


n = int(input())
string = input()
strings = {}
for x in range(n - 1):
	s = string[x] + string[x + 1]
	if s not in strings:
		strings[s] = 1
	else:
		strings[s] += 1
a = max(strings.values())
for (string, count) in strings.items():
	if count == a:
		print(string)
		break


n = int(input())
s = input()
tgl = {}
l = list(s)
for i in range(len(l) - 1):
	tg = str(l[i] + l[i + 1])
	if tg not in tgl.keys():
		tgl[tg] = 1
	else:
		tgl[tg] += 1
c = -1
for i in tgl.keys():
	if tgl[i] > c:
		c = tgl[i]
		greater = i
print(greater)


n = int(input())
s = input()
two_gs = {}
i = 0
j = 2
maximum = 0
while j <= len(s):
	check = s[i:j]
	if check in two_gs:
		two_gs[check] += 1
	else:
		two_gs[check] = 1
	if two_gs[check] > maximum:
		maximum = two_gs[check]
	i += 1
	j += 1
for i in two_gs:
	if two_gs[i] == maximum:
		print(i)
		break


n = int(input())
s = input()
z = []
for i in range(len(s) - 1):
	z.append(s[i] + s[i + 1])
zi = list(set(z))
a = []
for i in zi:
	a.append(z.count(i))
print(zi[a.index(max(a))])


import math
import string
n = int(input())
s = str(input())
maxn = -1
ans = ''
if len(s) == 2:
	print(s)
else:
	for i in range(0, n - 1):
		tmp = s[i:i + 2]
		cnt = 0
		for i in range(0, n - 1):
			if s[i] == tmp[0] and s[i + 1] == tmp[1]:
				cnt += 1
		if cnt > maxn:
			maxn = cnt
			ans = tmp
	print(ans)


def get_key(val, freq):
	for (key, value) in freq.items():
		if val == value:
			return key
n = int(input())
s = input()
freq = {}
y = []
for i in range(n - 1):
	x = s[i:i + 2]
	if x in freq:
		freq[x] += 1
	else:
		freq[x] = 1
val = freq.values()
m = max(val)
print(get_key(m, freq))


n = int(input())
l = list(input())
lp = []
for i in range(n - 1):
	li = l[i] + l[i + 1]
	lp.append(li)
col = []
for i in lp:
	co = lp.count(i)
	col.append(co)
print(lp[col.index(max(col))])


def CountDict(Text, k):
	if k > len(Text):
		return None
	if k == len(Text):
		return {Text: 1}
	list_substr = list()
	for j in range(len(Text) - k + 1):
		list_substr.append(Text[j:j + k])
	RetMap = dict()
	for j in range(len(list_substr)):
		key_val = list_substr[j]
		RetMap[key_val] = RetMap.get(key_val, 0) + 1
	return RetMap

def PrintDict(d):
	v = list(d.values())
	k = list(d.keys())
	return k[v.index(max(v))]
n = int(input())
s = input()
answer = CountDict(s, 2)
print(PrintDict(answer))


n = int(input())
s = input()
l = []
for i in range(n - 1):
	l.append(s[i] + s[i + 1])
a = list(dict.fromkeys(l))
e = []
for i in range(len(a)):
	si = l.count(a[i])
	e.append(si)
id = e.index(max(e))
print(a[id])


def find_out(two):
	x = 0
	mark = 0
	for i in liste2:
		if two == i:
			mark += 1
	return mark
mark = 0
count = int(input())
liste = list(input())
liste2 = []
k = 0
ans = 0
l = 0
while count - 1 > k:
	a = liste[k] + liste[k + 1]
	liste2.append(a)
	k += 1
merit = list(map(find_out, liste2))
merit2 = []
for i in merit:
	merit2.append(i)
merit2.sort()
ans = merit2[-1]
print(liste2[merit.index(ans)])


n = int(input())
s = input()
d = {}
for i in range(len(s) - 1):
	t = s[i] + s[i + 1] + ''
	if t not in d.keys():
		d[t] = 1
	else:
		d[t] += 1
m = max(d.values())
print(list(d.keys())[list(d.values()).index(m)])


from collections import *
n = int(input())
dic = {}
s = input()
for i in range(n - 1):
	if s[i:i + 2] not in dic:
		dic[s[i:i + 2]] = 1
	else:
		dic[s[i:i + 2]] += 1
maxi = max(list(dic.values()))
for i in dic:
	if dic[i] == maxi:
		print(i)
		exit()


n = int(input())
s = input()
max = 0
val = 0
for i in range(n - 1):
	sub = s[i] + s[i + 1]
	val = 0
	for j in range(n - 1):
		if s[j] + s[j + 1] == sub:
			val += 1
	if val > max:
		max = val
		ans = sub
print(ans)


from collections import defaultdict

def main():
	N = int(input())
	S = input()
	two = defaultdict(int)
	for i in range(N - 1):
		two[S[i:i + 2]] += 1
	s = sorted(two.items(), key=lambda x: x[1], reverse=1)
	print(s[0][0])
main()


n = int(input())
s = input()
(i, j) = (0, 0)
c = 0
str1 = ''
while i != n - 1:
	temp = s[i:i + 2]
	count = 0
	j = 0
	while j != n - 1:
		if s[j:j + 2] == temp:
			count += 1
		j += 1
	if count > c:
		c = count
		str1 = temp
	i += 1
print(str1)


n = int(input())
x = input()
i = m = 0
z = ''
y = ''
sum = 0
max = 0
while i < n - 1:
	z = x[i:i + 2]
	while m < n:
		if z == x[m:m + 2]:
			sum += 1
		m += 1
	if sum > max:
		max = sum
		y = z
	sum = 0
	m = 0
	i += 1
print(y)


dic = {}
n = int(input())
s = input()
(maxm, maxt) = (0, '')
for i in range(0, len(s) - 1):
	if s[i:i + 2] in dic:
		dic[s[i:i + 2]] += 1
		if dic[s[i:i + 2]] > maxm:
			maxm = dic[s[i:i + 2]]
			maxt = s[i:i + 2]
	else:
		dic[s[i:i + 2]] = 1
		if dic[s[i:i + 2]] > maxm:
			maxm = dic[s[i:i + 2]]
			maxt = s[i:i + 2]
print(maxt)


def count(p, q):
	t = 0
	for j in range(len(q) - len(p) + 1):
		if q[j:j + len(p)] == p:
			t += 1
	return t
n = int(input())
s = input()
k = []
for j in range(n - 1):
	k.append(s[j:j + 2])
t = count(k[0], s)
ans = k[0]
for i in range(1, len(k)):
	r = count(k[i], s)
	if r > t:
		ans = k[i]
		t = r
print(ans)


t = input()
s = input()
d = dict()
max = 0
for i in range(len(s) - 1):
	d[s[i] + s[i + 1]] = d.get(s[i] + s[i + 1], 0) + 1
	if max < d.get(s[i] + s[i + 1]):
		ans = s[i] + s[i + 1]
		max = d.get(s[i] + s[i + 1])
print(ans)


def main():
	n = int(input())
	s = input()
	ans = {}
	for z in range(n - 1):
		cur = s[z:z + 2]
		try:
			ans[cur] += 1
		except:
			ans[cur] = 1
	m = -9999999
	final = ''
	for z in ans:
		if ans[z] > m:
			m = ans[z]
			final = z
	print(final)
	return 0
main()


n = int(input())
s = input()
res = []
for i in range(n - 1):
	st = s[i:i + 2]
	res.append(st)
print(max(set(res), key=res.count))


def TwoGram(n, s):
	count = 0
	res = {}
	for i in range(n - 1):
		res[s[i:i + 2]] = 1
	for i in range(n - 1):
		if s[i:i + 2] in s[i + 1:n]:
			res[s[i:i + 2]] = res[s[i:i + 2]] + 1
	m = max(res.values())
	for i in range(n - 1):
		if res[s[i:i + 2]] == m:
			return s[i:i + 2]
x = int(input())
x1 = input()
print(TwoGram(x, x1))


n = int(input())
s = input()
dict = {}
for i in range(len(s) - 1):
	tmp = str(s[i]) + str(s[i + 1])
	if tmp in dict:
		dict[tmp] += 1
	else:
		dict[tmp] = 1
mx = 0
ans = ''
for (key, item) in dict.items():
	if mx < item:
		mx = item
		ans = key
print(ans)


def f(n, string):
	dct = dict()
	tmp = 0
	res = ''
	for i in range(n - 1):
		dct[string[i:i + 2]] = dct.get(string[i:i + 2], 0) + 1
	for (k, v) in dct.items():
		if tmp < v:
			tmp = v
			res = k
	return res
print(f(int(input()), input()))


N = int(input())
S = input()
list_split = []
for i in range(N - 1):
	list_split.append(S[i:i + 2])
maximum = 0
for j in range(N - 1):
	if list_split.count(list_split[j]) > maximum:
		maximum = list_split.count(list_split[j])
		maximum_output = list_split[j]
print(maximum_output)


import operator
n = int(input())
s = input()
dic = {}
for i in range(0, n - 1):
	two_gram = s[i] + s[i + 1]
	if two_gram not in dic:
		dic[two_gram] = 1
	else:
		dic[two_gram] += 1
print(max(dic.items(), key=operator.itemgetter(1))[0])


n = int(input())
a = list(input())
d = {}
for i in range(n - 1):
	if a[i] + a[i + 1] not in d:
		d[a[i] + a[i + 1]] = 1
	else:
		d[a[i] + a[i + 1]] += 1
b = list(d.keys())
a = list(d.values())
d = {}
for i in range(len(a)):
	d[a[i]] = b[i]
print(d[max(a)])


def lol_kek():
	t = int(input())
	s = input()
	ma = 0
	p = 0
	c = ''
	l = 0
	for i in range(len(s) - 1):
		c = s[i] + s[i + 1]
		l = 0
		for j in range(i, len(s) - 1):
			if s[j] + s[j + 1] == c:
				l += 1
		if l > ma:
			ma = l
			p = i
	print(s[p] + s[p + 1])
lol_kek()


n = int(input())
S = input().strip()
d = {}
for i in range(n - 1):
	cur = S[i:i + 2]
	d[cur] = d.get(cur, 0) + 1
ans = S[:2]
mmax = 1
for (key, val) in d.items():
	if val > mmax:
		mmax = val
		ans = key
print(ans)


n = int(input())
s = input()
cnt = []
tw = []
for i in range(n - 1):
	if s[i] + s[i + 1] not in tw:
		tw.append(s[i] + s[i + 1])
		cnt.append(1)
	else:
		for j in range(n - 1):
			if tw[j] == s[i] + s[i + 1]:
				cnt[j] += 1
				break
max = max([(v, i) for (i, v) in enumerate(cnt)])
print(tw[max[1]])


n = int(input())
s = input()
count = []
for i in range(n - 1):
	sub_s = s[i] + s[i + 1]
	x = s[i + 1:n]
	count.append(x.count(sub_s) + 1)
pos = count.index(max(count))
print(s[pos:pos + 2])


def countString(string, subString):
	length = len(subString)
	count = 0
	for i in range(len(string) - length + 1):
		check = string[i:i + length]
		if check == subString:
			count += 1
	return count
n = int(input())
string = input()
grams = []
highestValue = 0
highestGram = ''
for i in range(n - 1):
	grams.append(string[i:i + 2])
grams = set(grams)
for gram in grams:
	count = countString(string, gram)
	if count > highestValue:
		highestValue = count
		highestGram = gram
print(highestGram)


n = int(input())
s = input()
m = {}
for i in range(n - 1):
	if s[i] + s[i + 1] not in m:
		m[s[i] + s[i + 1]] = 1
	else:
		m[s[i] + s[i + 1]] += 1

def cmp(x):
	return m[x]
a = sorted(m, key=cmp, reverse=True)
print(a[0])


n = int(input())
st = input()
tg = []
lst = []
for char in st:
	lst.append(char)
for i in range(n - 1):
	tg.append(f'{lst[i]}{lst[i + 1]}')
c = {}
set_tg = set(tg)
for i in set_tg:
	c[i] = tg.count(i)
cc = sorted(c, key=c.get, reverse=True)
print(cc[0])


n = int(input())
dic = {}
s = input()
for i in range(len(s) - 1):
	sub = s[i:i + 2]
	if sub not in dic:
		dic[sub] = 1
	else:
		dic[sub] += 1
inverse = [(value, key) for (key, value) in dic.items()]
print(max(inverse)[1])


input()
s = input()
g = {}
for i in range(len(s) - 1):
	ss = s[i:i + 2]
	g[ss] = g.get(ss, 0) + 1
print(sorted([(v, k) for (k, v) in g.items()])[-1][1])


from collections import defaultdict
d = defaultdict(int)
n = int(input())
s = str(input())
for i in range(n - 1):
	pair = s[i:i + 2]
	d[pair] += 1
d = sorted(d.items(), key=lambda x: x[1], reverse=True)
for i in d:
	print(i[0])
	break


n = int(input())
c = input()
e = set()
for i in range(n - 1):
	e.add(c[i] + c[i + 1])
a = {}
for x in e:
	k = 0
	for i in range(n - 1):
		if x == c[i] + c[i + 1]:
			k += 1
	a[str(k)] = x
z = max([int(s) for s in a.keys()])
print(a[str(z)])


from collections import defaultdict
n = int(input())
s = input()
pairs = defaultdict(int)
for i in range(n):
	if i == 0:
		continue
	pairs[s[i - 1] + s[i]] += 1
ma = 0
mp = ''
for k in pairs:
	if pairs[k] > ma:
		ma = pairs[k]
		mp = k
print(mp)


size = 26 * 26 + 2
n = int(input())
string = input()
listgrams = [0 for x in range(size)]
maxgram = 0
for i in range(len(string) - 1):
	gram = string[i:i + 2]
	index = hash(gram) % size
	listgrams[index] += 1
	if listgrams[index] > maxgram:
		key = gram
		maxgram = listgrams[index]
print(key)


n = int(input())
C = input()
big_letters = [chr(ord('A') + i) for i in range(ord('Z') - ord('A') + 1)]
best = 0
val = '__'
for A in big_letters:
	for B in big_letters:
		tmp = sum([1 if C[i:i + 2] == A + B else 0 for i in range(len(C) - 1)])
		if tmp > best:
			best = tmp
			val = A + B
print(val)


n = int(input())
s = input()
a = {}
for i in range(n - 1):
	k = s[i:i + 2]
	a[k] = a[k] + 1 if k in a else 1
print(max(a, key=a.get))


dic = {}
i = input()
s = input()
for i in range(len(s) - 1):
	if s[i] + s[i + 1] not in dic.keys():
		dic[s[i] + s[i + 1]] = 1
	else:
		dic[s[i] + s[i + 1]] += 1
maximum = 0
max_str = ''
for j in dic:
	if dic[j] > maximum:
		max_str = j
		maximum = dic[j]
print(max_str)


from collections import Counter
n = int(input())
string_list = list(input())
c = Counter((str(string_list[i] + string_list[i + 1]) for i in range(len(string_list) - 1)))
print(c.most_common(1)[0][0])


n = int(input())
s = input()
D = dict()
for i in range(n - 1):
	c = s[i:i + 2]
	if c in D.keys():
		D[c] += 1
	else:
		D[c] = 1
m = ''
for elem in D.keys():
	if not m or D[elem] > D[m]:
		m = elem
print(m)


x = int(input())
a = input()
p = 0
b = []
for t in range(x - 1):
	for i in range(x - 1):
		if a[t] + a[t + 1] == a[i] + a[i + 1]:
			p += 1
	b.append(p)
	p = 0
k = b.index(max(b))
print(a[k] + a[k + 1])


n = int(input())
s = input()
d = {}
for i in range(n - 1):
	t = s[i:i + 2]
	d[t] = d.get(t, 0) + 1
print(max(d, key=d.get))


n = int(input())
s = input()
d = {}
for i in range(len(s) - 1):
	try:
		d.update({s[i] + s[i + 1]: d[s[i] + s[i + 1]] + 1})
	except:
		d.update({s[i] + s[i + 1]: 0})
res = list(d.items())[0]
for i in d.items():
	if i[1] > res[1]:
		res = i
print(res[0])


def count(s, sub):
	count = 0
	for i in range(0, len(s) - 1):
		if sub == s[i] + s[i + 1]:
			count += 1
	return count
n = int(input())
s = input()
best = 0
for i in range(0, n - 1):
	if count(s[i:], s[i] + s[i + 1]) > best:
		best = count(s[i:], s[i] + s[i + 1])
		sub = s[i] + s[i + 1]
print(sub)


def calculate(substring, originalString):
	ct = 0
	maximum = 0
	i = 0
	while i < len(originalString) - 1:
		if len(substring) > 1:
			if originalString[i] == substring[0] and originalString[i + 1] == substring[1]:
				ct += 1
		i += 1
	return ct
n = int(input())
s = input()
maximum = 0
result = ''
for i in range(0, len(s)):
	partial = s[i:i + 2]
	temp = calculate(partial, s)
	if temp > maximum:
		maximum = temp
		result = partial
print(result)


N = int(input())
S = input()
D = {}
maxs = -1
output = ''
for i in range(0, N):
	j = i + 1
	if D.get(S[i:j + 1]) is None:
		D[S[i:j + 1]] = 1
	else:
		D[S[i:j + 1]] += 1
	if D[S[i:j + 1]] > maxs:
		maxs = D[S[i:j + 1]]
		output = S[i:j + 1]
print(output)


n = int(input())
s = input()
d = dict(zip([s[i] + s[i + 1] for i in range(0, n - 1)], [0] * (n - 1)))
for i in range(n - 1):
	d[s[i] + s[i + 1]] += 1
m = max(d.values())
for (key, value) in d.items():
	if m == value:
		print(key)
		break


n = int(input())
s = input()
if n == 2:
	print(s)
else:
	m = 0
	k = ''
	t = set()
	for i in range(n - 1):
		s1 = 0
		if s[i:i + 2] not in t:
			t.add(s[i:i + 2])
			for j in range(n - 1):
				if s[j:j + 2] == s[i:i + 2]:
					s1 += 1
			if s1 > m:
				m = s1
				k = s[i:i + 2]
		else:
			continue
	print(k)


n = int(input())
s = input()
lst = []
for i in range(1, len(s)):
	lst += [s[i - 1] + s[i]]
if lst:
	print(max(set(lst), key=lst.count))
else:
	print(lst[0])


n = int(input())
s = input()
d = dict()
l = []
for i in range(n - 1):
	d[s[i] + s[i + 1]] = 0
for i in d.keys():
	for j in range(n - 1):
		if i[0] == s[j] and i[1] == s[j + 1]:
			d[i] += 1
for (i, j) in d.items():
	l.append((i, j))
(m, n) = (0, 0)
for i in l:
	if m < i[1]:
		m = i[1]
		n = i[0]
print(n)


from collections import Counter
n = int(input())
s = input()
l = list(s)
li_1 = [i + j for (i, j) in zip(s[::2], s[1::2])]
li_2 = [i + j for (i, j) in zip(s[1::2], s[2::2])]
li_1.extend(li_2)
c = Counter(li_1)
print(c.most_common()[0][0])


n = int(input())
s = input()
l = list()
for i in range(0, n - 1):
	l.append(s[i] + s[i + 1])
di = dict()
for i in range(0, n - 1):
	di[l[i]] = l.count(l[i])
maxx = max(map(l.count, l))
for i in range(0, n - 1):
	if di[l[i]] == maxx:
		print(l[i])
		break


n = int(input())
s = input()
t = []
for i in range(n - 1):
	t.append(s[i] + s[i + 1])
max = t[0]
for x in t:
	if t.count(x) > t.count(max):
		max = x
print(max)


n = int(input())
string = input()
sub = {}
i = 0
while i <= n - 2:
	a = string[i] + string[i + 1]
	if a in sub:
		sub[a] += 1
	else:
		sub[a] = 1
	i += 1
z = max(sub.values())
for i in sub.keys():
	if sub[i] == z:
		print(i)
		break


n = int(input())
s = input().rstrip()
l = []
x = list(s)
if n == 2:
	print(s)
else:
	for i in range(0, len(x) - 2 + 1):
		C = ''.join(x[i:i + 2])
		l.append(C)
	x = list(set(l))
	maxf = -99999
	for i in range(0, len(x)):
		if l.count(x[i]) > maxf:
			maxf = l.count(x[i])
			V = i
	print(x[V])


import collections
q = int(input())
grams = input()
two_grams = []
for i in range(q):
	two_grams.append(grams[i - 1:i + 1])
del two_grams[0]
ocurrence = collections.Counter(two_grams)
print(ocurrence.most_common(1)[0][0])


n = int(input())
x = str(input())
d = {}
for i in range(len(x) - 1):
	temp = x[i:i + 2]
	if temp in d:
		d[temp] += 1
	else:
		d[temp] = 1
ans = -1
w = ''
for word in d:
	if d[word] > ans:
		ans = d[word]
		w = word
print(w)


n = int(input())
s = input()
d = {}
max_val = 0
ans = ''
for i in range(n - 1):
	two_gram = s[i] + s[i + 1]
	d[two_gram] = d.get(two_gram, 0) + 1
for (k, v) in d.items():
	if v > max_val:
		max_val = v
		ans = k
print(ans)


n = int(input())
line = list(input())
l = list()
k = list()
for i in range(n - 1):
	l.append(line[i] + line[i + 1])
for m in range(len(l)):
	k.append(0)
for j in range(len(l)):
	count = 0
	for v in range(len(l)):
		if l[j] == l[v]:
			count += 1
			k[j] = count
max_value = max(k)
max_index = k.index(max_value)
print(l[max_index])


lenStr = int(input())
symbols = input()
dictStrAndCount = {}
for index in range(len(symbols) - 1):
	string = symbols[index] + symbols[index + 1]
	if string in dictStrAndCount:
		dictStrAndCount[string] += 1
	else:
		dictStrAndCount[string] = 1
maxValue = 0
for value in dictStrAndCount.values():
	if value > maxValue:
		maxValue = value
for (key, value) in dictStrAndCount.items():
	if value == maxValue:
		print(key)
		break


n = int(input())
s = input()
dict = {}
for i in range(n - 1):
	tgram = s[i:i + 2]
	if tgram in dict:
		dict[tgram] += 1
	else:
		dict[tgram] = 1
mx = 0
for (key, value) in dict.items():
	if value > mx:
		mx = value
		mx_key = key
print(mx_key)


n = int(input())
s = input()
mass = []
for i in range(n - 1):
	mass.append(s[i] + s[i + 1])
maxx = 1
k = 0
for i in range(n - 1):
	if mass.count(mass[i]) > maxx:
		maxx = mass.count(mass[i])
		k = i
print(mass[k])


def prefix_function(s):
	n = len(s)
	pi = [0 for i in range(n)]
	for i in range(1, n):
		j = pi[i - 1]
		while j > 0 and s[i] != s[j]:
			j = pi[j - 1]
		if s[i] == s[j]:
			j += 1
		pi[i] = j
	summ = 0
	for i in pi:
		if i == 2:
			summ += 1
	return summ
s = set()
maxx = 0
n = int(input())
st = input()
it = ''
for i in range(1, n):
	d = st[i - 1] + st[i]
	if d not in s:
		s.add(d)
		q = prefix_function(d + '#' + st)
		if q > maxx:
			it = d
			maxx = q
print(it)


import sys
l1 = int(sys.stdin.readline().strip())
b = sys.stdin.readline().strip()
counter = {}
for i in range(l1 - 1):
	if b[i:i + 2] not in counter:
		counter[b[i:i + 2]] = 1
	else:
		counter[b[i:i + 2]] += 1
j = max(counter, key=counter.get)
print(j)


n = int(input())
s = input()
a = []
i = 1
while i < len(s):
	a.append(s[i - 1] + s[i])
	i += 1
ans = 0
maxAns = 0
index = 0
for i in range(0, len(a)):
	for j in range(i + 1, len(a)):
		if a[i] == a[j]:
			ans += 1
	if maxAns < ans:
		maxAns = ans
		index = i
	ans = 0
print(a[index])


_ = input()
s = input()
i = 0
l = {}
while i < len(s) - 1:
	tw1 = s[i:i + 2]
	tw2 = tw1[::-1]
	if tw1 in l:
		l[tw1] += 1
	else:
		l[tw1] = 1
		l[tw2] = 1
	i += 1
print(max([item for item in l.items()], key=lambda x: x[1])[0])


n = int(input())
s = input()
res = 0
ans = ''
for i in range(n - 1):
	cnt = 0
	for j in range(i, n - 1):
		if s[i:i + 2] == s[j:j + 2]:
			cnt += 1
	if cnt > res:
		res = cnt
		ans = s[i:i + 2]
print(ans)


len = int(input())
str = input()
dict = {}
for i in range(65, 91):
	for j in range(65, 91):
		index = chr(i) + chr(j)
		dict[index] = 0
for i in range(0, len - 1):
	index = str[i:i + 2]
	dict[index] += 1
ans = ''
oc = 0
for i in range(65, 91):
	for j in range(65, 91):
		index = chr(i) + chr(j)
		if dict[index] > oc:
			oc = dict[index]
			ans = index
print(ans)


n = int(input())
s = input()
dict = {}
max_val = -1
max_str = ''
for i in range(len(s) - 1):
	val = s[i] + s[i + 1]
	if dict.get(val) is None:
		dict.update({val: 0})
	dict.update({val: dict.get(val) + 1})
	if dict.get(val) > max_val:
		max_val = dict.get(val)
		max_str = val
print(max_str)


n = int(input())
s = input()
d = dict()
for i in range(n - 1):
	x = s[i] + s[i + 1]
	if x in d:
		d[x] += 1
	else:
		d[x] = 1
(Max, ans) = (0, '')
for i in d:
	if Max < d[i]:
		Max = d[i]
		ans = i
print(ans)


n = int(input())
s = input()
d = {}
for i in range(n - 1):
	if s[i:i + 2] in d:
		d[s[i:i + 2]] += 1
	else:
		d[s[i:i + 2]] = 1
max = -2
for x in d:
	if d[x] > max:
		max = d[x]
		ms = x
print(ms)


import sys
import os
t = sys.stdin.readline()
n_stud = int(t)
t = sys.stdin.readline()
dict_two_grams = {}
id_max = -1
max_o = 0
for idx in range(len(t) - 1):
	two_gram = t[idx:idx + 2]
	if two_gram in dict_two_grams.keys():
		dict_two_grams[two_gram] += 1
	else:
		dict_two_grams[two_gram] = 1
	if dict_two_grams[two_gram] > max_o:
		id_max = two_gram
		max_o = dict_two_grams[two_gram]
print(id_max)


n = int(input())
s = input()
sub = [s[i:i + 2] for i in range(n - 1)]
print(max(sub, key=sub.count))


n = int(input())
s = str(input())
d = dict()
for i in range(len(s) - 1):
	try:
		d[s[i:i + 2]] += 1
	except:
		d[s[i:i + 2]] = 1
m = max(d.values())
f = ''
for k in d:
	if d[k] == m:
		f = k
print(f)


a = int(input())
s = input()
s = [s[i] + s[i + 1] for i in range(len(s) - 1)]
print(max(s, key=s.count))


def two_gram(s):
	slist = [s[i:i + 2] for i in range(0, len(s) - 1)]
	return max(slist, key=slist.count)

def main():
	n = input()
	s = input()
	print(two_gram(s))
main()


def test_1():
	import math
	from collections import Counter
	n = list(map(int, input().split(' ')))[0]
	s = input()
	aa = []
	for i in range(n):
		s1 = s[i:i + 2]
		aa.append(s1)
	b = Counter(aa)
	c = max(Counter(aa).values())
	for (k, v) in b.items():
		if v == c:
			print(k)
			break
test_1()


n = int(input(''))
s = list(input(''))
ans = 0
sol = ''
for i in range(n - 1):
	cur = 0
	for j in range(n - 1):
		if s[j] == s[i] and s[j + 1] == s[i + 1]:
			cur += 1
	if cur > ans:
		ans = cur
		sol = s[i] + s[i + 1]
print(sol)


h = int(input())
b = input()
a = []
for i in range(len(b) - 1):
	a.append(b[i] + b[i + 1])
c = []
for i in range(len(a)):
	c.append([a.count(a[i]), a[i]])
c = sorted(c)
print(c[-1][1])


n = int(input())
s = str(input())
ans = {}
for i in range(n - 1):
	if s[i:i + 2] not in ans:
		ans[s[i:i + 2]] = 1
	else:
		ans[s[i:i + 2]] += 1
maxx = 0
maxx_ans = ''
for k in ans.keys():
	if maxx < ans[k]:
		maxx = ans[k]
		maxx_ans = k
print(maxx_ans)


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])


from collections import Counter
n = int(input())
s = str(input())
last = s[0]
two_grams = []
for i in range(1, n):
	two_grams.append(last + s[i])
	last = s[i]
c = Counter(two_grams)
most_common_gram = c.most_common(1)
print(most_common_gram[0][0])


input()
str = input()
jsp = dict()
for i in range(len(str) - 1):
	tmp = str[i] + str[i + 1]
	jsp[tmp] = jsp.get(tmp, 0) + 1
print(max(jsp, key=jsp.get))


def seqFind(arr, n):
	seqList = list()
	for i in range(len(arr) - 1):
		seqList.append(''.join(arr[i:i + 2]))
	return seqList
input()
s = list(input())
seqS = seqFind(s, 2)
freq = {}
for e in seqS:
	if e in freq:
		freq[e] += 1
	else:
		freq[e] = 1
bestF = 0
best = 0
for f in freq:
	if bestF < freq[f]:
		bestF = freq[f]
		best = f
print(best)


n = int(input())
s = input()
d = {}
for i in range(n - 1):
	t = s[i] + s[i + 1]
	if t in d.keys():
		d[t] += 1
	else:
		d[t] = 1
print(sorted(d.items(), key=lambda x: x[1], reverse=True)[0][0])


x = int(input())
y = input()
z = {}
for i in range(x - 1):
	if y[i:i + 2] in z:
		z[y[i:i + 2]] += 1
	else:
		z[y[i:i + 2]] = 0
maxv = 0
for v in z:
	if z[v] >= maxv:
		maxv = z[v]
		maxw = v
print(maxw)


tam = int(input())
string = input()
matriz = []
tam = tam - 1
for i in range(tam):
	matriz.append([0] * 2)
tam_m = 1
for x in range(tam):
	gram = string[x] + string[x + 1]
	achou = 1
	for y in range(tam_m):
		if achou:
			if matriz[y][0] == 0:
				matriz[y][0] = gram
				matriz[y][1] = 1
				tam_m = tam_m + 1
			elif gram == matriz[y][0]:
				matriz[y][1] = matriz[y][1] + 1
				achou = 0
qmax = 0
for z in range(tam_m - 1):
	if matriz[z][1] > qmax:
		qmax = matriz[z][1]
		maxgram = matriz[z][0]
print(maxgram)


import os
import sys
n = int(input())
s = input()
r = {}
for i in range(n - 1):
	j = i + 1
	if s[i:j + 1] not in r:
		r[s[i:j + 1]] = 1
	else:
		r[s[i:j + 1]] += 1
max = 1
mk = s[0:2]
for k in r:
	if r[k] > max:
		max = r[k]
		mk = k
print(mk)


n = int(input())
vet = input()
dic = {}
for i in range(n):
	if n - i > 1:
		latin = vet[i] + vet[i + 1]
		if latin in dic:
			dic[latin] += 1
		else:
			dic[latin] = 1
maior = 0
for x in dic:
	if dic[x] > maior:
		maior = dic[x]
		latin = x
print(latin)


n = int(input())
string = input()
s = list(string)
dic = {}
two_gram = []
i = 0
while i <= n - 2:
	aux = s[i] + s[i + 1]
	if aux in dic:
		dic[aux] += 1
	else:
		two_gram.append(aux)
		dic[aux] = 1
	i += 1
aux = two_gram[0]
for i in two_gram:
	if dic[i] > dic[aux]:
		aux = i
print(aux)


n = int(input())
str = input()
dic = {}
for i in range(len(str) - 1):
	if str[i:i + 2] not in dic.keys():
		dic[str[i:i + 2]] = 1
	else:
		dic[str[i:i + 2]] += 1
itemax = max(dic.items(), key=lambda x: x[1])
print(itemax[0])


from collections import Counter
n = int(input())
s = input()
ns = []
for x in range(n - 1):
	ns.append(s[x] + s[x + 1])
fs = Counter(ns)
mx = max(fs.values())
for x in fs.keys():
	if fs[x] == mx:
		print(x)
		exit()


a = int(input())
s = str(input())
li = []
for i in range(0, a - 1):
	li.append(s[i] + s[i + 1])
print(max(li, key=li.count))


n = int(input())
s = input()
arr = []
for i in range(n - 1):
	arr.append(s[i:i + 2])
m = 0
ans = ''
for i in range(n - 1):
	c = arr.count(s[i:i + 2])
	if c > m:
		m = c
		ans = s[i:i + 2]
print(ans)


a = int(input())
b = input()
i = 0
k = 0
j = 0
for i in range(a - 2):
	d = b
	c = b[i] + b[i + 1]
	m = 1
	k1 = 0
	while m != -1:
		m = d.find(c)
		if m >= 0:
			k1 += 1
		d = d[m + 1:]
	if k1 > k:
		k = k1
		j = i
print(b[j] + b[j + 1])


kol = int(input())
a = input()
variants = []
bilo = False
for i in range(0, kol - 1):
	for var in variants:
		if a[i:i + 2] == var[0]:
			bilo = True
			var[1] += 1
			break
	if not bilo:
		variants.append([str(a[i:i + 2]), 1])
	bilo = False
n = 1
while n < len(variants):
	for i in range(len(variants) - n):
		if variants[i][1] > variants[i + 1][1]:
			(variants[i], variants[i + 1]) = (variants[i + 1], variants[i])
	n += 1
print(variants[-1][0])


import re

def count_substrings(string, substring):
	return len(re.findall('(?=(%s))' % re.escape(substring), string))
(n, s) = (int(input()), input())
print(max([(count_substrings(s, s[i] + s[i + 1]), s[i] + s[i + 1]) for i in range(n - 1)])[1])


(z, zz) = (input, lambda : list(map(int, z().split())))
zzz = lambda : [int(i) for i in stdin.readline().split()]
(szz, graph, mod, szzz) = (lambda : sorted(zz()), {}, 10 ** 9 + 7, lambda : sorted(zzz()))
from string import *
from re import *
from collections import *
from queue import *
from sys import *
from collections import *
from math import *
from heapq import *
from itertools import *
from bisect import *
from collections import Counter as cc
from math import factorial as f
from bisect import bisect as bs
from bisect import bisect_left as bsl
from itertools import accumulate as ac

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def prime(x):
	p = ceil(x ** 0.5) + 1
	for i in range(2, p):
		if x % i == 0 and x != 2 or x == 0:
			return 0
	return 1

def dfs(u, visit, graph):
	visit[u] = True
	for i in graph[u]:
		if not visit[i]:
			dfs(i, visit, graph)
n = int(z())
l = z()
s = l[:2]
ans = 0
for i in range(n - 2):
	p = l[i:i + 2]
	t = 0
	for j in range(n):
		if p == l[j:j + 2]:
			t += 1
	if t > ans:
		s = p
		ans = t
print(s)


n = int(input())
s = input()
hashi = dict()
for i in range(n - 1):
	z = s[i:i + 2]
	if z in hashi:
		hashi[z] += 1
	else:
		hashi[z] = 1
maxa = 0
ans = 0
for i in hashi:
	if hashi[i] > maxa:
		ans = i
		maxa = hashi[i]
print(ans)


import operator
n = int(input())
s = input()
dic = {}
for i in range(1, len(s)):
	x = s[i - 1:i + 1]
	if x in dic.keys():
		dic[x] += 1
	else:
		dic[x] = 1
print(max(dic, key=dic.get))


n = int(input())
s = input()
w = []
a = []
a = [0] * (n - 1)
w = ['  '] * (n - 1)
for i in range(n - 1):
	w[i] = s[i:i + 2]
for i in range(n - 1):
	k = w[i]
	l = 0
	for j in range(n - 1):
		if k == w[j]:
			l += 1
	a[i] = l
amax = 0
for i in range(n - 1):
	if a[i] > amax:
		amax = a[i]
		p = w[i]
print(p)


_ = input()
l = input()
pair = ''
pair_count = 0
for i in range(len(l) - 1):
	p = l[i] + l[i + 1]
	c = 0
	for i in range(len(l) - 1):
		if l[i:i + 2] == p:
			c += 1
	if c > pair_count:
		pair = p
		pair_count = c
print(pair)


def fn(string, substring):
	count = 0
	start = 0
	while start < len(string):
		flag = string.find(substring, start)
		if flag != -1:
			start = flag + 1
			count += 1
		else:
			return count
n = int(input())
s = input()
ans = ''
max1 = 0
start = 0
for i in range(0, n - 1):
	a = s[i:i + 2]
	c = fn(s, a)
	if c > max1:
		max1 = c
		ans = a
print(ans)


n = int(input())
s = input()
maxCount = []
maxTwoGram = []
for i in range(len(s) - 1):
	count = 0
	twoGram = ''
	for j in range(len(s) - 1):
		if s[j] == s[i] and s[j + 1] == s[i + 1]:
			count += 1
	maxCount.append(count)
	maxTwoGram.append(s[i] + s[i + 1])
max_count = maxCount[0]
l = [maxTwoGram[0]]
for i in range(1, len(maxCount)):
	if max_count < maxCount[i]:
		max_count = maxCount[i]
		l[0] = maxTwoGram[i]
print(l[0])


n = int(input())
s = input()
d = dict()
opt = ''
c = 0
for i in range(n - 1):
	dg = s[i:i + 2]
	if dg in d:
		d[dg] += 1
	else:
		d[dg] = 1
	if d[dg] > c:
		c = d[dg]
		opt = dg
print(opt)


n = int(input())
s = input()
list = {}
for i in range(n - 1):
	tg = s[i:i + 2]
	if tg in list:
		list[tg] += 1
	else:
		list[tg] = 1
print(max(list.keys(), key=lambda k: list[k]))


count = int(input())
chars = input()
counts = {}
for i in range(0, len(chars) - 1):
	substr = chars[i:i + 2]
	counts[substr] = 1 + (counts[substr] if substr in counts else 0)
m = 0
for (k, v) in counts.items():
	if v > m:
		m = v
		r = k
print(r)


length = int(input())
s = input()
tg = {}
for i in range(length - 1):
	key = s[i] + s[i + 1]
	if key in tg:
		tg[key] = tg[key] + 1
	else:
		tg[key] = 1
s = [(k, tg[k]) for k in sorted(tg, key=tg.get, reverse=True)]
print(s[0][0])


n = int(input())
s = input()
l = []
for i in range(len(s)):
	for j in range(i + 1, len(s) + 1):
		r = s[i:j]
		if len(r) == 2:
			l.append(r)
mx = -1
res = ''
for i in l:
	if l.count(i) > mx:
		mx = l.count(i)
		res = i
print(res)


n = int(input())
s = input()
ls = []
for i in range(26):
	for j in range(26):
		ls.append([s.count(chr(65 + i) + chr(65 + j)), chr(65 + i) + chr(65 + j)])
ls.sort(reverse=True)
print(ls[0][1])


n = int(input())
string = input()
t = string[0]
countTemp = 0
count = 0
stringFinal = ''
for i in range(1, n):
	t += string[i]
	t = t[-2] + t[-1]
	temp = string[i - 1]
	for j in range(i, n):
		temp += string[j]
		temp = temp[-2] + temp[-1]
		if temp == t:
			countTemp += 1
	if countTemp > count:
		count = countTemp
		stringFinal = t
	countTemp = 0
print(stringFinal)


n = int(input())
s = input()
d = {}
for i in range(n - 1):
	t = s[i] + s[i + 1]
	if t in d:
		d[t] += 1
	else:
		d[t] = 1
print(sorted(d, key=d.get)[-1])


n = int(input())
s = input()
max_s = s[0] + s[1]
max_times = -1
for i in range(len(s) - 1):
	p = s[i] + s[i + 1]
	c = 0
	for j in range(len(s) - 1):
		if s[j] + s[j + 1] == p:
			c += 1
	if c > max_times:
		max_times = c
		max_s = s[i] + s[i + 1]
print(max_s)


from collections import Counter
n = int(input())
s = input()
c = list()
for i in range(n - 1):
	c.append(s[i] + s[i + 1])
counter = Counter(c)
print(counter.most_common(1)[0][0])


n = int(input())
s = input()
ss = set(list(s))

def occurrences(string, sub):
	count = start = 0
	while True:
		start = string.find(sub, start) + 1
		if start > 0:
			count += 1
		else:
			return count
mxn = 0
ans = ''
for a in ss:
	for b in ss:
		nn = occurrences(s, a + b)
		if nn > mxn:
			mxn = nn
			ans = a + b
print(ans)


n = int(input())
s = input()
di = {}
for i in range(n - 1):
	tmp = s[i:i + 2]
	if tmp not in di:
		di[tmp] = 0
	di[tmp] += 1
li = list(di.items())
li.sort(key=lambda x: -x[1])
print(li[0][0])


n = input()
s = str(input())
a = []
d = {}
st = []
for i in range(1, len(s)):
	a.append(s[i - 1] + s[i])
for j in range(len(a)):
	d.update({a[j]: a.count(a[j])})
mx = max(d, key=d.get)
print(mx)


a = {}
n = int(input())
str = input()
for i in range(n - 1):
	s = str[i] + str[i + 1]
	if s in a:
		a[s] += 1
	else:
		a[s] = 1

def fun(m):
	keys = m.keys()
	values = m.values()
	lst = [(key, val) for (key, val) in zip(keys, values)]
	return lst
m = sorted(fun(a), key=lambda x: x[1], reverse=True)
print(m[0][0])


n = int(input())
s = str(input())
ans = dict()
for i in range(n - 1):
	curr = s[i]
	next = s[i + 1]
	tans = curr + next
	if tans in ans.keys():
		ans[tans] += 1
	else:
		ans[tans] = 0
t = -1
a = ''
for x in ans.keys():
	if ans[x] > t:
		t = ans[x]
		a = x
print(a)


t = int(input())
s = input()
di = {}
n = len(s)
for i in range(n - 1):
	if s[i] + s[i + 1] not in di:
		di[s[i] + s[i + 1]] = 1
	else:
		di[s[i] + s[i + 1]] += 1
mini = 0
for (k, v) in di.items():
	if v > mini:
		mini = v
		ans = k
print(ans)


n = int(input())
a = input()
k = [a[i:i + 2] for i in range(n - 1)]
print(max(k, key=k.count))


n = int(input())
s = input()
res = int(0)
s_res = ''
for i in range(1, n):
	curr = s[i - 1:i + 1]
	ct = int(0)
	for j in range(i, n):
		ss = s[j - 1:j + 1]
		if ss == curr:
			ct = ct + 1
	if ct > res:
		res = ct
		ss_res = curr
print(ss_res)


n = int(input())
m = input()
a = []
for i in range(n - 1):
	a.append([m.count(m[i] + m[i + 1]), m[i] + m[i + 1]])
a.sort()
print(a[-1][1])


n = int(input())
k = str(input())
Max = 0
for i in range(n - 1):
	t = k[i] + k[i + 1]
	z = 0
	for j in range(0, n - 1):
		s = k[j] + k[j + 1]
		if s == t:
			z = z + 1
	if z > Max:
		Max = z
		res = t
print(res)


t = 1
while t:
	t -= 1
	n = int(input())
	s = input()
	maxi = 0
	store = ''
	for i in range(len(s) - 1):
		gram = s[i:i + 2]
		cnt = 0
		for j in range(len(s) - 1):
			if gram == s[j:j + 2]:
				cnt += 1
				if cnt > maxi:
					maxi = cnt
					store = gram
	print(store)


n = int(input())
s = input()
l = []
for i in range(n):
	if s[i:i + 2] not in l and len(s[i:i + 2]) == 2:
		l.append(s[i:i + 2])
l1 = []
for i in l:
	c = 0
	for j in range(n):
		if i == s[j:j + 2]:
			c += 1
	l1.append([c, i])
maxi = l1[0][0]
a = l1[0][1]
for i in range(1, len(l1)):
	if maxi <= l1[i][0]:
		maxi = l1[i][0]
		a = l1[i][1]
print(a)


input()
tempstr = input()
tempdict = dict()
for i in range(0, len(tempstr) - 1, 1):
	tempdict[tempstr[i:i + 2]] = tempdict.get(tempstr[i:i + 2], 0) + 1
temp = None
ans = None
for item in tempdict:
	if temp is None or tempdict[item] > temp:
		temp = tempdict[item]
		ans = item
print(ans)


leng = int(input())
value = input()
max = 0
count = 0
k = 0
al = ''
pair = ''
word = []
for i in range(leng - 2):
	k = 0
	count = 0
	word = ''.join(value[i:i + 2])
	while k != leng - 1:
		new_word = ''.join(value[k:k + 2])
		if new_word == word:
			count += 1
			al = new_word
		k += 1
	if count > max:
		pair = al
		max = count
if leng == 2:
	pair = value
print(pair)


n = int(input())
s = input()
maxim = 0
for i in range(n - 1):
	tempstr = s[i:i + 2]
	temp = 0
	for j in range(n):
		if s[j:j + 2] == tempstr:
			temp += 1
	if temp > maxim:
		maxim = temp
		res = s[i:i + 2]
print(res)


from collections import Counter
input()
s = input()
print(''.join(Counter(zip(s, s[1:])).most_common(1)[0][0]))


from sys import stdin, stdout
from math import gcd, ceil, sqrt
ii1 = lambda : int(stdin.readline().strip())
is1 = lambda : stdin.readline().strip()
iia = lambda : list(map(int, stdin.readline().strip().split()))
isa = lambda : stdin.readline().strip().split()
mod = 1000000007

def occurrences(string, sub):
	count = start = 0
	while True:
		start = string.find(sub, start) + 1
		if start > 0:
			count += 1
		else:
			return count
n = ii1()
s = is1()
search = set()
for i in range(1, len(s)):
	search.add(s[i - 1:i + 1])
res = []
for i in search:
	res.append([occurrences(s, i), i])
res.sort(reverse=True)
print(res[0][1])


n = int(input())
c = []
d = []
s = str(input())
for i in range(n - 1):
	d.append(s[i] + s[i + 1])
c = list(set(d))
m = 0
a = ''
for i in range(len(c)):
	if d.count(c[i]) > m:
		m = d.count(c[i])
		a = c[i]
print(a)


n = int(input())
s = input()
cnt = 0
ans = ''
for i in range(n - 1):
	sub = s[i] + s[i + 1]
	cnt2 = 0
	for j in range(n - 1):
		if s[j] + s[j + 1] == sub:
			cnt2 += 1
	if cnt2 >= cnt:
		ans = sub
		cnt = cnt2
print(ans)


n = int(input())
s = input()
count = {}
for i in range(n - 1):
	if s[i:i + 2] in count:
		count[s[i:i + 2]] += 1
	else:
		count[s[i:i + 2]] = 1
print(list(sorted(count.items(), key=lambda x: x[1]))[-1][0])


n = int(input())
str = input()
count = [0 for i in range(n)]
array = []
a = 0
while a + 1 < n:
	if str[a] + str[a + 1] in array:
		index = array.index(str[a] + str[a + 1])
		count[index] += 1
	else:
		array.append(str[a] + str[a + 1])
	a += 1
print(array[count.index(max(count))])


import sys, math
m = int(sys.stdin.readline())
chaine = sys.stdin.readline()
seen = list()
for loop in range(m - 1):
	b = chaine[loop] + chaine[loop + 1]
	if b in seen:
		seen[seen.index(b) + 1] += 1
	else:
		seen.append(b)
		seen.append(1)
maxi = 0
i = 0
for loop in range(1, len(seen), 2):
	if seen[loop] > maxi:
		maxi = seen[loop]
		i = loop
print(seen[i - 1])


n = int(input())
s = input()
f = []
s = list(s)
for i in range(0, len(s) - 1):
	k = s[i] + s[i + 1]
	f.append(k)
f_count = []
for j in range(0, len(f)):
	count = 0
	for k in range(0, len(f)):
		if f[j] == f[k]:
			count += 1
		else:
			continue
	f_count.append(count)
print(f[f_count.index(max(f_count))])


input()
s = input()
count = {}
for i in range(len(s) - 1):
	x = s[i:i + 2]
	count[x] = count.get(x, 0) + 1
print(max(count.items(), key=lambda x: x[1])[0])


n = int(input())
s = input()
best_count = 0
for i in range(n - 1):
	substr = s[i:i + 2]
	pos = s.find(substr, 0)
	count = 0
	while pos != -1:
		count += 1
		pos = s.find(substr, pos + 1)
	if count > best_count:
		ans = substr
		best_count = count
print(ans)


a = int(input())
b = str(input())
c = 0
d = 0
e = []
f = []
m = []
n = 0
k = 0
for i in range(len(b) - 1):
	c = b[i] + b[i + 1]
	f.append(c)
m = list(set(f))
for i in range(len(m)):
	for j in range(len(f)):
		if m[i] == f[j]:
			d += 1
	e.append(d)
	d = 0
for i in range(len(e)):
	if e[i] > n:
		n = e[i]
		k = i
print(m[k])


import re
i = input
i()
a = i()
print(max(map(lambda x: ''.join(x), zip(a, a[1:])), key=lambda x: len(re.findall('(?=' + x + ')', a))))


n = input()
s = input()
n = int(n)
dic = {}
for i in range(1, n):
	st = s[i - 1] + s[i]
	if st in dic:
		dic[st] += 1
	else:
		dic[st] = 1
maxtime = 0
key = ''
for i in dic:
	if maxtime < dic[i]:
		maxtime = dic[i]
		key = i
print(key)


n = int(input())
a = input()
m = 0
d = ''
z = 0
for i in range(n - 1):
	k = a[i:i + 2]
	for j in range(n - 1):
		if a[j:j + 2] == k:
			z += 1
	if z >= m:
		m = z
		d = k
	z = 0
print(d)


input()
s = str(input())
d = []
e = []
for i in range(len(s) - 1):
	if s[i] + s[i + 1] not in d:
		d.append(str(s[i] + s[i + 1]))
		e.append(1)
	else:
		e[d.index(str(s[i] + s[i + 1]))] += 1
print(d[e.index(max(e))])


input()
s = input()
l = list(map(lambda x: ''.join(x), zip(s, s[1:])))
print(max(l, key=l.count))


n = int(input())
string = input()
dic = {}
twogram = None
for i in range(n - 1):
	twogram = string[i:i + 2]
	if string[i:i + 2] in dic:
		dic[twogram] += 1
	else:
		dic[twogram] = 1
nbMax = 0
twoGramMax = ''
for elem in dic:
	if dic.get(elem) > nbMax:
		nbMax = dic.get(elem)
		twoGramMax = elem
print(twoGramMax)


n = int(input())
s = input()
from collections import defaultdict
cnt = defaultdict(int)
for i in range(n - 1):
	cnt[s[i:i + 2]] += 1
ans = 0
val = ''
for (key, value) in cnt.items():
	if value > ans:
		ans = value
		val = key
print(val)


number = int(input())
string = input().strip()
count = 1
sl = []
while count < number:
	s = string[count - 1] + string[count]
	sl.append(s)
	count += 1
result = []
for m in sl:
	ca = 0
	for n in sl:
		if m == n:
			ca += 1
	result.append(ca)
ab = max(result)
abb = result.index(ab)
print(sl[abb])


n = int(input())
s = input()
a = []
for i in range(n - 1):
	a.append(s[i:i + 2])
curr = 1
ans = a[0]
for i in range(len(a)):
	temp = a.count(a[i])
	if temp > curr:
		curr = temp
		ans = a[i]
print(ans)


from collections import Counter
input()
l = input()
s = Counter()
for i in range(len(l) - 1):
	s[l[i:i + 2]] += 1
print(s.most_common(1)[0][0])


n = int(input())
a = input()
d = {}
tmp = ''
for i in range(n - 1):
	tmp = a[i] + a[i + 1]
	d.setdefault(tmp, 0)
	d[tmp] += 1
mx = max(d.values())
for i in d:
	if d[i] == mx:
		print(i)
		break


n = input()
n = int(n)
s = input()
k = s[0] + s[1]
a = []
b = []
o = 0
for i in range(n - 1):
	k = s[o] + s[o + 1]
	o += 1
	if k in a:
		b[a.index(k)] += 1
	else:
		a.append(k)
		b.append(1)
g = 0
j = 0
for i in range(len(b)):
	if g < b[i]:
		g = b[i]
		j = i
print(a[j])


s = input()
s = input()
d = dict()
for i in range(1, len(s)):
	temp = ''
	temp = s[i - 1] + s[i]
	if temp in d:
		d[temp] += 1
	else:
		d[temp] = 0
		d[temp] += 1
maxkey = 0
maxvalue = 0
for (key, value) in d.items():
	if value > maxvalue:
		maxvalue = value
		maxkey = key
print(maxkey)


from collections import Counter
(n,) = map(int, input().split())
s = input()
cnt = Counter()
for i in range(n - 1):
	cnt[s[i:i + 2]] += 1
items = sorted(cnt.items(), key=lambda t: -t[1])
print(items[0][0])


n = int(input())
s = input()
d = dict()
for i in range(len(s) - 1):
	d[s[i] + s[i + 1]] = d.get(s[i] + s[i + 1], 0) + 1
maxi = 0
for i in d:
	if d[i] > maxi:
		maxi = d[i]
		l = i
print(l)


n = int(input())
s = input()
dic = dict()
for i in range(26):
	a = chr(ord('A') + i)
	for j in range(26):
		b = chr(ord('A') + j)
		dic[a + b] = 0
for i in range(n - 1):
	j = i + 1
	dic[s[i] + s[j]] += 1
m = max(dic.values())
for i in dic:
	if dic[i] == m:
		print(i)
		break


n = int(input())
s = input()
ans = ''
k = 0
for i in range(n - 1):
	temps = s[i] + s[i + 1]
	tempk = 1
	for j in range(i + 1, n - 1):
		if s[j] + s[j + 1] == temps:
			tempk += 1
	if tempk > k:
		(k, ans) = (tempk, temps)
print(ans)


from collections import Counter
n = int(input())
s = str(input())
li = []
for i in range(n - 1):
	li.append((s[i], s[i + 1]))
a = Counter(li).most_common()[0]
print(a[0][0] + a[0][1])


from collections import Counter
n = int(input())
s = input()
count = 0
split_s = []
for i in range(0, len(s)):
	split_s.append(s[i:i + 2])
count = Counter(split_s)
print(count.most_common(1)[0][0])


n = int(input())
s = input()
from collections import defaultdict
d = defaultdict(lambda : 0)
for i in range(n - 1):
	d[s[i] + s[i + 1]] += 1
m = max(d.values())
for (k, v) in d.items():
	if v == m:
		print(k)
		break


n = int(input())
s = input()
b = [s[i:i + 2] for i in range(0, n - 1)]
a = list(set(b))
max = ''
m = 0
for i in a:
	if b.count(i) > m:
		max = i
		m = b.count(i)
print(max)


length = int(input())
myString = input()
myList = list(myString)
myNumberList = []
myWordList = []
for index in range(0, length - 1):
	myDouble = myList[index] + myList[index + 1]
	if myDouble in myWordList:
		x = myWordList.index(myDouble)
		myNumberList[x] += 1
	else:
		myNumberList.append(1)
		myWordList.append(myDouble)
myNumberList2 = myNumberList[:]
myNumberList2.sort()
myNumberList2.reverse()
aye = myNumberList.index(myNumberList2[0])
print(myWordList[aye])


length = int(input())
string = input()
a = {}
for i in range(len(string) - 1):
	a[string[i:i + 2]] = 0
for i in range(len(string) - 1):
	a[string[i:i + 2]] += 1
max = 0
for i in a:
	if a[i] > max:
		max = a[i]
		ans = i
print(ans)


(n, s) = (int(input()), input())
arr = []
for i in range(n - 1):
	arr.append(s[i:i + 2])

def task(arr):
	(c, chr) = (0, arr[0])
	for i in arr:
		if arr.count(i) > c:
			c = arr.count(i)
			chr = i
	return chr
print(task(arr))


n = int(input())
p = input()
cnt = dict()
for i in range(n - 1):
	try:
		cnt[p[i:i + 2]] += 1
	except KeyError:
		cnt[p[i:i + 2]] = 1
print(sorted(cnt, key=cnt.get, reverse=True)[0])


n = int(input())
s = input()
dct = dict()
cs = ''
count = 0
for i in range(n - 1):
	try:
		dct[s[i:i + 2]] += 1
	except KeyError:
		dct[s[i:i + 2]] = 1
	if dct[s[i:i + 2]] > count:
		count = dct[s[i:i + 2]]
		cs = s[i:i + 2]
print(cs)


import collections
import sys

def twograms(s):
	pairs = collections.defaultdict(int)
	for i in range(len(s) - 1):
		pairs[s[i:i + 2]] += 1
	return max(pairs, key=lambda x: pairs[x])
sys.stdin.readline()
s = sys.stdin.readline()
print(twograms(s))


def anss():
	N = int(input())
	A = input()
	ans = []
	for i in range(1, N):
		ans += [A[i - 1] + A[i]]
	ans = sorted(ans)
	a = 1
	shit = []
	for j in range(len(ans) - 1):
		if ans[j] == ans[j + 1]:
			a += 1
		else:
			shit += [a]
			a = 1
	if ans[len(ans) - 1] == ans[len(ans) - 2]:
		shit += [a]
	b = 0
	for i in range(len(shit)):
		b += shit[i]
		if shit[i] == max(shit):
			break
	print(ans[b - 1])
anss()


n = int(input())
string = input()
cur = ''
maxn = 0
for i in range(n - 1):
	curi = string[i:i + 2]
	p = 0
	for j in range(i, n - 1):
		if string[j] + string[j + 1] == curi:
			p += 1
			if p > maxn:
				maxn = p
				cur = curi
print(cur)


a = int(input())
b = str(input())
c = []
x = int(0)
while x < a - 1:
	c.append(b[x:x + 2])
	x = x + 1
print(max(set(c), key=c.count))


def substring(s, c='', i=0):
	if len(s) > 2:
		for x in range(len(s) - 1):
			if s[x:x + 2] in d:
				d[s[x:x + 2]] += 1
			else:
				d[s[x:x + 2]] = 1
	else:
		d[s] = 1
n = int(input())
string = input()
d = {}
key = ''
value = 0
substring(string)
for x in d:
	if d[x] > value:
		key = x
		value = d[x]
print(key)


n = input()
s = input()
ng = {}
max_ = 0
max_v = None
for i in range(1, len(s)):
	ngram = s[i - 1] + s[i]
	ng[ngram] = ng.get(ngram, 0) + 1
	if ng[ngram] > max_:
		max_v = ngram
		max_ = ng[ngram]
print(max_v)


def solve(n, s):
	twos = {}
	for i in range(0, n):
		curr = s[i:i + 2]
		if len(curr) < 2:
			break
		f = twos.get(curr, 0)
		twos[curr] = f + 1
	m = max(twos, key=lambda f: twos[f])
	return m
n = int(input())
s = input()
print(solve(n, s))


n = int(input())
s = input()
sans = ''
ans = 0
for i in range(n - 1):
	t = 0
	for j in range(n - 1):
		if s[i:i + 2] == s[j:j + 2]:
			t += 1
	if t > ans:
		sans = s[i:i + 2]
		ans = t
print(sans)


def count(s, g):
	res = 0
	for i in range(len(s) - 1):
		if s[i:i + 2] == g:
			res += 1
	return res
n = int(input())
s = input()
grams = [s[i:i + 2] for i in range(n - 1)]
best = 0
ans = grams[0]
for g in grams:
	x = count(s, g)
	if x > best:
		best = x
		ans = g
print(ans)


n1 = int(input())
s = input()
lis = []
count = []
Max = 0
for i in range(n1):
	lis.append(s[i:i + 2])
	count.append(0)
for j in range(n1):
	for i in range(n1 - 1):
		if lis[j] == s[i:i + 2]:
			count[j] += 1
			if count[j] > Max:
				Max = count[j]
				ans = lis[j]
print(ans)


n = int(input())
s1 = input()
dict1 = {}
for i in range(n - 1):
	s = s1[i] + s1[i + 1]
	if s not in dict1:
		dict1[s] = 1
	else:
		dict1[s] += 1
l1 = list(dict1.values())
l2 = list(dict1.keys())
print(l2[l1.index(max(l1))])


a = int(input())
b = input()
l = []
dis = {}
for x in range(0, a - 1):
	sub = b[x:x + 2]
	l.append(sub)
	c = l.count(sub)
	dis[sub] = c
Keymax = max(dis, key=dis.get)
print(Keymax)


t = int(input())
s = input()
dict_s = dict()
for ind in range(len(s) - 1):
	s_ind = s[ind:ind + 2]
	if not s_ind in dict_s:
		dict_s[s_ind] = 1
	else:
		dict_s[s_ind] += 1
print(max(dict_s, key=dict_s.get))


import collections
import operator
n = int(input())
word = input()
n_grams = collections.defaultdict(int)
for i in range(n - 1):
	n_grams[word[i:i + 2]] += 1
ordered_dict = sorted(n_grams.items(), key=operator.itemgetter(1), reverse=True)
print(ordered_dict[0][0])


import sys

def rr():
	return sys.stdin.readline().rstrip()

def rri():
	return int(rr())

def rrl():
	return list(map(int, rr().split()))

def rrt():
	return tuple(map(int, rr().split()))

def rrle():
	return (line.rstrip() for line in sys.stdin.readlines())

def rrtl():
	return [tuple(map(int, l.split())) for l in rrle()]
from collections import defaultdict

def mus(d=lambda : 0):
	return defaultdict(lambda : defaultdict(d))

def dd0(d=lambda : 0):
	return defaultdict(d)

def ms(x, y, d=0):
	return [[0] * y for i in range(x)]

def ar(x, d=0):
	return [d] * x

def ppm(m, n=0, x=0, y=0):
	print('\n'.join(('\t'.join((str(m[j][i]) for j in range(y or n))) for i in range(x or n))))

def ppa(a, n):
	print('\t'.join(map(str, a[0:n])))

def ppl(a=0, x=[1]):
	x[0] = a or x[0] + 1
	print('-' + '- -' * 14 + '-# ' + str(x[0] - 2) + ' #-' + '- -' * 14 + '-')

def fltn(a):
	(i for sub in a for i in sub)

def yn(x):
	return 'YES' if x else 'NO'
from itertools import accumulate
from itertools import groupby

def grp(x, key=None):
	return ((i, sum((1 for _ in g))) for (i, g) in groupby(x, key=key))
import math

def rnar():
	return (*rrl(), rrl())

def rn():
	return (*rrl(),)

def dpp(a, b=''):
	print('#| {} |#:^ {} ^:'.format(a, b))
MOD17 = 10 ** 9 + 7

def read():
	return (rri(), rr())
	return (0,)

def solve(n, s):
	pairs = list(zip(s, s[1:]))
	pairs.sort()
	cm = 0
	cp = ''
	for (i, num) in grp(pairs):
		if num > cm:
			cp = i
			cm = num
	ans = cp[0] + cp[1]
	return ans
test_count = 1
for _ in range(test_count):
	input_data = read()
	result = solve(*input_data)
	print(result)


n = int(input())
s = input()
d = dict()
x = []
for i in s:
	x.append(i)
for i in range(n - 1):
	q = ''
	q += s[i]
	q += s[i + 1]
	if q not in d:
		d[q] = 1
	else:
		d[q] += 1
index = ''
maximum = 0
for i in d:
	if d[i] > maximum:
		(maximum, index) = (d[i], i)
print(index)


from collections import defaultdict
input()
s = input()
d = defaultdict(int)
for i in range(len(s) - 1):
	d[s[i:i + 2]] += 1
tmp = list(d.items())
tmp.sort(key=lambda x: x[1], reverse=True)
print(tmp[0][0])


a = input()
n = input()
l = [n[i:i + 2] for i in range(len(n))]
m = {}
for i in range(len(l)):
	m[i] = l.count(l[i])
n = max(m, key=lambda i: m[i])
print(l[n])


n = int(input())
s = input()
maxTwoGram = ''
maxTwoGramCount = 0
for i in range(n - 1):
	twoGram = s[i:i + 2]
	twoGramCount = 0
	for j in range(n - 1):
		if twoGram == s[j:j + 2]:
			twoGramCount += 1
	if maxTwoGramCount < twoGramCount:
		maxTwoGramCount = twoGramCount
		maxTwoGram = twoGram
print(maxTwoGram)


n = int(input())
s = input()
count_list = list()
count_list.append([s[0] + s[1], 1])
pop = 0
for i in range(1, n - 1):
	count_list.append([s[i] + s[i + 1], 1])
	for k in range(i - pop):
		if count_list[i - pop][0] == count_list[k][0]:
			count_list[k][1] += 1
			count_list.remove(count_list[i - pop])
			pop += 1
			break
max_index = 0
for i in range(1, n - 1 - pop):
	if count_list[max_index][1] < count_list[i][1]:
		max_index = i
print(count_list[max_index][0])


n = int(input())
s = input()
dicti = {}
for i in range(len(s) - 1):
	if not s[i] + s[i + 1] in dicti:
		dicti[s[i] + s[i + 1]] = 1
	else:
		dicti[s[i] + s[i + 1]] += 1
dicti = sorted(dicti.items(), key=lambda x: x[1])
dicti.reverse()
print(dicti[0][0])


n = int(input())
str = input()
a = {}
for i in range(1, n):
	if str[i - 1] + str[i] in a:
		a[str[i - 1] + str[i]] += 1
	else:
		a[str[i - 1] + str[i]] = 1
max = -1
for i in a:
	if a[i] > max:
		max = a[i]
for i in a:
	if a[i] == max:
		print(i)
		break


n = int(input())
s = input()
a = []
for i in range(len(s)):
	a.append(s[i:i + 2])
a.pop()
count = 0
string = ''
strng = ''
for i in range(len(a)):
	strng = a[i]
	c = a.count(strng)
	if c > count:
		count = c
		string = strng
print(string)


n = int(input())
S = input()
D = dict()
for _ in range(n - 1):
	if S[_] + S[_ + 1] in D:
		D[S[_] + S[_ + 1]] += 1
	else:
		D[S[_] + S[_ + 1]] = 1
m = 0
for _ in D:
	if D[_] > m:
		u = _
		m = D[_]
print(u)


n = int(input())
s = input()
L = [s[x] + s[x + 1] for x in range(0, n - 1)]
best = 0
bests = ''
for a in L:
	if L.count(a) > best:
		best = L.count(a)
		bests = a
print(bests)


def main():
	n = int(input())
	str = input()
	dic = {}
	max = 0
	word = ''
	for i in range(len(str) - 1):
		gram = str[i:i + 2]
		if gram in dic:
			dic[gram] += 1
		else:
			dic[gram] = 1
		if dic[gram] > max:
			max = dic[gram]
			word = gram
	print(word)
main()


n = int(input())
s = input()
i = 0
d = {}
while i < n - 1:
	t = s[i:i + 2]
	if t in d.keys():
		d[t] += 1
	else:
		d.setdefault(t, 1)
	i += 1
c = 0
ans = ''
for x in d.keys():
	if d[x] > c:
		c = d[x]
		ans = x
print(ans)


input()
s = input()
temp = []
for (i, j) in zip(list(s[0:-1]), list(s[1:])):
	temp.append(i + j)
temp = sorted(temp)
counter = 1
m = 0
res = temp[0]
for i in range(len(temp) - 1):
	if temp[i] == temp[i + 1]:
		counter += 1
		if counter >= m:
			m = counter
			res = temp[i]
	else:
		counter = 1
print(res)


n = int(input())
s = input()
d = {}
for i in range(1, n):
	if s[i - 1] + s[i] not in d:
		d[s[i - 1] + s[i]] = 1
	else:
		d[s[i - 1] + s[i]] += 1
maxi = 0
m = ''
for i in d:
	if maxi < d[i]:
		maxi = d[i]
		m = i
print(m)


n = int(input())
if n == 2:
	print(input())
else:
	s = input()
	l = {}
	for i in range(n - 1):
		u = s[i:i + 2]
		if u in l:
			l[u] += 1
		else:
			l[u] = 1
	v = max(l.items(), key=lambda k: k[1])
	print(v[0])


n = int(input())
b = input()
dico = {}
for i in range(n - 1):
	if b[i] + b[i + 1] in dico:
		dico[b[i] + b[i + 1]] += 1
	else:
		dico[b[i] + b[i + 1]] = 0
maxi = 0
chaine = ''
for i in dico:
	if dico[i] >= maxi:
		maxi = dico[i]
		chaine = i
print(chaine)


n = int(input())
s = input()
a = []
m = 0
for i in range(len(s) - 1):
	a.append(s[i:i + 2])
for i in a:
	x = a.count(i)
	if m < x:
		m = x
		s = i
print(s)


n = int(input())
s = input()
tgr = {}
mx = 0
for i in range(n - 1):
	if s[i:i + 2] in tgr:
		tgr[s[i:i + 2]] += 1
		mx = max(mx, tgr[s[i:i + 2]])
	else:
		tgr[s[i:i + 2]] = 1
		mx = max(mx, tgr[s[i:i + 2]])
for i in tgr:
	if tgr[i] == mx:
		print(i)
		exit(0)


from collections import Counter

def grams(txt):
	counter = Counter()
	for i in range(len(txt) - 1):
		counter[txt[i:i + 2]] += 1
	return counter.most_common()[0][0]
input()
print(grams(input()))


n = int(input())
string = input()
grams = {}
for i in range(1, n):
	gram = string[i - 1] + string[i]
	if gram not in grams:
		grams[gram] = 1
	else:
		grams[gram] += 1
grams = sorted(grams, key=grams.get)
print(grams[-1])


counts = [[0] * 26 for _ in range(26)]
input()
s = input()
mi = (0, 0)
mv = 0
for (c1, c2) in zip(s, s[1:]):
	i1 = ord(c1) - ord('A')
	i2 = ord(c2) - ord('A')
	counts[i1][i2] += 1
	if counts[i1][i2] > mv:
		mv = counts[i1][i2]
		mi = (i1, i2)
print(chr(mi[0] + ord('A')) + chr(mi[1] + ord('A')))


import sys
from collections import defaultdict
input = sys.stdin.readline

def main():
	n = int(input())
	s = input().rstrip()
	d = defaultdict(lambda : 0)
	for i in range(n - 1):
		d[s[i:i + 2]] += 1
	best = 0
	ans = ''
	for (k, v) in d.items():
		if v > best:
			best = v
			ans = k
	print(ans)
main()


(a, x, s) = (int(input()), input(), [])
for i in range(a - 1):
	s.append(x[i:i + 2])
print(max(s, key=s.count))


qtd = input()
texto = input()
freq = {}
for i in range(1, len(texto)):
	sub = texto[i - 1:i + 1]
	if sub not in freq:
		freq[sub] = 0
	freq[sub] += 1
(maior_v, maior_s) = (0, '')
for f in freq:
	if freq[f] > maior_v:
		maior_v = freq[f]
		maior_s = f
print(maior_s)


n = int(input())
s = input()
dict = {}
for i in range(n - 1):
	temp = s[i] + s[i + 1]
	if temp not in dict:
		dict[temp] = 1
	else:
		dict[temp] += 1
maximum = max(dict, key=dict.get)
print(maximum)


n = int(input())
a = input()
b = {}
for i in range(n - 1):
	k = a[i] + a[i + 1]
	if k in b:
		b[k] += 1
	else:
		b[k] = 1
l = 0
for i in b:
	if b[i] > l:
		l = b[i]
		k = i
print(k)


n = int(input())
x = input()
y = []
j = 2
t = []
for i in range(n - 1):
	y.append(x[i:j])
	j += 1
for i in y:
	t.append(y.count(i))
print(y[t.index(max(t))])


n = int(input())
arr = list(input())
nums = []
for i in range(0, n):
	for j in range(i + 1, n):
		nums.append(arr[i] + arr[j])
		break
print(max(nums, key=nums.count))


n = int(input())
s = input()
x = []
for i in range(1, n):
	x.append(s[i - 1] + s[i])
w = list(set(x))
keys = []
values = []
for i in range(len(w)):
	values.append(x.count(w[i]))
	keys.append(w[i])
for i in range(len(w)):
	if values[i] == max(values):
		temp = keys[i]
		print(temp)
		break


max_count = 0
a = int(input())
b = input()
answer = ''
for i in range(a - 1):
	string = b[i:i + 2]
	count = 0
	for j in range(a - 1):
		string2 = b[j:j + 2]
		if string == string2:
			count += 1
	if count > max_count:
		answer = string
		max_count = count
print(answer)


print((lambda x: max([(x.count(i), i) for i in x]))((lambda s: [s[i:i + 2] for i in range(0, len(s) - 1)])(__import__('sys').stdin.read().split('\n')[1]))[1])


n = int(input())
s = input()
d = {}
ma = 0
for i in range(n - 1):
	s1 = s[i] + s[i + 1]
	if s1 in d:
		d[s1] += 1
	else:
		d[s1] = 1
	if d[s1] > ma:
		ma = d[s1]
		s2 = s1
print(s2)


n = int(input())
s = input()
d = {}
for i in range(len(s) - 1):
	d[s[i:i + 2]] = d.get(s[i:i + 2], 0) + 1
m = max(d.values())
for i in d:
	if d[i] == m:
		print(i)
		exit(0)


n = int(input())
s = input()
l = {}
i = 0
for i in range(len(s) - 1):
	ss = s[i] + s[i + 1]
	if ss in l:
		l[ss] = l[ss] + 1
	else:
		l[ss] = 1
ll = list(sorted(l.items(), key=lambda kv: (kv[1], kv[0])))
sss = str(ll[len(ll) - 1])
print(sss[2] + sss[3])


import sys
from itertools import *
from collections import *
input = sys.stdin.readline

def get_all_substrings(string):
	length = len(string)
	alist = []
	for i in range(length):
		for j in range(i, length):
			if len(string[i:j + 1]) == 2:
				alist.append(string[i:j + 1])
	return alist

def solve(s):
	lis = get_all_substrings(s)
	t = 0
	e = ''
	for (ele, time) in Counter(lis).items():
		if time > t:
			e = ''.join(ele)
			t = time
	print(e)
n = int(input())
s = str(input())
solve(s)


n = int(input())
s = input()
d = {}
for i in range(len(s) - 1):
	if s[i:i + 2] not in d:
		d[s[i:i + 2]] = 1
	else:
		d[s[i:i + 2]] += 1
m = 0
for i in d:
	if d[i] > m:
		z = i
		m = d[i]
print(z)


a = int(input())
s = input()
l = []
for i in range(a):
	l.append(s[i:i + 2])
l.pop(-1)
k = set(l)
max = 0
for i in k:
	if l.count(i) > max:
		max = l.count(i)
		p = i
print(p)


n = int(input())
s = input()
l = []
m = []
for i in range(n - 1):
	l.append(s[i] + s[i + 1])
t = list(set(l))
for i in range(len(t)):
	m.append(l.count(t[i]))
print(t[m.index(max(m))])


num = int(input())
string = input()
count = 0
maxi = 0
for i in range(num - 1):
	for x in range(i, num - 1):
		current = string[i] + string[i + 1]
		if current == string[x] + string[x + 1]:
			count += 1
	if count > maxi:
		maxi = count
		actual = current
	count = 0
print(actual)


import operator
n = int(input())
s = input()
two_gram_count = {}
for i in range(len(s) - 1):
	two_gram = s[i:i + 2]
	if not two_gram in two_gram_count:
		two_gram_count[two_gram] = 1
	else:
		two_gram_count[two_gram] += 1
argmax_two_gram = max(two_gram_count.keys(), key=lambda x: two_gram_count[x])
print(argmax_two_gram)


import sys
n = int(input())
letters = input()
two_gram = {}
last_char = letters[0]
for i in range(1, n):
	if last_char + letters[i] in two_gram:
		two_gram[last_char + letters[i]] += 1
	else:
		two_gram[last_char + letters[i]] = 1
	last_char = letters[i]
print(max(two_gram, key=lambda key: two_gram[key]))


d = dict()
n = int(input())
s = input()
for i in range(n - 1):
	t = s[i:i + 2]
	if t not in d.keys():
		d[t] = 0
	d[t] += 1
mmax = max(d.values())
for (key, val) in d.items():
	if val == mmax:
		print(key)
		break


import sys
input = sys.stdin.readline
l = int(input())
s = str(input())
occurenece = dict()
for i in range(0, len(s) - 2):
	if not occurenece.__contains__(f'{s[i]}{s[i + 1]}'):
		occurenece[f'{s[i]}{s[i + 1]}'] = 1
	else:
		occurenece[f'{s[i]}{s[i + 1]}'] = occurenece[f'{s[i]}{s[i + 1]}'] + 1
max_value = 0
max_index = 0
values = list(occurenece.values())
keys = list(occurenece.keys())
for i in range(len(values)):
	if values[i] > max_value:
		max_value = values[i]
		max_index = i
print(keys[max_index])


lenght = int(input())
word = input()
thisdict = {}
for i in range(lenght - 1):
	if word[i] + word[i + 1] not in thisdict:
		thisdict.update({word[i] + word[i + 1]: 1})
	else:
		thisdict[word[i] + word[i + 1]] += 1
dictsorted = sorted(thisdict.items(), key=lambda x: x[1], reverse=True)
print(dictsorted[0][0])


n = int(input())
s = input()
c = 0
ans = ''
res = 0
for i in range(n - 1):
	for j in range(n - 1):
		if s[i] == s[j] and s[i + 1] == s[j + 1]:
			c += 1
	if res < c:
		ans = s[i] + s[i + 1]
		res = c
	c = 0
print(ans)


n = int(input())
s = input()
cnt = len(s)
bilist = {}
for i in range(cnt - 1):
	bi = s[i] + s[i + 1]
	if bilist.get(bi) is not None:
		bilist[bi] += 1
	else:
		bilist[bi] = 1
print(max(bilist, key=lambda k: bilist[k]))


n = int(input())
s = input()
d = {}
for i in range(n - 1):
	if s[i:i + 2] in d:
		d[s[i:i + 2]] += 1
	else:
		d[s[i:i + 2]] = 1
mx = 0
val = ''
for x in d:
	if d[x] > mx:
		mx = d[x]
		val = x
print(val)


from collections import Counter
n = int(input())
data = input()
list1 = []
for i in range(0, n - 1):
	list1.append(data[i] + data[i + 1])
print(Counter(list1).most_common(1)[0][0])


n = int(input())
s = input()
d = {}
for i in range(n - 1):
	temp = s[i] + s[i + 1]
	try:
		if d[temp]:
			d[temp] += 1
	except:
		d[temp] = 1
print(max(d, key=d.get))


n = int(input())
string = list(input())
check = {}
k = 1
for i in range(n - 1):
	k = 1
	s = string[i] + string[i + 1]
	if s in check:
		continue
	for a in range(i + 1, n - 1):
		if s == string[a] + string[a + 1]:
			k += 1
	check[s] = k
k = 0
s = ''
for i in check:
	if check.get(i) > k:
		k = check.get(i)
		s = i
print(s)


from collections import defaultdict
n = int(input())
s = input().strip()
gram2count = defaultdict(int)
for i in range(n - 1):
	gram = s[i:i + 2]
	gram2count[gram] += 1
mx_count = 0
mx_gram = ''
for (gram, count) in gram2count.items():
	if count > mx_count:
		mx_count = count
		mx_gram = gram
print(mx_gram)


n = int(input())
s = input()
dic = {}
for i in range(len(s) - 1):
	st = s[i] + s[i + 1]
	if st in dic:
		dic[st] += 1
	else:
		dic[st] = 1
ans = ''
cnt = 0
for i in dic:
	if dic[i] > cnt:
		cnt = dic[i]
		ans = i
print(ans)


n = int(input())
string = input()
maps = {}
for i in range(len(string) - 1):
	gram = string[i] + string[i + 1]
	if gram not in maps:
		maps[gram] = 1
	else:
		maps[gram] += 1
current_longest = 0
longest = ''
for i in maps.keys():
	if maps[i] > current_longest:
		current_longest = maps[i]
		longest = i
print(longest)


def key_with_max_value(dic):
	return max(dic, key=dic.get)
n = int(input())
s = input()
d = {}
for x in range(n - 1):
	if s[x:x + 2] not in d.keys():
		d[s[x:x + 2]] = 1
	else:
		d[s[x:x + 2]] += 1
print(key_with_max_value(d))


from collections import Counter

def Most_Common(lst):
	data = Counter(lst)
	return data.most_common(1)[0][0]
x = int(input())
s = input()
L = []
for i in range(x - 1):
	L.append(s[i] + s[i + 1])
print(Most_Common(L))


n = input()
s = input()
d = {}
for i in range(0, len(s) - 1):
	temp = s[i] + s[i + 1]
	try:
		d[temp] += 1
	except KeyError:
		d[temp] = 1
max = -1
t = ''
for (key, value) in d.items():
	if value > max:
		max = value
		t = key
print(t)


number = int(input())
posl = input()
mas = []
Max = 0
for i in range(number - 1):
	if posl[i:i + 2] not in mas:
		mas.append(posl[i:i + 2])
for dvugr in mas:
	posic = 0
	c = 0
	while dvugr in posl[posic:]:
		posic = posl.index(dvugr, posic) + 1
		c += 1
	if c > Max:
		Max = c
		Chasto = dvugr
print(Chasto)


from collections import defaultdict
n = int(input())
str = input()
dic = defaultdict(int)
for i in range(len(str) - 1):
	stt = str[i:i + 2]
	if dic[stt] == 0:
		temp_cnt = 0
		for j in range(len(str) - 1):
			if str[j:j + 2] == stt:
				temp_cnt += 1
		dic[stt] = temp_cnt
max_cnt = 0
ans = ''
for k in dic:
	v = dic[k]
	if v > max_cnt:
		ans = k
		max_cnt = v
print(ans)


def main():
	n = lie()
	s = input()
	d = defaultdict(int)
	for i in range(n - 1):
		d[s[i] + s[i + 1]] += 1
	(ans, id) = (0, 0)
	for (key, value) in d.items():
		if value > ans:
			ans = value
			id = key
	print(id)

def fun(m, n, s, k):
	return

def fun2(s):
	return
from sys import *
import inspect
import re
from math import *
import threading
from collections import *
from pprint import pprint as pp
mod = 998244353
MAX = 10 ** 5

def lie():
	return int(input())

def liee():
	return map(int, input().split())

def array():
	return list(map(int, input().split()))

def deb(p):
	for line in inspect.getframeinfo(inspect.currentframe().f_back)[3]:
		m = re.search('\\bdeb\\s*\\(\\s*([A-Za-z_][A-Za-z0-9_]*)\\s*\\)', line)
		print('%s %d' % (m.group(1), p))

def vector(size, val=0):
	vec = [val for i in range(size)]
	return vec

def matrix(rowNum, colNum, val=0):
	mat = []
	for i in range(rowNum):
		collumn = [val for j in range(colNum)]
		mat.append(collumn)
	return mat

def dmain():
	setrecursionlimit(100000000)
	threading.stack_size(40960000)
	thread = threading.Thread(target=main)
	thread.start()
dmain()


n = int(input())
s = input()
ans1 = 0
ans2 = ''
for f1 in range(n - 1):
	h1 = s[f1] + s[f1 + 1]
	h2 = 0
	for f2 in range(n - 1):
		if s[f2] + s[f2 + 1] == h1:
			h2 += 1
	if h2 > ans1:
		ans1 = h2
		ans2 = h1
print(ans2)


n = int(input())
s = input()
d = {}
for i in range(n - 1):
	cs = s[i:i + 2]
	if d.get(cs) is not None:
		d[cs] += 1
	else:
		d[cs] = 1
Max = 0
res = ''
for (k, v) in d.items():
	if v > Max:
		Max = v
		res = k
print(res)


from itertools import accumulate, takewhile
from bisect import bisect_right
from collections import Counter
I = lambda : list(map(int, input().split()))
n = int(input())
s = input()
if len(s) == 2:
	print(s)
	exit()
c = Counter([s[i:i + 2] for i in range(len(s) - 1)])
print(c.most_common(1)[0][0])


n = int(input())
s = input()
l = []
for i in range(n - 1):
	str1 = s[i] + s[i + 1]
	l.append(str1)
x = set(l)
x = list(x)
ans = []
for i in range(len(x)):
	count = l.count(x[i])
	ans.append(count)
max1 = max(ans)
ind = ans.index(max1)
print(x[ind])


from collections import Counter
n = int(input())
s = input()
arr = []
for i in range(n):
	arr.append(s[i:i + 2])
counter = Counter(arr)
for (key, value) in counter.most_common():
	print(key)
	break


n = int(input())
char = list(input())
c_map = {}
for i in range(1, n, 2):
	key = char[i - 1] + char[i]
	if key in c_map.keys():
		c_map[key] += 1
	else:
		c_map[key] = 1
for j in range(0, n - 1):
	key = char[j] + char[j + 1]
	if key in c_map.keys():
		c_map[key] += 1
	else:
		c_map[key] = 1
maxValue = -1
rk = -1
for (k, v) in c_map.items():
	maxValue = max(maxValue, v)
	if v == maxValue:
		rk = k
print(rk)


n = int(input())
s = input()
ans = ''
ma = -1
for i in range(n - 1):
	cur = s[i:i + 2]
	cur2 = 0
	for j in range(n - 1):
		cur2 += s[j:j + 2] == cur
	if ma < cur2:
		ans = cur
		ma = cur2
print(ans)


inpu1 = int(input())
string = input()
strings = {}
for i in range(inpu1 - 1):
	chars = string[i:i + 2]
	if chars not in strings.keys():
		strings[chars] = 1
	else:
		strings[chars] += 1
print([k for (k, j) in strings.items() if j == max(list(strings.values()))][0])


n = int(input())
s = input()
a = 0
b = 1
q = 0
result = ''
while b < len(s):
	c = s[a] + s[b]
	a = a + 1
	b = b + 1
	save = s
	count = 0
	for i in range(len(s) - 1):
		compare = s[i] + s[i + 1]
		if c == compare:
			count = count + 1
	if q < count:
		q = count
		result = c
print(result)


import sys
import math

def read_int():
	return int(input().strip())

def read_int_list():
	return list(map(int, input().strip().split()))

def read_string():
	return input().strip()

def read_string_list(delim=' '):
	return input().strip().split(delim)
n = read_int()
s = read_string()
dik = {}
for i in range(n - 1):
	temp = s[i:i + 2]
	dik[temp] = dik.get(temp, 0) + 1
maxi = max(list(dik.values()))
for k in dik:
	if dik[k] == maxi:
		print(k)
		sys.exit()


N = int(input())
s = input()
d = {}
for i in range(N - 1):
	try:
		d[s[i] + s[i + 1]] += 1
	except:
		d[s[i] + s[i + 1]] = 0
M = max(d.values())
for (k, v) in d.items():
	if v == M:
		print(k)
		break


from collections import Counter
n = int(input())
s = input()
a = list(s)
b = []
c = []
d = []
e = []
dict = {}
count = 0
for i in range(len(a) - 1):
	a1 = s[i:i + 2]
	b.append(a1)
c = Counter(b)
for (k, v) in c.items():
	d.append(k)
	e.append(v)
max1 = max(e)
ind = e.index(max1)
print(d[ind])


n = int(input())
s = input()
c = 0
t = ''
m = 0
for i in range(n - 1):
	c = 0
	for j in range(n - 1):
		if s[i:i + 2] == s[j:j + 2]:
			c += 1
	if c > m:
		m = c
		t = s[i:i + 2]
print(t)


def input_int():
	return int(input())
N = input_int()
s = str(input())
count = {}
max_bigram = 'NONE'
for i in range(N - 1):
	bigram = s[i:i + 2]
	max_bigram = bigram
	if bigram in count:
		count[bigram] += 1
	else:
		count[bigram] = 1
for bigram in count:
	if count[bigram] > count[max_bigram]:
		max_bigram = bigram
print(max_bigram)


x = int(input())
a = input()
z = [1]
t = 1
t1 = 1
for i in range(x - 2):
	t = 1
	for j in range(i + 1, x - 1):
		if a[i:i + 2] == a[j:j + 2]:
			t = t + 1
	z.append(t)
for i in range(x - 1):
	bt = 0
	t1 = 1
	for j in range(i + 1, x - 1):
		if a[i:i + 2] == a[j:j + 2]:
			t1 = t1 + 1
	if t1 == max(z):
		print(a[i:i + 2])
		break


n = int(input())
s = input()
d = {}
for i in range(len(s) - 1):
	d[s[i], s[i + 1]] = d.get((s[i], s[i + 1]), 0) + 1
(mv, mk) = (0, None)
for k in d:
	if d[k] > mv:
		(mv, mk) = (d[k], k)
print(mk[0] + '' + mk[1])


n = int(input())
s = input().strip()
counter = [0] * (26 * 26)
for i in range(n - 1):
	a = ord(s[i]) - ord('A')
	b = ord(s[i + 1]) - ord('A')
	counter[a * 26 + b] += 1
m = max(counter)
i = counter.index(m)
b = i % 26
a = (i - b) // 26
ans = chr(ord('A') + a) + chr(ord('A') + b)
print(ans)


dlina_str = int(input())
stroka = input()
pari = []
col_par = []
down = 0
up = 2
for i in range(dlina_str):
	obr_obj = stroka[down:up]
	if obr_obj not in pari:
		pari.append(obr_obj)
		col_par.append(1)
	else:
		q = pari.index(obr_obj)
		col_par[q] += 1
	down += 1
	up += 1
w = col_par.index(max(col_par))
otvet = pari[w]
print(otvet)


n = int(input())
s = input()
maxi = -1
z = ''
for x in range(n - 2):
	k = 0
	for y in range(x, n - 1):
		if s[x:x + 2] == s[y + 1:y + 3]:
			k += 1
	if max(k, maxi) == k:
		maxi = k
		z = s[x:x + 2]
if n == 2:
	print(s)
else:
	print(z)


n = int(input())
s = input()
d = {}
for i in range(n - 1):
	if s[i:i + 2] not in d:
		d[s[i:i + 2]] = 0
		for j in range(n - 1):
			if s[i:i + 2] == s[j:j + 2]:
				d[s[i:i + 2]] += 1
ma = max(d.values())
for i in d:
	if d[i] == ma:
		print(i)
		break


from collections import defaultdict

def solution(letters):
	count_hash = defaultdict(int)
	most = letters[0:3]
	for i in range(len(letters) - 1):
		current = letters[i:i + 2]
		count_hash[current] += 1
		if count_hash[current] > count_hash[most]:
			most = current
	print(most)
num = input()
solution(input())


n = int(input())
p = []
l = input()
k = []
for i in range(n - 1):
	p.append(l[i] + l[i + 1])
setp = set(p)
for j in setp:
	k.append([p.count(j), j])
k.sort()
print(k[-1][1])


stringLen = int(input())
string = input()
twoGrams = {}
for i in range(1, stringLen):
	twoGrams[string[i - 1] + string[i]] = twoGrams.get(string[i - 1] + string[i], 0) + 1
print(max(twoGrams, key=twoGrams.get))


def real_count(s, st):
	no = 0
	no_1 = ''
	for i in range(len(s) - 1):
		no_1 = ''
		no_1 = s[i] + s[i + 1]
		if no_1 == st:
			no += 1
	return no
n = int(input())
s = input()
ans = 0
po = ''
for i in range(len(s) - 1):
	st = ''
	st += s[i] + s[i + 1]
	now = real_count(s, st)
	if now > ans:
		ans = now
		po = st
print(po)


n = int(input())
k = input()
l = [k[i] + k[i + 1] for i in range(n - 1)]
k = {i: l.count(i) for i in l}
m = [(value, key) for (key, value) in k.items()]
print(max(m)[1])


n = int(input())
s = input()
d = {}
for x in range(n - 1):
	try:
		d[s[x:x + 2]] += 1
	except:
		d[s[x:x + 2]] = 1
size = 0
for (x, y) in d.items():
	if size < y:
		size = y
		s = x
print(s)


a = int(input())
b = input()
mas = []
for i in range(a - 1):
	if str(b[i]) + str(b[i + 1]) not in mas:
		mas.append(str(b[i]) + str(b[i + 1]))
mas1 = []
max = 0
coun = 0
for i in range(len(mas)):
	for u in range(len(b) - 1):
		if str(b[u]) + str(b[u + 1]) == mas[i]:
			coun += 1
	if coun >= max:
		max = coun
		p = i
	mas1.append(coun)
	coun = 0
print(mas[p])


n = int(input())
l = list(input())
pair = {}
for i in range(n - 1):
	a = ''.join(l[i:i + 2])
	if a not in pair:
		pair[a] = 1
	else:
		pair[a] += 1
keymax = max(pair, key=pair.get)
print(keymax)


n = int(input())
string = input()
count = 0
res = ''

def c(selected):
	index = 0
	occurence = 0
	while True:
		index = string.find(selected, index) + 1
		if index <= 0:
			break
		occurence += 1
	return occurence
for i in range(n - 1):
	selected = string[i:i + 2]
	h = c(selected)
	if h > count:
		res = selected
		count = h
print(res)


n = int(input())
s = input()
sarr = []
intarr = []
for i in range(n - 1):
	ss = s[i:i + 2]
	if ss not in sarr:
		sarr.append(ss)
		intarr.append(1)
	else:
		yo = sarr.index(ss)
		intarr[yo] += 1
mini = 0
minind = 0
l = len(intarr)
for i in range(l):
	if intarr[i] > mini:
		mini = intarr[i]
		minind = i
print(sarr[minind])


import operator
n = int(input())
chars = input()
combs = {}
for i in range(len(chars) - 1):
	curr = chars[i:i + 2]
	if curr in combs.keys():
		combs[curr] += 1
	else:
		combs[curr] = 1
print(max(combs.items(), key=operator.itemgetter(1))[0])


def FindTheCure(stingLenght, letters):
	twoGrams = []
	twoGramCount = []
	i = 0
	while i < stingLenght - 1:
		twoGram = letters[i] + letters[i + 1]
		if twoGram not in twoGrams:
			twoGrams.append(twoGram)
			twoGramCount.append(1)
		else:
			x = 0
			while x < len(twoGrams):
				if twoGrams[x] == twoGram:
					twoGramCount[x] += 1
					break
				else:
					x += 1
		i += 1
	print(twoGrams[twoGramCount.index(max(twoGramCount))])
stringLenght = int(input())
letters = input()
FindTheCure(stringLenght, letters)


a = input
k = int(a())
gh = a()
z = []
for i in range(k - 1):
	if [gh.count(gh[i] + gh[i + 1]), gh[i] + gh[i + 1]] not in z:
		z += [[gh.count(gh[i] + gh[i + 1]), gh[i] + gh[i + 1]]]
print(sorted(z, reverse=True)[0][1])


n = int(input())
str = input()
count = {}
for i in range(n - 1):
	if str[i] + str[i + 1] in count:
		count[str[i] + str[i + 1]] += 1
	else:
		count[str[i] + str[i + 1]] = 1
print(max(count, key=lambda i: count[i]))


trash = input()
text = input()
asw = ''
max_count = 0
for i in range(0, len(text) - 1):
	first_letter = text[i]
	second_letter = text[i + 1]
	count = 0
	for ii in range(0, len(text) - 1):
		ifirst_letter = text[ii]
		isecond_letter = text[ii + 1]
		if ifirst_letter == first_letter and second_letter == isecond_letter:
			count = count + 1
	if count > max_count:
		max_count = count
		asw = first_letter + second_letter
print(asw)


import sys
n = int(input())
S = input().rstrip()
k = {}
for i in range(n - 1):
	x = S[i:i + 2]
	k[x] = k.get(x, 0) + 1
print(max(k.items(), key=lambda x: x[1])[0])


n = int(input())
s = input()
p = s[0]
d = dict()
for i in s[1:]:
	if (p, i) not in d:
		d[p, i] = 1
	else:
		d[p, i] += 1
	p = i
num_value = 0
K = ('', '')
for (k, v) in d.items():
	if v > num_value:
		num_value = v
		K = k
print(''.join(K))


n = int(input())
s = input()
ar = []
for i in range(n - 1):
	val = s[i:i + 2]
	ar.append(val)
print(max(ar, key=ar.count))


n = int(input())
s = str(input())
l = []
for i in range(n - 1):
	if s[i:i + 2] not in l:
		l.append(s[i:i + 2])
c = [0] * len(l)
for i in range(len(l)):
	for j in range(n - 1):
		if l[i] == s[j:j + 2]:
			c[i] += 1
m = c.index(max(c))
print(l[m])


n = int(input())
s = input()
d = {}
for i in range(n - 1):
	a = s[i] + s[i + 1]
	if a in d:
		d[a] += 1
	else:
		d[a] = 1
print([key for (key, value) in d.items() if value == max(d.values())][0])


n = int(input())
a = input()
b = {}
for i in range(n - 1):
	if a[i] + a[i + 1] in b:
		b[a[i] + a[i + 1]] += 1
	else:
		b[a[i] + a[i + 1]] = 1
k = max(zip(b.values(), b.keys()))
print(k[1])


def main():
	n = int(input())
	string = input()
	counts = dict()
	for i in range(0, len(string) - 1):
		two_gram = string[i:i + 2]
		counts[two_gram] = counts.get(two_gram, 0) + 1
	sort = sorted([(v, k) for (k, v) in counts.items()])
	return sort[-1][1]
output = main()
print(output)


n = int(input())
s = input()
d = dict()
maxn = -1
for i in range(1, n):
	if s[i - 1:i + 1] in d:
		d[s[i - 1:i + 1]] += 1
	else:
		d[s[i - 1:i + 1]] = 1
for i in d:
	if d[i] > maxn:
		maxn = d[i]
		res = i
print(res)


n = int(input())
s = input()

def zfunc(S):
	n = len(S)
	z = [0] * n
	z[0] = n
	(l, r) = (0, 0)
	for i in range(1, n):
		if i <= r:
			z[i] = min(r - i + 1, z[i - l])
		while i + z[i] < n and S[z[i]] == S[i + z[i]]:
			z[i] += 1
		if i + z[i] - 1 > r:
			l = i
			r = i + z[i] - 1
	return z
m = 0
ans = s[:2]
for i in range(len(s) - 1):
	zz = zfunc(s[i:i + 2] + '#' + s)
	if zz.count(2) > m:
		ans = s[i:i + 2]
		m = zz.count(2)
print(ans)


(n, s) = (input(), str(input()))
m = {}
(a, b) = (0, '')
for i in range(len(s) - 1):
	k = s[i] + s[i + 1]
	if not k in m:
		m[k] = 1
	else:
		m[k] += 1
	if m[k] > a:
		(a, b) = (m[k], k)
print(b)


ans = {}
a = int(input())
st = input()
max = 0
ad = st[0] + st[1]
for i in range(a - 1):
	d = st[i] + st[i + 1]
	if d not in ans:
		ans[d] = 1
	else:
		ans[d] += 1
		if ans[d] > max:
			max = ans[d]
			ad = d
print(ad)


from sys import stdin
import operator

def solve(tc):
	n = int(stdin.readline().strip())
	s = stdin.readline().strip()
	dic = {}
	for i in range(1, n):
		sub = s[i - 1] + s[i]
		if sub in dic:
			dic[sub] += 1
		else:
			dic[sub] = 1
	print(max(dic.items(), key=operator.itemgetter(1))[0])
LOCAL_TEST = not __debug__
if LOCAL_TEST:
	infile = __file__.split('.')[0] + '-test.in'
	stdin = open(infile, 'r')
tcs = int(stdin.readline().strip()) if LOCAL_TEST else 1
tc = 1
while tc <= tcs:
	solve(tc)
	tc += 1


(n, s, q) = (int(input()), input(), {})
for i in range(n - 1):
	a = s[i] + s[i + 1]
	if a not in q:
		q[a] = 1
	else:
		q[a] += 1
print(max(q, key=q.get))


import math
from decimal import Decimal
import heapq

def na():
	n = int(input())
	b = [int(x) for x in input().split()]
	return (n, b)

def nab():
	n = int(input())
	b = [int(x) for x in input().split()]
	c = [int(x) for x in input().split()]
	return (n, b, c)

def dv():
	(n, m) = map(int, input().split())
	return (n, m)

def dva():
	(n, m) = map(int, input().split())
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	return (n, m, b)

def eratosthenes(n):
	sieve = list(range(n + 1))
	for i in sieve:
		if i > 1:
			for j in range(i + i, len(sieve), i):
				sieve[j] = 0
	return sorted(set(sieve))

def nm():
	n = int(input())
	b = [int(x) for x in input().split()]
	m = int(input())
	c = [int(x) for x in input().split()]
	return (n, b, m, c)

def dvs():
	n = int(input())
	m = int(input())
	return (n, m)
input()
s = input()
d = {}
for i in range(len(s) - 1):
	tc = s[i] + s[i + 1]
	d[tc] = d.get(tc, 0) + 1
s = max(d.values())
for i in d:
	if d[i] == s:
		print(i)
		exit()


n = int(input())
s = input()
d = {}
for i in range(n - 1):
	help = s[i] + s[i + 1]
	if d.get(help) == None:
		d[help] = 1
	else:
		d[help] += 1
m = 0
p = False
for key in d:
	if d[key] > m:
		m = d[key]
		p = key
print(p)


n = input()
s = input()
two_gram_dict = {}
max_two_gram_value = 0
max_two_gram = s[0:2]
for i in range(len(s)):
	two_gram_key = s[i:i + 2]
	if two_gram_dict.get(two_gram_key):
		two_gram_dict[two_gram_key] += 1
		if two_gram_dict[two_gram_key] > max_two_gram_value:
			max_two_gram_value = two_gram_dict[two_gram_key]
			max_two_gram = two_gram_key
	else:
		two_gram_dict[two_gram_key] = 1
print(max_two_gram)


import operator
size = int(input())
word = input()
counter = {'': 0}
found = list()
for i in range(size - 1):
	part = word[i] + word[i + 1]
	if part not in found:
		found.append(part)
		counter[part] = 1
	else:
		counter[part] += 1
print(max(counter.items(), key=operator.itemgetter(1))[0])


n = int(input())
s = input()
ans = 0
arr = ''
for i in range(n - 1):
	pr = s[i] + s[i + 1]
	summ = 0
	for j in range(n - 1):
		l = s[j] + s[j + 1]
		if l == pr:
			summ += 1
	if summ > ans:
		ans = summ
		arr = pr
print(arr)


class Solution:

	def solve(self, n, s):
		i = 0
		j = 1
		str_list = list(s)
		gram_dict = dict()
		while j < n:
			if str_list[i] + str_list[j] in gram_dict.keys():
				gram_dict[str_list[i] + str_list[j]] += 1
			else:
				gram_dict[str_list[i] + str_list[j]] = 1
			i += 1
			j += 1
		max_v = max(gram_dict.values())
		for i in gram_dict.keys():
			if gram_dict[i] == max_v:
				return i
s = Solution()
n = int(input())
st = input()
print(s.solve(n, st))


f = lambda : map(int, input().split())
n = int(input())
l = input()
lt = []
for i in range(0, n - 1):
	c = 0
	for j in range(0, n - 1):
		if l[i] + l[i + 1] == l[j] + l[j + 1]:
			c += 1
	lt.append(c)
mx = lt.index(max(lt))
print(l[mx] + l[mx + 1])


def pairs(x):
	for i in range(x.__len__() - 1):
		yield x[i:i + 2]
input()
s = input()
d = {}
for p in pairs(s):
	if p in d:
		d[p] += 1
	else:
		d[p] = 1
(a, k) = (-1, -1)
for (kk, vv) in d.items():
	if vv > a:
		a = vv
		k = kk
print(k)


def ry(n, m):
	dicti = {}
	for i in range(n):
		sub = m[i:i + 2]
		if sub in dicti:
			dicti[sub] += 1
		else:
			dicti[sub] = 1
	return max(dicti, key=dicti.get)
n = int(input())
m = input()
print(ry(n, m))


n = int(input())
s = input()
d = dict()
ma = 0
ms = ''
for i in range(n - 1):
	if s[i] + s[i + 1] in d:
		d[s[i] + s[i + 1]] += 1
	else:
		d[s[i] + s[i + 1]] = 1
	if d[s[i] + s[i + 1]] > ma:
		ma = d[s[i] + s[i + 1]]
		ms = s[i] + s[i + 1]
print(ms)


n = int(input())
s = input()
d = {}
for i in range(n - 1):
	if s[i:i + 2] in d:
		d[s[i:i + 2]] += 1
	else:
		d[s[i:i + 2]] = 1
max = 0
s = ''
for (k, v) in d.items():
	if v > max:
		max = v
		st = k
print(st)


from collections import Counter
(_, s) = (input(), input())
bgs = Counter()
current_bg = '_' + s[0]
for c in s[1:]:
	current_bg = current_bg[1] + c
	bgs[current_bg] += 1
print(bgs.most_common(1)[0][0])


n = int(input())
(a, s, m, k) = ({}, input(), 0, '')
for i in range(n - 1):
	x = s[i] + s[i + 1]
	if x not in a:
		a[x] = 1
	else:
		a[x] += 1
	if a[x] > m:
		m = a[x]
		k = x
print(k)


import collections
n = int(input())
s = input()
d = collections.defaultdict(int)
for i in range(1, n):
	d[s[i - 1:i + 1]] += 1
m = 0
for k in d.keys():
	if d[k] > m:
		m = d[k]
		t = k
print(t)


from collections import defaultdict

def main():
	l = int(input())
	s = input().strip()
	mydict = defaultdict(int)
	max_tracker = 0
	for i in range(l - 1):
		mydict[s[i:i + 2]] += 1
	for (key, value) in mydict.items():
		if value >= max_tracker:
			max_tracker = value
			max_sub_str = key
	print(max_sub_str)
main()


from collections import defaultdict
input()
s = str(input())
dic = defaultdict(int)
for (i, c) in enumerate(s):
	if i == len(s) - 1:
		continue
	dic[c + s[i + 1]] = dic[c + s[i + 1]] + 1
print(sorted(dic, key=dic.get, reverse=True)[0])


n = int(input())
s = input()
d = {}
for i in range(n - 1):
	if s[i:i + 2] in d:
		d[s[i:i + 2]] += 1
	else:
		d[s[i:i + 2]] = 1
print(max(d.items(), key=lambda x: x[1])[0])


n = int(input())
s = input()
sl = [s[i:i + 2] for i in range(n - 1)]
max = 0
sub = ''
i = 0
while i < len(sl):
	count = sl.count(sl[i])
	if count > max:
		sub = sl[i]
		max = count
	i = i + count
print(sub)


n = int(input())
s = input().strip('\n')
count = {}
for i in range(1, n):
	sub = s[i - 1:i + 1]
	if sub not in count.keys():
		count[sub] = 0
	count[sub] += 1
ans = ''
max = 0
for i in count.keys():
	if count[i] > max:
		ans = i
		max = count[i]
print(ans)


n = int(input())
s = input()
rec = [0, 'aa']
for i in range(n - 1):
	a = s[i:i + 2]
	temp = 0
	for j in range(i, n - 1):
		if a == s[j:j + 2]:
			temp += 1
	if temp > rec[0]:
		rec = [temp, a]
print(rec[1])


from sys import stdin, stdout

def mode_two_gram_SpaceOptimized(n: int, latin: str) -> str:
	max_occurrenes = 0
	for i in range(n - 1):
		count = 0
		two_gram = latin[i] + latin[i + 1]
		for j in range(n - 1):
			if two_gram == latin[j] + latin[j + 1]:
				count += 1
		if max_occurrenes < count:
			max_occurrenes = count
			max_two_gram = two_gram
	return max_two_gram

def mode_two_gram_TimeOptimized(n: int, latin: str) -> str:
	histogram = {}
	for i in range(n - 1):
		two_gram = latin[i] + latin[i + 1]
		if not two_gram in histogram:
			histogram[two_gram] = 1
		else:
			histogram[two_gram] += 1
	return max(histogram, key=lambda k: histogram[k])
n = int(stdin.readline().rstrip())
latin = stdin.readline().rstrip()
stdout.write(mode_two_gram_SpaceOptimized(n, latin) + '\n')


n = int(input())
a = input()
d = {}
for i in range(n - 1):
	k = a[i] + a[i + 1]
	if k not in d:
		d[k] = 1
	else:
		d[k] += 1
a = list(zip(d.values(), d.keys()))
a = sorted(a)
print(a[-1][1])


n = int(input())
s = input()
a = []
b = []
for i in range(n - 1):
	a.append(s[i] + s[i + 1])
max = 0
for i in a:
	count = 0
	for j in a:
		if i == j:
			count += 1
	if count > max:
		max = count
		s = i
print(s)


import sys
n = int(sys.stdin.readline())
s = sys.stdin.readline()
two_grams = {}
max_count = 0
max_gram = ''
for i in range(len(s) - 1):
	try:
		two_grams[s[i:i + 2]] += 1
	except:
		two_grams[s[i:i + 2]] = 1
	if two_grams[s[i:i + 2]] > max_count:
		max_count = two_grams[s[i:i + 2]]
		max_gram = s[i:i + 2]
print(max_gram)


n = int(input())
s = input()
a = dict()
a['MAX'] = -1
MAX = s[0:2]
for i in range(len(s) - 1):
	pattern = s[i] + s[i + 1]
	if pattern in a:
		a[pattern] += 1
		if a[pattern] > a['MAX']:
			MAX = pattern
			a['MAX'] = a[pattern]
	else:
		a[pattern] = 1
print(MAX)


n = int(input())
s = str(input())
d = {}
for i in range(n - 1):
	if s[i:i + 2] not in d:
		d[s[i:i + 2]] = 1
	else:
		d[s[i:i + 2]] += 1
sum = 0
for x in d:
	if d[x] > sum:
		ch = x
		sum = d[x]
print(ch)


n = int(input())
s = input()
(max, count) = (0, 1)
ans = s[0:2]
for i in range(n - 2):
	count = 1
	for ii in range(1, n - 1):
		if s[i:i + 2] == s[ii:ii + 2]:
			count += 1
	if count > max:
		max = count
		ans = s[i:i + 2]
print(ans)


def sol():
	from collections import defaultdict
	n = int(input())
	s = input()
	d = defaultdict(int)
	for i in range(n - 1):
		sub = s[i] + s[i + 1]
		d[sub] += 1
	k = list(d.keys())
	v = list(d.values())
	return k[v.index(max(v))]
print(sol())


from collections import defaultdict
n = int(input())
s = str(input())
f = defaultdict(int)
for i in range(0, n - 1, 1):
	f[s[i:i + 2]] += 1
max = 0
for i in f:
	if f[i] > max:
		max = f[i]
		s = i
print(s)


n = int(input())
s = input()
d = {}
for i in range(len(s) - 1):
	a = s[i:i + 2]
	if a in d:
		d[a] += 1
	else:
		d[a] = 1
(m, v) = (0, None)
for (a, count) in d.items():
	if count > m:
		m = count
		v = a
print(v)


n = int(input())
s = input()
L = list(zip(s, s[1:]))
mayor = 0
text = ''
for k in set(L):
	count = L.count(k)
	if count > mayor:
		mayor = count
		text = k[0] + k[1]
print(text)


n = int(input())
s = input()
d = {}
maxv = 0
maxs = ''
for i in range(n - 1):
	try:
		d[s[i:i + 2]] += 1
	except:
		d[s[i:i + 2]] = 1
	if d[s[i:i + 2]] > maxv:
		maxv = d[s[i:i + 2]]
		maxs = s[i:i + 2]
print(maxs)


n = int(input())
ss = input()
s = list(ss)
l = list(set(s))
m = len(l)
x = 0
w = ''
for i in range(m):
	for j in range(m):
		r = l[i] + l[j]
		c = 0
		for o in range(1, n):
			if s[o - 1] + s[o] == r:
				c = c + 1
		if c > x:
			x = c
			w = r
print(w)


n = int(input())
s = input()
f = 0
for i in range(n - 1):
	c = s[i:i + 2]
	cur = 1
	for j in range(i + 1, n):
		if s[j:j + 2] == c:
			cur = cur + 1
	if cur > f:
		ans = c
		f = cur
print(ans)


n = int(input())
s = input()
maxx = -1
res = ''
for i in range(n - 1):
	ts = s[i:i + 2]
	counter = 0
	for j in range(n - 1):
		if ts == s[j:j + 2]:
			counter += 1
	if maxx < counter:
		maxx = counter
		res = ts
print(res)


n = int(input())
s = input()
dict = dict()
maxs = s[0] + s[1]
maxi = 1
dict[s[0] + s[1]] = 1
for i in range(1, n - 1):
	if dict.get(s[i] + s[i + 1], -1) == -1:
		dict[s[i] + s[i + 1]] = 1
	else:
		dict[s[i] + s[i + 1]] += 1
	if dict[s[i] + s[i + 1]] > maxi:
		maxi = dict[s[i] + s[i + 1]]
		maxs = s[i] + s[i + 1]
print(maxs)


from collections import defaultdict
input()
s = input()
d = defaultdict(int)
for twogram in zip(s, s[1:]):
	d[twogram] += 1
print(''.join(max(d, key=lambda x: d[x])))


N = int(input())
S = input()
counter = {}
for idx in range(len(S) - 1):
	cur = S[idx:idx + 2]
	if cur not in counter:
		counter[cur] = 1
	counter[cur] += 1
vals = sorted([(b, a) for (a, b) in counter.items()])
print(vals[-1][1])


from collections import Counter
n = int(input())
s_string = input()
two_grams_list = []
indexer_1 = 0
indexer_2 = 2
for i in range(n - 1):
	two_grams_list.append(s_string[indexer_1:indexer_2])
	indexer_1 += 1
	indexer_2 += 1
my_dict = dict(Counter(two_grams_list))
maximum = max(my_dict, key=my_dict.get)
print(maximum)


n = int(input())
s = input()
dv = dict()
for i in range(0, n):
	if s[i:i + 2] not in dv:
		dv[s[i:i + 2]] = 1
	else:
		dv[s[i:i + 2]] += 1
mx = 0
for i in dv:
	if mx < dv[i]:
		mx = dv[i]
		s = i
print(s)


n = int(input())
ch = str(input())
D = dict()
m = 0
for i in range(1, n):
	gram = ch[i - 1] + ch[i]
	if gram not in D:
		D[gram] = 1
	else:
		D[gram] += 1
for x in D:
	m = max(m, D[x])
for x in D:
	if D[x] == m:
		print(x)
		break


from collections import Counter
input()
s = input()
counter = Counter()
for i in range(len(s) - 1):
	two_gram = s[i:i + 2]
	if two_gram not in counter:
		for j in range(len(s) - 1):
			if s[j:j + 2] == two_gram:
				counter[two_gram] += 1
reverse_counter = {num: two_gram for (two_gram, num) in counter.items()}
print(reverse_counter[max((k for k in reverse_counter))])


import re
t = int(input())
s = input()
flag = 0
ans = 1
for i in range(len(s) - 1):
	flag = 0
	a = s[i:i + 2]
	for j in range(len(s) - 1):
		b = s[j:j + 2]
		if a == b:
			flag = flag + 1
	if flag >= ans:
		ans = flag
		c = a
print(c)


__author__ = 'Dilshod'
n = int(input())
s = input()
mx = 0
cnt = 0
ans = ''
ans1 = ''
for letters in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ':
	for letter in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ':
		for i in range(n - 1):
			if s[i] == letters and s[i + 1] == letter:
				ans1 = s[i] + s[i + 1]
				cnt += 1
		if mx <= cnt:
			ans = ans1
			ans1 = ''
			mx = cnt
		else:
			ans1 = ''
		cnt = 0
print(ans)


n = int(input())
s = input()
l = []
for i in range(n - 1):
	l.append(s[i:i + 2])
print(max(l, key=l.count))


n = int(input())
s = input()
d = {}
for i in range(len(s) - 1):
	d[s[i] + s[i + 1]] = 0
for i in range(len(s) - 1):
	d[s[i] + s[i + 1]] += 1
k = []
for key in d:
	k.append(d[key])
l = max(k)
for key in d:
	if d[key] == l:
		print(key)
		exit()


d = {}
max = 0
out = 0
n = int(input())
s = input()
for i in range(0, n - 1):
	if f'{s[i]}{s[i + 1]}' in d.keys():
		c = d.get(f'{s[i]}{s[i + 1]}') + 1
		d.update({f'{s[i]}{s[i + 1]}': c})
	else:
		d.update({f'{s[i]}{s[i + 1]}': 1})
for x in d.keys():
	if d.get(x) > max:
		max = d.get(x)
		out = x
print(out)


n = int(input())
s = str(input())
d = dict()
for i in range(n - 1):
	if s[i:i + 2] not in d:
		d[s[i:i + 2]] = 1
	else:
		d[s[i:i + 2]] += 1
m = max(d.values())
for (num, fr) in d.items():
	if fr == m:
		print(num)
		break


n = int(input())
a = input()
ans = []
max_c = 0
for i in range(1, n):
	r = a[i - 1:i + 1]
	ans.append(r)
	c = ans.count(r)
	if c > max_c:
		max_c = c
		an = r
print(an)


n = int(input())
s = input()
lett = list()
num = list()
for i in range(1, len(s)):
	if ''.join([s[i - 1], s[i]]) in lett:
		num[lett.index(''.join([s[i - 1], s[i]]))] += 1
	else:
		num.append(1)
		lett.append(''.join([s[i - 1], s[i]]))
print(lett[num.index(max(num))])


k = int(input())
n = input()
c = {}
for i in range(k - 1):
	b = n[i] + n[i + 1]
	if c.get(b) == None:
		c[b] = 1
	else:
		c[b] += 1
ma = 0
ma2 = 0
for i in c:
	if c[i] > ma:
		ma = c[i]
		ma2 = i
print(ma2)


n = map(int, input().split())
st = str(input())
arr = dict()
i = 0
while True:
	x = st[i:i + 2]
	if len(x) < 2:
		break
	if x in arr:
		arr[x] += 1
	else:
		arr[x] = 0
	i += 1
print(max(arr, key=arr.get))


import operator
n = input()
s = input()
dict_grams = {}
for i in range(0, len(s) - 1):
	if s[i:i + 2] in dict_grams.keys():
		dict_grams[s[i:i + 2]] += 1
	else:
		dict_grams[s[i:i + 2]] = 0
print(max(dict_grams.items(), key=operator.itemgetter(1))[0])


from collections import Counter
(n, x) = (int(input()), input())
z = Counter([x[i:i + 2] for i in range(n)])
print(max(z, key=z.get))


def solve(n, s, x, y):
	cnt = 0
	for i in range(n - 1):
		j = i + 1
		if s[i] == s[x] and s[j] == s[y]:
			cnt += 1
	return cnt
n = int(input())
s = input().strip()
cnt = 0
res = ''
for i in range(n - 1):
	j = i + 1
	tmp = solve(n, s, i, j)
	if cnt < tmp:
		cnt = tmp
		res = s[i] + s[j]
print(res)


from sys import stdin as si
from collections import Counter as C

class Solution:

	def bazinga(self, k, t):
		t2 = C([t[i - 1] + t[i] for i in range(1, len(t))])
		return max(t2, key=lambda x: t2[x])
n = int(si.readline().strip())
t = list(si.readline().strip())
S = Solution()
print(S.bazinga(n, t))


n = int(input())
s = [str(x) for x in input()]
list = []
for i in range(len(s) - 1):
	list.append(s[i] + s[i + 1])

def trending(slst):
	count = {}
	items = []
	for item in set(slst):
		count[item] = slst.count(item)
	for (k, v) in count.items():
		if v == max(count.values()):
			items.append(k)
	return items
print(trending(list)[0])


from collections import Counter
n = int(input())
s = input()
maxi = 0
l = []
for i in range(len(s) - 1):
	l.append(s[i:i + 2])
col_count = Counter(l)
print(col_count.most_common(1)[0][0])


from sys import stdin, stdout
import collections
from collections import Counter
n = stdin.readline()
word = stdin.readline()
mylist = []
for i in range(1, len(word)):
	mylist.append(word[i - 1:i + 1])
a = Counter(mylist)
c = a.most_common(1)
b = dict(c)
for key in b:
	k = str(b.keys())
	stdout.write(k[12:14])


import sys
n = int(sys.stdin.readline())
string = sys.stdin.readline()
di = dict()
for i in range(n - 1):
	gram = string[i:i + 2]
	if gram in di:
		di[gram] += 1
	else:
		di[gram] = 1
cnt = 0
ans = ''
for gram in di:
	if di[gram] > cnt:
		cnt = di[gram]
		ans = gram
print(ans)


n = int(input())
s = input()
m = []
h = {}
for i in range(n):
	r = s[i:i + 2]
	m.append(r)
for i in m:
	if i in h:
		h[i] += 1
	else:
		h[i] = 1
print(max(h, key=h.get))


n = int(input())
s = input()
d = {}
maxa = 0
for i in range(n - 1):
	temp = s[i] + s[i + 1]
	if temp in d:
		d[temp] += 1
	else:
		d[temp] = 1
	if d[temp] > maxa:
		maxa = d[temp]
		ans = temp
print(ans)


input()
s = input()
freq = [0] * 26 ** 2

def hash(s):
	return (ord(s[0]) - 65) * 26 + ord(s[1]) - 65

def unhash(n):
	(l, r) = divmod(n, 26)
	return chr(65 + l) + chr(65 + r)
for i in range(len(s) - 1):
	freq[hash(s[i:i + 2])] += 1
best = 0
bi = 0
for (i, f) in enumerate(freq):
	if f > best:
		best = f
		bi = i
print(unhash(bi))


n = int(input())
s = input()
dict = {}
for x in range(n - 1):
	l = s[x] + s[x + 1]
	if l not in dict:
		dict[l] = 1
	else:
		dict[l] += 1
print(max(dict, key=dict.get))


n = int(input())
s = input()
d = {}
for i in range(0, len(s) - 1, 1):
	if s[i] + s[i + 1] in d:
		d[s[i] + s[i + 1]] += 1
	else:
		d[s[i] + s[i + 1]] = 1
max_key = max(d, key=d.get)
print(max_key)


from collections import defaultdict
(_, s) = (input(), input())
cnt = defaultdict(int)
for i in range(len(s) - 1):
	cnt[s[i] + s[i + 1]] += 1
print(max(cnt.items(), key=lambda x: x[1])[0])


import statistics
n = int(input())
s = input()
a = []
for i in range(n - 1):
	d = s[i:i + 2]
	a.append(d)
print(statistics.mode(a))


n = int(input())
s = input()
d = {}
for x in range(n - 1):
	try:
		d[s[x] + s[x + 1]] = d[s[x] + s[x + 1]] + 1
	except KeyError:
		d[s[x] + s[x + 1]] = 1
l = list(d.values())
p = max(l)
m = list(d.keys())
for x in m:
	if d[x] == p:
		print(x)
		break


size = int(input())
string = input()
myLis = [string[i:2 + i] for i in range(size)]
res = []
for k in myLis:
	res.append((myLis.count(k), k))
print(max(res, key=lambda x: x[0])[1])


n = input()
s = input()
pairs = []

def most_common(lst):
	return max(set(lst), key=lst.count)
for i in range(1, len(s)):
	pairs.append(str(s[i - 1] + s[i]))
for i in range(0, len(s)):
	pairs.append(str(s[i - 1] + s[i]))
print(most_common(pairs))


n = int(input())
input_string = input()
l = []
maximum = -99
for i in range(n - 1):
	l.append(input_string[i] + input_string[i + 1])
for i in l:
	count = l.count(i)
	if maximum < count:
		maximum = count
		result = i
print(result)


from collections import defaultdict
n = int(input())
s = input()
d = defaultdict(lambda : 0)
for i in range(n - 1):
	d[s[i:i + 2]] = d[s[i:i + 2]] + 1
s = sorted(d, key=lambda e: -d[e])[0]
print(s)


from collections import Counter
n = int(input())
string = input()
existing = []
for i in range(len(string) - 1):
	x = string[i:i + 2]
	existing.append(x)
answer = Counter(existing)
inverse = [(value, key) for (key, value) in answer.items()]
print(max(inverse)[1])


def stringcount(s, b):
	return len([i for i in range(n - 1) if s[i:i + 2] == b])
n = int(input())
s = input()
bigrams = [s[i:i + 2] for i in range(n - 1)]
best = 0
bestb = ''
for b in bigrams:
	if stringcount(s, b) > best:
		bestb = b
		best = stringcount(s, b)
print(bestb)


n = int(input())
s = input()
d = {}
maxN = 0
maxRes = ''
for i in range(1, len(s)):
	tmp = s[i - 1] + s[i]
	if tmp in d:
		d[tmp] += 1
		if d[tmp] > maxN:
			maxN = d[tmp]
			maxRes = tmp
	else:
		d[tmp] = 1
		if d[tmp] > maxN:
			maxN = d[tmp]
			maxRes = tmp
print(maxRes)


n = int(input())
s = input()
dic = {}
for i in range(n - 1):
	tmp = s[i:i + 2]
	if tmp in dic:
		dic[tmp] += 1
	else:
		dic[tmp] = 1
a = sorted(list(dic.items()), key=lambda x: x[1])
a.reverse()
print(a[0][0])


n = int(input())
s = input()
s = list(s)
new = {}
for i in range(1, len(s)):
	new[s[i - 1] + s[i]] = 0
t = 1
for i in range(1, len(s)):
	if new[s[i - 1] + s[i]] >= 0:
		new[s[i - 1] + s[i]] += 1
	if new[s[i - 1] + s[i]] >= t:
		t = new[s[i - 1] + s[i]]
		p = s[i - 1] + s[i]
print(p)


a = int(input())
b = input()
c = {}
for i in range(a - 1):
	if b[i] + b[i + 1] not in c:
		c[b[i] + b[i + 1]] = 1
	else:
		c[b[i] + b[i + 1]] += 1
mx = 0
ans = ''
for i in c:
	if c[i] > mx:
		mx = c[i]
		ans = i
print(ans)


n = int(input())
s = input()
l = []
for i in range(n - 1):
	l.append(s[i] + s[i + 1])
e = []
for i in range(len(l)):
	e.append([l.count(l[i]), l[i]])
e = sorted(e)
print(e[-1][1])


n = int(input())
text = input()
mydict = {}
for i in range(1, n):
	tg = text[i - 1] + text[i]
	if tg not in mydict:
		mydict[tg] = 1
	else:
		mydict[tg] += 1
keys = list(mydict.keys())
values = list(mydict.values())
print(keys[values.index(max(values))])


n = int(input())
s = list(input())
b = []
c = []
for i in range(n):
	for j in range(n + 1):
		b.append(s[i:j])
for i in range(len(b)):
	if len(b[i]) == 2:
		c.append(b[i])
d = []
for i in range(len(c)):
	d.append(c.count(c[i]))
a = max(d)
for i in range(len(c)):
	if c.count(c[i]) == a:
		print(''.join(c[i]))
		break


n = int(input())
string = input()
dict_of_tg = {}
for i in range(len(string) - 1):
	tg = string[i] + string[i + 1]
	if tg in dict_of_tg:
		dict_of_tg[tg] += 1
	else:
		dict_of_tg[tg] = 1
max_val = 0
ans = ''
for i in dict_of_tg:
	if dict_of_tg[i] >= max_val:
		max_val = dict_of_tg[i]
		ans = i
print(ans)


x = int(input())
y = input()
l = []
for i in range(x - 1):
	l.append(y[i:i + 2])
t = set(l)
max = l.count(l[0])
k = l[0]
for i in t:
	if l.count(i) > max:
		max = l.count(i)
		k = i
print(k)


n = int(input())
s = str(input())
max1 = -1
for i in range(n - 1):
	k = s[i] + s[i + 1]
	d = 0
	for l in range(n - 1):
		if k == s[l] + s[l + 1]:
			d += 1
	if d > max1:
		max1 = d
		kmax = k
print(kmax)


def problemB(n, s):
	dicti = {}
	for i in range(n):
		sub = s[i:i + 2]
		if sub in dicti:
			dicti[sub] += 1
		else:
			dicti[sub] = 1
	return max(dicti, key=dicti.get)
n = int(input())
s = input()
print(problemB(n, s))


n = int(input())
l = input()
m = -1
a = ''
for i in range(1, n):
	s = l[i - 1:i + 1]
	c = 0
	for j in range(i, n - 1):
		if s == l[j:j + 2]:
			c = c + 1
	if c > m:
		m = c
		a = s
print(a)


import sys
n = sys.stdin.readline()
n = int(n)
lista = sys.stdin.readline()
dicti = dict()
for i in range(1, n):
	anag = lista[i - 1:i + 1]
	if anag in dicti:
		dicti[anag] += 1
	else:
		dicti[anag] = 1
max_val = 0
max_key = None
for (k, v) in dicti.items():
	if v > max_val:
		max_val = v
		max_key = k
print(max_key)


n = int(input())
s = input()
l = [s[i - 1] + s[i] for i in range(1, len(s))]
d = {}
for i in l:
	if i in d:
		d[i] += 1
	else:
		d[i] = 1
max = 0
act = ''
for i in d:
	if d[i] > max:
		max = d[i]
		act = i
print(act)


l = []
q = []
n = int(input())
s = input().rstrip()
x = list(s)
for i in range(0, len(x) - 1):
	t = x[i:i + 2]
	if ''.join(t) not in l:
		l.append(''.join(t))
		q.append(1)
	else:
		V = l.index(''.join(t))
		q[V] += 1
F = max(q)
C = q.index(F)
print(l[C])


n = int(input())
s = input()
ans = s[:2]
ma = 1
for k in range(0, n - 1):
	t = s[k:k + 2]
	cnt = 0
	for i in range(k, n - 1):
		if s[i:i + 2] == t:
			cnt += 1
	if cnt > ma:
		ma = cnt
		ans = t
print(ans)


n = int(input())
string = input()
ls = list(string.strip())
res = 0
for i in range(n - 1):
	cur = 0
	for j in range(n - 1):
		if ls[j] == ls[i] and ls[j + 1] == ls[i + 1]:
			cur += 1
	if res < cur:
		res = cur
		ans = [ls[i], ls[i + 1]]
ans_str = ''.join(ans)
print(ans_str)


def f(s, t):
	ans = 0
	for i in range(0, len(s) - 1):
		if s[i:i + 2] == t:
			ans += 1
	return ans
n = int(input())
s = input()
ans = ''
c = 0
for i in range(0, n - 1):
	t = f(s, s[i:i + 2])
	if t > c:
		ans = s[i:i + 2]
		c = t
print(ans)


import math
import sys, collections
MAXN = 10000001

def file():
	sys.stdin = open('input.py', 'r')
	sys.stdout = open('output.py', 'w')

def get_array():
	l = list(map(int, input().split()))
	return l

def get_2_ints():
	(a, b) = map(int, input().split())
	return (a, b)

def get_3_ints():
	(a, b, c) = map(int, input().split())
	return (a, b, c)

def sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, mt.ceil(mt.sqrt(MAXN))):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def getFactorization(x):
	ret = list()
	while x != 1:
		ret.append(spf[x])
		x = x // spf[x]
	return ret

def getFloor(A, x):
	(left, right) = (0, len(A) - 1)
	(ind, floor) = (-1, -1)
	while left <= right:
		mid = (left + right) // 2
		if x < A[mid]:
			right = mid - 1
		else:
			floor = A[mid]
			ind = mid
			left = mid + 1
	return ind
mod = 10 ** 9 + 7

def main():
	n = int(input())
	s = input()
	c = 0
	for i in range(n - 1):
		st = s[i] + s[i + 1]
		stc = 0
		for j in range(n - 1):
			temp = s[j] + s[j + 1]
			if temp == st:
				stc += 1
		if stc > c:
			ans = st
			c = stc
	print(ans)
main()


import sys

def solution(n, str_in):
	n_grams = []
	answer = ''
	max_count = 0
	for i in range(len(str_in) - 1):
		n_gram = str_in[i:i + 2]
		if len(n_gram) == 2:
			n_grams.append(str_in[i:i + 2])
	n_grams = list(set(n_grams))
	for n_gram in n_grams:
		count = 0
		for i in range(len(str_in) - 1):
			if n_gram == str_in[i:i + 2]:
				count += 1
		if count > max_count:
			answer = n_gram
			max_count = count
	return answer
n = sys.stdin.readline()
while n:
	str_in = sys.stdin.readline().strip()
	print(solution(int(n), str_in))
	n = sys.stdin.readline()


num = int(input())
string = input()
dic = {}
for i in range(1, num):
	a = string[i - 1] + string[i]
	if a not in dic:
		dic[a] = 1
	else:
		dic[a] += 1
max = 0
a = 0
for (i, j) in dic.items():
	if j > max:
		max = j
		a = i
print(a)


n = int(input())
a = input()
b = []
d = {}
q = a[:-1]
w = a[1:]
for i in range(n - 1):
	b.append(int(str(ord(q[i])) + str(ord(w[i]))))
for i in b:
	if i not in d:
		d[i] = 1
	else:
		d[i] += 1
c = 0
for (i, j) in d.items():
	if j > c:
		c = j
		maxa = i
print(chr(maxa // 100) + chr(maxa % 100))


n = int(input())
s = input()[:n]
a = []
b = []
for i in range(len(s) - 1):
	a.append(s[i] + s[i + 1])
for i in a:
	b.append(a.count(i))
x = b.index(max(b))
print(a[x])


n = int(input())
s = input().strip()
a = set()
for i in range(n - 1):
	a.add(s[i:i + 2])
mx = 0
for j in a:
	k = 0
	for i in range(n - 1):
		if j == s[i:i + 2]:
			k += 1
	if k > mx:
		mx = k
		ans = j
print(ans)


x = input()
s = input()
maximo = 0
grande = 0
for i in range(len(s) - 1):
	aux_s = s[i:i + 2]
	maximo = 0
	j = 0
	for j in range(len(s) - 1):
		if aux_s == s[j:j + 2]:
			maximo = maximo + 1
			if maximo > grande:
				grande = maximo
				palabra_grande = aux_s
print(palabra_grande)


n = int(input())
s = input()
c = {}
for i in range(n - 1):
	p = s[i] + s[i + 1]
	m = c.setdefault(p, 0)
	c[p] = m + 1
best = ''
c[best] = 0
for (g, m) in c.items():
	if m > c[best]:
		best = g
print(best)


from sys import exit
mat = [[0 for i in range(26)] for j in range(26)]
n = int(input())
st = input()
for i in range(26):
	for j in range(26):
		cnt = 0
		st1 = chr(65 + i) + chr(65 + j)
		for k in range(n - 1):
			if st[k] == st1[0] and st[k + 1] == st1[1]:
				cnt += 1
		mat[i][j] = cnt
mx = -1
for i in range(26):
	for j in range(26):
		mx = max(mx, mat[i][j])
for i in range(26):
	for j in range(26):
		if mat[i][j] == mx:
			print(chr(65 + i) + chr(65 + j))
			exit(0)


def f1(s1, s2):
	ans = 0
	for i in range(0, len(s1) - 1):
		if s1[i:i + 2] == s2:
			ans += 1
	return ans
n = int(input())
s = str(input())
ans = 0
anss = ''
for i in range(65, 91):
	for j in range(65, 91):
		if f1(s, chr(i) + chr(j)) > ans:
			ans = f1(s, chr(i) + chr(j))
			anss = chr(i) + chr(j)
print(anss)


n = int(input())
string = input()
res = 0
for i in range(len(string) - 1):
	cur = 0
	for j in range(i, len(string) - 1):
		if string[i] == string[j] and string[i + 1] == string[j + 1]:
			cur += 1
	if res < cur:
		res = cur
		ans = string[i] + string[i + 1]
print(ans)


n = int(input())
s = input()
d = {}
for i in range(n - 1):
	x = s[i] + s[i + 1]
	if x not in d:
		d[x] = 1
	else:
		d[x] += 1
maximum = 0
ans = ''
for key in d.keys():
	if d[key] > maximum:
		maximum = d[key]
		ans = key
print(ans)


n = int(input())
d = input()
dic = {}
for i in range(len(d) - 1):
	x = d[i] + d[i + 1]
	if x not in dic:
		dic[x] = 1
		x = ''
	else:
		dic[x] += 1
		x = ''
maior = 0
for i in sorted(dic):
	if dic[i] > maior:
		maior = dic[i]
for j in dic:
	if maior == dic[j]:
		print(j)
		break


n = int(input())
s = input()
doublegramm = None
max_amount = 0
for i in range(0, len(s) - 1):
	x = ord(s[i])
	y = ord(s[i + 1])
	amount = 0
	for j in range(0, len(s) - 1):
		if ord(s[j]) == x and ord(s[j + 1]) == y:
			amount += 1
	if amount > max_amount:
		max_amount = amount
		doublegramm = s[i] + s[i + 1]
print(doublegramm)


n = int(input())
string = input()
dict = {}
for i in range(n - 1):
	sub = string[i:i + 2]
	if sub in dict.keys():
		dict[sub] += 1
		continue
	dict[sub] = 1
item = dict[string[0:2]]
answer = string[0:2]
for i in dict.keys():
	if item < dict[i]:
		item = dict[i]
		answer = i
print(answer)


n = int(input())
s = input()
d = {}
for i in range(n - 1):
	x = s[i] + s[i + 1]
	d[x] = d.get(x, 0)
	d[x] += 1
max = 0
for x in d:
	if d[x] > max:
		max = d[x]
		sub = x
print(sub)


n = int(input())
arr = input()
freq = {}
i = 0
j = 1
for i in range(len(arr) - 1):
	if arr[i] + arr[i + 1] in freq:
		freq[arr[i] + arr[i + 1]] = freq[arr[i] + arr[i + 1]] + 1
	else:
		freq[arr[i] + arr[i + 1]] = 1
print(max(freq, key=freq.get))


import re
n = int(input())
string = input()
(left, right) = (-1, 1)
(bestLeft, bestRight) = (0, 2)
count = 0
for i in range(len(string) - 1):
	left += 1
	right += 1
	capital = len(re.findall('(?={})'.format(string[left:right]), string))
	if capital > count:
		count = capital
		bestLeft = left
		bestRight = right
print(string[bestLeft:bestRight])


n = int(input())
s = input()
h = [s[i] + s[i + 1] for i in range(n - 1)]
hh = list(set(h))
g = 0
R = 0
for i in hh:
	x = h.count(i)
	if x > g:
		g = x
		R = i
print(R)


n = int(input())
s = input().upper()
dic = {}
for i in range(n - 1):
	if s[i:i + 2] not in dic:
		dic[s[i:i + 2]] = 1
	else:
		dic[s[i:i + 2]] += 1
print(list(dic.keys())[list(dic.values()).index(max(dic.values()))])


size = int(input())
sequence = input()
l_dict = {}
for i in range(0, size - 1):
	l_dict[sequence[i] + sequence[i + 1]] = l_dict.setdefault(sequence[i] + sequence[i + 1], 0) + 1
print(sorted(l_dict.items(), key=lambda item: item[1], reverse=True).pop(0)[0])


tam = int(input())
string = input()
max = -1
max_index = -1
for i in range(0, len(string) - 1):
	count = 0
	two_gram = string[i:i + 2]
	if max_index != -1 and two_gram == string[max_index:max_index + 2]:
		continue
	for j in range(0, len(string) - 1):
		if two_gram == string[j:j + 2]:
			count += 1
	if count > max:
		max = count
		max_index = i
print(string[max_index:max_index + 2])


n = int(input())
s = input()
ar = []
for i in range(n - 1):
	temp = s[i:i + 2]
	ar.append(0)
	for j in range(n - 1):
		if temp == s[j:j + 2]:
			ar[i] += 1
ans = ar.index(max(ar))
print(s[ans:ans + 2])


n = int(input())
s = input()
hMap = {}
i = 0
while i + 1 < n:
	h = s[i] + s[i + 1]
	if h in hMap:
		hMap[h] += 1
	else:
		hMap[h] = 1
	i += 1
(m, ans) = (0, '')
for (key, val) in hMap.items():
	if val >= m:
		m = val
		ans = key
print(ans)


def main():
	input()
	string = input()
	dict_du = {}
	for i in range(len(string) - 1):
		if string[i:i + 2] in dict_du:
			dict_du[string[i:i + 2]] += 1
		else:
			dict_du[string[i:i + 2]] = 1
	print([i for (i, j) in sorted(dict_du.items(), key=lambda x: x[1], reverse=True)][0])
main()


num_len = eval(input())
string = input()
two_gram_dictionary = {}
for i in range(len(string) - 1):
	two_gram_dictionary[string[i] + string[i + 1]] = 0
for i in range(len(string) - 1):
	two_gram_dictionary[string[i] + string[i + 1]] += 1
ans_num = 0
for i in two_gram_dictionary.keys():
	if two_gram_dictionary[i] > ans_num:
		ans_num = two_gram_dictionary[i]
		ans = i
print(ans)


n = int(input())
s = input()
answer = ''
maxcnt = 0
for i in range(len(s) - 1):
	cnt = 0
	curr = s[i:i + 2]
	for j in range(len(s)):
		if s[j:j + 2] == curr:
			cnt += 1
	if maxcnt < cnt:
		answer = curr
		maxcnt = cnt
print(answer)


n = int(input())
s = input()
cnt = dict()
for i in range(1, n):
	bigram = s[i - 1:i + 1]
	if bigram not in cnt:
		cnt[bigram] = 0
	cnt[bigram] += 1
maxv = 0
for v in cnt.values():
	maxv = max(maxv, v)

def run():
	for k in cnt:
		if cnt[k] == maxv:
			print(k)
			return
run()


input()
s = input()
Dict = {}
for i in range(1, len(s)):
	s1 = s[i - 1] + s[i]
	if s1 in Dict:
		Dict[s1] += 1
	else:
		Dict[s1] = 1
it = 0
for d in Dict:
	if it < Dict[d]:
		it = Dict[d]
		s = d
print(s)


from collections import Counter
a = int(input())
s = str(input())
res = []
for i in range(1, a):
	res.append(str(s[i - 1] + s[i]))
res = list(zip(Counter(res).keys(), Counter(res).values()))

def val(item):
	return item[1]
res.sort(key=val, reverse=True)
print(res[0][0])


(n, s) = (int(input()), input())
mylist = []
for i in range(n - 1):
	curr = s[i] + s[i + 1]
	mylist.append(curr)
print(max(mylist, key=mylist.count))


(n, s) = (int(input()), input())
(List, Sort) = ([], [])
for i in range(n - 1):
	List.append(s[i:i + 2])
for k in set(List):
	Sort.append([k, List.count(k)])
Sort.sort(key=lambda x: x[1])
print(Sort[-1][0])


import re
n = int(input())
s = input()
best = ['', 0]
for i in range(n - 1):
	gram = ''.join(s[i:i + 2])
	ans = len(re.findall('(?={0})'.format(gram), s))
	if ans > best[1]:
		best = (gram, ans)
print(best[0])


n = int(input())
s = input()
d = {}
for i in range(n - 2, -1, -1):
	ss = s[i:i + 2]
	if not d.get(ss):
		d[ss] = 0
	d[ss] += 1
print(max(d, key=lambda x: d[x]))


N = int(input())
S = input()
D = {}
for i in range(1, N):
	D[S[i - 1:i + 1]] = D.get(S[i - 1:i + 1], 0) + 1
print(max([(i[1], i[0]) for i in D.items()])[1])


from itertools import product
n = int(input())
a = input()
perm = product(set(a), repeat=2)
temp_dict = {}
for iteration in perm:
	temp_dict[''.join(iteration)] = 0
for i in range(n - 1):
	temp_dict[a[i:i + 2]] += 1
mx = 0
s = ''
for (key, value) in temp_dict.items():
	if value > mx:
		mx = value
		s = key
print(s)


t = int(input())
s = input()
ls = []
setls = {}
for i in range(0, len(s) - 1):
	ls.append(s[i] + s[i + 1])
setls = set(ls)
max = ' '
maxval = 0
for items in setls:
	temp = ls.count(items)
	if temp > maxval:
		maxval = temp
		max = items
print(max)


import sys
from bisect import bisect_left, bisect_right
from collections import deque, Counter
from math import gcd, sqrt, factorial, ceil, log
from itertools import permutations
inf = float('inf')
mod = 1000000007
mini = 1000000007

def fact(n):
	if n == 0:
		return 1
	p = 1
	d = 10 ** 9 + 7
	for i in range(1, n + 1):
		p = p * i
		p = p % d
	return p

def ncr(n, r):
	d = 10 ** 9 + 7
	num = fact(n)
	den = fact(r) * fact(n - r) % d
	den = pow(den, d - 2, d)
	return num * den % d

def sieve(n):
	prime = [True for i in range(n + 1)]
	lst = [0] * (n + 1)
	p = 2
	while p * p <= n:
		if prime[p]:
			lst[p] = p
			for i in range(p * p, n + 1, p):
				if prime[i] == True:
					prime[i] = False
					lst[i] = p
		p = p + 1
	for i in range(1, n + 1):
		if lst[i] == 0:
			lst[i] = i
	mylist = [0] * (n + 1)
	for i in range(2, n + 1):
		mylist[lst[i]] = mylist[lst[i]] + 1
	return mylist

def binary(number):
	result = 0
	while number:
		result = result + 1
		number = number & number - 1
	return result

def calculate_factors(n):
	hh = [1] * (n + 1)
	p = 2
	while p * p < n:
		if hh[p] == 1:
			for i in range(p * 2, n, p):
				hh[i] = 0
		p += 1
	total = 1
	for p in range(2, n + 1):
		if hh[p] == 1:
			count = 0
			if n % p == 0:
				while n % p == 0:
					n = int(n / p)
					count += 1
				total *= count + 1
	return total

def prime_factors(n):
	i = 2
	factors = set()
	while i * i <= n:
		if n % i:
			i += 1
		else:
			n //= i
			factors.add(i)
	if n > 1:
		factors.add(n)
	if len(factors) == 2:
		return True
	else:
		return False

def isPrime(n):
	if n == 2 or n == 3:
		return True
	if n % 2 == 0 or n < 2:
		return False
	for i in range(3, int(n ** 0.5) + 1, 2):
		if n % i == 0:
			return False
	return True

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
n = int(input())
string = input()
max_count = 0
for i in range(n - 1):
	mystr = string[i:i + 2]
	curr = 0
	for j in range(n - 1):
		if string[j:j + 2] == mystr:
			curr = curr + 1
	if curr > max_count:
		max_count = curr
		fav = mystr
print(fav)


n = int(input())
s = str(input())
arr = {}
for i in range(len(s) - 1):
	if s[i:i + 2] in arr.keys():
		arr[s[i:i + 2]] += 1
	else:
		arr[s[i:i + 2]] = 1
a = list(arr.values())
x = max(a)
for i in arr.keys():
	if arr[i] == x:
		ans = i
		break
print(ans)


import sys
n = sys.stdin.readline()
while n:
	s = sys.stdin.readline()
	res = {}
	for i in range(1, len(s)):
		bigram = s[i - 1] + s[i]
		if bigram in res:
			res[bigram] += 1
		else:
			res[bigram] = 1
	values = list(res.values())
	keys = list(res.keys())
	print(keys[values.index(max(values))])
	n = sys.stdin.readline()


n = int(input())
s = input()
d = dict()
for i in range(1, n):
	if s[i - 1:i + 1] in d.keys():
		d[s[i - 1:i + 1]] += 1
	else:
		d[s[i - 1:i + 1]] = 1
print(max(d, key=d.get))


grams = {}
noc = int(input())
maxlen = int(-10000000000000.0)
s = input()
winner = ''
for i in range(noc - 1):
	curr = s[i:i + 2]
	grams[curr] = grams.get(curr, 0) + 1
	maxlen = max(maxlen, grams[curr])
	if maxlen == grams[curr]:
		winner = curr
print(winner)


from collections import *
import sys
input = lambda : sys.stdin.readline().strip()
orddict = OrderedDict
defdict = defaultdict
counter = Counter

def nextint():
	return int(input())

def snexts():
	return input().split(' ')

def snextint():
	return map(int, snexts())
n = nextint()
s = input()
grams = defaultdict(int)
for i in range(n - 1):
	grams[s[i] + s[i + 1]] += 1
mv = -10
gram = ''
for (k, v) in grams.items():
	if v > mv:
		mv = v
		gram = k
print(gram)


n = int(input())
s = input()
a = [x for x in s]
dic = {}
for i in range(n - 1):
	s1 = a[i] + a[i + 1]
	if s1 in dic:
		dic[s1] = dic[s1] + 1
	else:
		dic[s1] = 1
ans = 0
res = ''
for x in dic:
	if dic[x] > ans:
		ans = dic[x]
		res = x
print(res)


l = int(input())
st = input()
dict = {}
for i in range(l - 1):
	if st[i] + st[i + 1] not in dict:
		dict[st[i] + st[i + 1]] = 1
	elif st[i] + st[i + 1] in dict:
		dict[st[i] + st[i + 1]] += 1
li = []
for i in dict:
	li.append(dict[i])
lii = []
for i in dict:
	if dict[i] == max(li):
		lii.append(i)
print(lii[0])


def inamount(s1, s2):
	k = 0
	for i in range(len(s1) - 1):
		s = s1[i] + s1[i + 1]
		if s == s2:
			k += 1
	return k

def isrpt(x, s):
	f = True
	for i in range(len(x)):
		if x[i] == s:
			f = False
	return f
n = int(input())
s = input()
x = []
for i in range(len(s) - 1):
	w = s[i] + s[i + 1]
	if isrpt(x, w):
		x.append(w)
k = [0] * len(x)
for i in range(len(x)):
	k[i] = inamount(s, x[i])
print(x[k.index(max(k))])


n = int(input())
s = input()
d = dict()
z = 0
key = ''
for i in range(len(s) - 1):
	r = s[i:i + 2]
	if not r in d:
		d[r] = 1
	else:
		d[r] += 1
for pair in d.items():
	if pair[1] > z:
		z = pair[1]
		key = pair[0]
print(key)


n = int(input())
s = input()
str = list(s)
new = {}
for i in range(n - 1):
	sss = str[i] + str[i + 1]
	if sss in new.keys():
		new[sss] += 1
	else:
		new[sss] = 1
m = max(new.values())
key = list(new.keys())
val = list(new.values())
index = val.index(m)
print(key[index])


n = int(input())
s = input()
cnt = {}
for (a, b) in enumerate(s):
	if a < len(s) - 1:
		ns = str(s[a] + s[a + 1])
		if ns in cnt:
			cnt[ns] += 1
		else:
			cnt[ns] = 1
mx = 0
for (i, j) in cnt.items():
	if mx < j:
		mx = j
		ans = i
print(ans)


n = int(input())
s = list(input())
cnt = {}
for i in range(n - 1):
	k = ''.join(s[i:i + 2])
	if k in cnt:
		cnt[k] += 1
	else:
		cnt[k] = 1
ans = ''
t = 0
for (k, v) in cnt.items():
	if t < v:
		ans = k
		t = v
print(ans)


n = int(input())
s = input()
twograms = {}
for i in range(n - 1):
	current_twogram = s[i:i + 2]
	if current_twogram in twograms:
		twograms[current_twogram] += 1
	else:
		twograms[current_twogram] = 1
most_twogram = ['', 0]
for t in twograms:
	if twograms[t] > most_twogram[1]:
		most_twogram[0] = t
		most_twogram[1] = twograms[t]
print(most_twogram[0])


n = int(input())
s = input()
a = []
b = []
for i in range(n - 1):
	k = 0
	for j in range(n - 1):
		if s[i] == s[j] and s[i + 1] == s[j + 1]:
			k += 1
	b.append(s[i] + s[i + 1])
	a.append(k)
mx = a.index(max(a))
print(b[mx])


N = int(input())
S = input()
D = {}
for index in range(N - 1):
	G = S[index:index + 2]
	D[G] = D.get(G, 0) + 1
print(sorted(D.items(), key=lambda x: x[1])[-1][0])


n = int(input())
s = input()
ans = {}
for i in range(n - 1):
	h = s[i] + s[i + 1]
	ans[h] = ans.get(h, 0) + 1
max = 0
outp = ''
for i in ans:
	if ans[i] > max:
		max = ans[i]
		outp = i
print(outp)


z = input
mod = 10 ** 9 + 7
from collections import *
from queue import *
from sys import *
from collections import *
from math import *
from heapq import *
from itertools import *
from bisect import *
from collections import Counter as cc
from math import factorial as f

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def prime(x):
	p = ceil(x ** 0.5) + 1
	for i in range(2, p):
		if x % i == 0:
			return 0
	return 1
n = int(z())
l = z()
ans = {}
for i in range(n - 1):
	x = l[i:i + 2]
	try:
		ans[x] += 1
	except:
		ans[x] = 1
va = list(ans.values())
x = max(va)
t = va.index(x)
print(list(ans)[t])


n = int(input())
a = input()
l = 0
for i in range(n - 1):
	s = 0
	for j in range(i, n - 1):
		if a[i:i + 2] == a[j:j + 2]:
			s = s + 1
	if s > l:
		l = s
		b = a[i:i + 2]
print(b)


import sys
from math import *

def minp():
	return sys.stdin.readline().strip()

def mint():
	return int(minp())

def mints():
	return map(int, minp().split())
n = mint()
s = list(minp())
d = dict()
for i in range(1, len(s)):
	k = s[i - 1] + s[i]
	d[k] = d.get(k, 0) + 1
mc = 0
ms = ''
for i in d:
	if d[i] > mc:
		mc = d[i]
		ms = i
print(ms)


input()
s = input().strip()
n = len(s)
count = {}
for i in range(n - 1):
	two_gram = s[i:i + 2]
	if two_gram in count:
		continue
	count[two_gram] = 1
	for j in range(i + 1, n):
		cur = s[j:j + 2]
		if cur == two_gram:
			count[cur] += 1
ans = 0
ans_Str = ''
for two_gram in count:
	if count[two_gram] > ans:
		ans = count[two_gram]
		ans_Str = two_gram
print(ans_Str)


l = int(input())
n = str(input())
i = j = 0
maximum = 0
ans = ''
new_string = ''
test = []
while i < len(n) - 1:
	string = ''
	string = n[i] + n[i + 1]
	new_string = new_string + ' ' + string
	i = i + 1
new_string = new_string.lstrip()
while j < len(new_string) - 1:
	final = ''
	final = new_string[j] + new_string[j + 1]
	y = new_string.count(final)
	maximum = max(maximum, y)
	if y == maximum:
		ans = final
	j = j + 3
print(ans)


from collections import defaultdict
n = int(input())
st = input()
freq = defaultdict(int)
subs = set()
for i in range(n - 1):
	sub = st[i] + st[i + 1]
	subs.add(sub)
maxm = -10 ** 18
ans = ''
for sub in subs:
	for i in range(n - 1):
		if sub == st[i] + st[i + 1]:
			freq[sub] += 1
			if maxm < freq[sub]:
				ans = sub
				maxm = freq[sub]
print(ans)


n = int(input())
s = str(input())
S1 = []
S2 = []
i = 0
while i <= n - 2:
	S1.append(s[i] + s[i + 1])
	i += 2
i = 1
while i <= n - 2:
	S2.append(s[i] + s[i + 1])
	i += 2
S = S1 + S2
S = sorted(S, key=lambda x: x[0])
S = sorted(S, key=lambda x: x[1])
k = len(S)
SS = []
c = 1
for i in range(1, k):
	if S[i] == S[i - 1]:
		c = c + 1
	else:
		SS.append(c)
		c = 1
	if i == k - 1:
		SS.append(c)
if SS != []:
	a = max(SS)
	f = SS.index(a)
	p = 0
	for i in range(0, f + 1):
		p = p + SS[i]
	print(S[p - 1])
else:
	print(S[0])


import sys
data = sys.stdin.readlines()
lis = []
for line in data:
	lis.append(line)

def dadd(key, dic):
	if key in dic:
		dic[key] += 1
	else:
		dic[key] = 1
_ = lis[0]
word = lis[1]
counter = {}
for i in range(len(word) - 2):
	gram = word[i:i + 2]
	dadd(gram, counter)
counter = list(counter.items())
counter.sort(key=lambda x: x[1])
print(counter[-1][0])


N = int(input())
s = input()
ans = ''
mx = 0
for i in range(N - 1):
	san = s[i] + s[i + 1]
	cnt = 1
	for j in range(N - 1):
		san2 = s[j] + s[j + 1]
		if san == san2:
			cnt += 1
	if cnt > mx:
		mx = cnt
		ans = san
print(ans)


n = int(input())
string = str(input())
(max_, temp) = (0, '')
if n >= 2 and n <= 100:
	for i in range(len(string) - 1):
		temp1 = string[i:i + 2]
		count = 0
		for i in range(len(string) - 1):
			temp2 = string[i:i + 2]
			if temp1 == temp2:
				count = count + 1
		if count > max_:
			max_ = count
			temp = temp1
print(temp)


import itertools
max1 = 0
k = input()
s = input()
r = set(s)
t = r
m = itertools.product(t, r)
m = list(m)
n = []
for i in range(len(m)):
	m[i] = list(m[i])
	st = ''
	st = st + str(m[i][0]) + str(m[i][1])
	n.append(st)
for i in n:
	f = s.count(i)
	if f > max1:
		b = i
		max1 = f
print(b)


T = int(input())
n = input()
u = []
p = []
for j in range(len(n) - 1):
	u.append(n[j] + n[j + 1])
s = list(set(u))
for i in range(len(s)):
	p.append(u.count(s[i]))
print(s[p.index(max(p))])


import sys

def most_common(alist):
	return max(set(alist), key=alist.count)

def main():
	n = int(input())
	s = str(input()).upper()
	if 2 >= n >= 100 or n != len(s):
		print('please check the constrains')
		sys.exit()
	two_grams = []
	for i in range(n - 1):
		new_string = s[i] + s[i + 1]
		two_grams.append(new_string)
	print(most_common(two_grams))
main()


from collections import Counter
n = int(input())
s = input()
tg = []
for i in range(n - 1):
	tg.append(s[i] + s[i + 1])
d = Counter(tg)
maximum = max(d, key=d.get)
print(maximum)


import operator
inputa = input('')
a = int(inputa)
inputb = input('')
b = str(inputb)

def main(inputa, inputb):
	head = 0
	options = []
	duplicates = {}
	for i in range(1, inputa):
		options.append(inputb[head:head + 2])
		head += 1
	for i in set(options):
		duplicates[i] = options.count(i)
	answer = max(duplicates.items(), key=operator.itemgetter(1))[0]
	print(answer)
main(a, b)


n = int(input())
str = input()
max_bi = str[:2]
max_count = 1
for i in range(1, n - 1):
	if str[i:i + 2] == max_bi:
		max_count += 1
for i in range(1, n - 1):
	bi = str[i:i + 2]
	count = 1
	for j in range(i + 1, n - 1):
		if str[j:j + 2] == bi:
			count += 1
	if max_count < count:
		max_count = count
		max_bi = bi
print(max_bi)


import collections
n = int(input())
s = input()
mini = 0
l = []
for i in range(n - 1):
	l.append('{}{}'.format(s[i], s[i + 1]))
freq = collections.Counter(l)
for (key, val) in freq.items():
	if val > mini:
		mini = val
for (key, val) in freq.items():
	if val == mini:
		print(key)
		break


a = int(input())
s = input()
if a == 2:
	print(s)
	exit(0)
(maxi, ans) = (0, '')
for i in range(0, len(s) - 1):
	cnt = 0
	for j in range(i + 1, len(s)):
		if s[j:j + 2] == s[i:i + 2]:
			cnt += 1
	if cnt >= maxi:
		ans = s[i:i + 2]
		maxi = cnt
print(ans)


from collections import defaultdict as dd
n = int(input())
s = list(input())
d = dd(int)
for i in range(n - 1):
	x = s[i] + s[i + 1]
	d[x] += 1
ans = 0
st = ''
for i in d:
	if d[i] > ans:
		ans = d[i]
		st = i
print(st)


n = int(input())
s = input()
d = {}
for i in range(0, n - 1, 2):
	st = s[i] + s[i + 1]
	d[st] = d.get(st, 0) + 1
for i in range(1, n - 1, 2):
	st = s[i] + s[i + 1]
	d[st] = d.get(st, 0) + 1
m = 0
st = ''
for i in d.keys():
	if d[i] > m:
		st = i
		m = d[i]
print(st)


b = int(input(''))
a = input('')
t = []
p = 0
z = []
j = 0
n = 0
l = 0
import copy
e = copy.deepcopy(n)
for i in range(len(a) - 1):
	t.append(a[p] + a[p + 1])
	p = p + 1
for il in range(len(t)):
	z.append(t.count(t[j]))
	j = j + 1
n = z.index(max(z))
print(t[n])


s = input()
s = input()
st = ''
res = ''
mx = 0
for i in range(len(s) - 1):
	st = s[i:i + 2]
	k = 0
	for j in range(len(s)):
		if st == s[j:j + 2]:
			k += 1
	if k > mx:
		mx = k
		res = st
print(res)


n = int(input())
s = input()
mostFrequent = 0
result = ''
for i in range(n - 1):
	count = 0
	for j in range(n):
		if s[i:i + 2] == s[j:j + 2]:
			count += 1
	if count > mostFrequent:
		mostFrequent = count
		result = s[i:i + 2]
print(result)


n = int(input())
s = input().strip()
d = {}
for i in range(n - 1):
	st = s[i] + s[i + 1]
	if st in d.keys():
		d[st] += 1
	else:
		d[st] = 1
maxx = 0
for i in d.keys():
	if d[i] > maxx:
		maxx = d[i]
		st = i
print(st)


n = int(input())
s = input().strip()
mp = {}
for i in range(1, n):
	ss = s[i - 1:i + 1]
	if ss not in mp.keys():
		mp[ss] = 0
	mp[ss] += 1
maxv = 0
ans = ''
for key in mp.keys():
	if maxv < mp[key]:
		maxv = mp[key]
		ans = key
print(ans)


import math as mt
import sys, string, bisect
input = sys.stdin.readline
from collections import deque, defaultdict
L = lambda : list(map(int, input().split()))
Ls = lambda : list(input().split())
M = lambda : map(int, input().split())
I = lambda : int(input())
n = I()
l = input().strip()
d = defaultdict(int)
c = 0
key = ''
for i in range(n - 1):
	k = l[i:i + 2]
	d[k] += 1
	if c < d[k]:
		c = d[k]
		key = k
print(key)


q = int(input())
s = str(input())
max_count = 0
answer = ''
for i in range(len(s) - 1):
	s1 = s[i]
	s2 = s[i + 1]
	count = 0
	for j in range(len(s) - 1):
		if s1 == s[j] and s2 == s[j + 1]:
			count += 1
	if count > max_count:
		max_count = count
		answer = s1 + s2
print(answer)


n = input()
stra = input()
cnt = 0
ans = stra[0] + stra[1]
for i in range(0, len(stra) - 1):
	st = stra[i] + stra[i + 1]
	num = 0
	for j in range(i + 1, len(stra)):
		if st == stra[j - 1] + stra[j]:
			num += 1
	if num > cnt:
		cnt = num
		ans = st
print(ans)


from collections import Counter
l = []
n = int(input())
s = input()
for i in range(n - 1):
	l.append(s[i] + s[i + 1])
(mx, nm) = Counter(l).most_common(1)[0]
print(mx)


def read_tokens():
	return input().strip().split(' ')

def read_ints():
	return [int(s) for s in read_tokens()]
(n,) = read_ints()
s = input().strip()

def solve(s: str) -> str:
	hs = {}
	n = len(s)
	for i in range(n):
		for j in range(i + 1, n):
			if j - i == 1:
				curr = s[i:j + 1]
				if curr in hs:
					hs[curr] += 1
				else:
					hs[curr] = 1
	curr_k = None
	curr_v = -1
	for (k, v) in hs.items():
		if curr_v < v:
			curr_v = v
			curr_k = k
	return curr_k
print(solve(s))


n = int(input())
s = list(str(input()))
d = {}
t = ''
for i in range(n - 1):
	if s[i] + s[i + 1] in d:
		d[s[i] + s[i + 1]] += 1
	else:
		d[s[i] + s[i + 1]] = 0
n = max(d.values())
for i in d:
	if d[i] == n:
		print(i)
		break


n = int(input())
s = input()
mas = []
c = 0
now = ''
for i in range(n - 1):
	mas.append(s[i:i + 2])
for i in range(1, n - 2):
	mas.append(s[i:i + 2])
for el in mas:
	if mas.count(el) > c:
		now = el
		c = mas.count(el)
print(now)


length = int(input())
string = input()
result = {}
for i in range(length):
	if string[i:i + 2] not in result.keys():
		result[string[i:i + 2]] = 1
	else:
		result[string[i:i + 2]] += 1
for (temp, time) in result.items():
	if time == max(result.values()):
		print(temp)
		break


n = input()
s = input()
cnt = {}
for i in range(0, len(s) - 1):
	if s[i] + s[i + 1] not in cnt:
		cnt[s[i] + s[i + 1]] = 0
	cnt[s[i] + s[i + 1]] += 1
max_cnt = list(cnt.keys())[0]
for i in cnt:
	if cnt[i] > cnt[max_cnt]:
		max_cnt = i
print(max_cnt)


n = int(input())
s = input()
res = ''
maxCount = 0
for i in range(n - 1):
	count = 0
	for j in range(n - 1):
		if s[i] == s[j] and s[i + 1] == s[j + 1]:
			count += 1
	if count > maxCount:
		maxCount = count
		res = s[i] + s[i + 1]
print(res)


n = int(input())
s = input()
lis = dict()
cur = [s[0], s[1]]
st = cur[0] + cur[1]
lis[st] = 1
for i in range(2, n):
	cur[0] = cur[1]
	cur[1] = s[i]
	st = cur[0] + cur[1]
	if st in lis:
		lis[st] += 1
	else:
		lis[st] = 1
ma = -1
for item in lis:
	if lis[item] > ma:
		ma = lis[item]
		ans = item
print(ans)


from sys import stdin
from collections import Counter
stdin.readline()
s = stdin.readline().rstrip()
c = Counter()
for i in range(len(s) - 1):
	c[s[i:i + 2]] += 1
print(c.most_common()[0][0])


n = int(input())
s = input()
c = 0
m = 0
x = ''
for i in range(n - 1):
	c = 0
	for j in range(0, n - 1, 1):
		if s[j] == s[i] and s[j + 1] == s[i + 1]:
			c += 1
	if c > m:
		m = c
		x = s[i] + s[i + 1]
print(x)


n = int(input())
s = input()
a = {}
for i in range(n - 1):
	a[s[i:i + 2]] = a.get(s[i:i + 2], 0)
	a[s[i:i + 2]] += 1
l = max(a.values())
for i in a:
	if a[i] == l:
		print(i)
		break


def CheckOverLap(String, Gram):
	c = 0
	i = 0
	while True:
		i = String.find(Gram, i) + 1
		if i > 0:
			c += 1
		else:
			return c
max = 0
n = int(input())
S = input()
index = 0
for i in range(n - 1):
	c = CheckOverLap(S, S[i:i + 2])
	if c > max:
		index = i
		max = c
print(S[index:index + 2])


input()
line = input()
qty = {}
maxkey = 'AA'
qty[maxkey] = 0
for i in range(len(line) - 1):
	k = line[i] + line[i + 1]
	if k not in qty:
		qty[k] = 1
	else:
		qty[k] += 1
	if qty[k] > qty[maxkey]:
		maxkey = k
print(maxkey)


tamanho = int(input())
string = input()
dic = {}
for i in range(tamanho - 1):
	tmp = string[i] + string[i + 1]
	if tmp in dic:
		dic[tmp] += 1
	else:
		dic[tmp] = 1
valores = list(dic.values())
chaves = list(dic.keys())
max = 0
indice = 0
for i in range(len(valores)):
	if valores[i] > max:
		max = valores[i]
		indice = i
print(chaves[indice])


import sys
input = sys.stdin.readline
N = int(input())
S = input().strip()

def most_common(lst):
	return max(((item, lst.count(item)) for item in set(lst)), key=lambda a: a[1])[0]
print(most_common([S[i:i + 2] for i in range(N - 1)]))


n = input()
s = input()
max = -1
for i in range(0, len(s) - 1):
	two_gram = s[i:i + 2]
	count = 0
	for i in range(0, len(s) - 1):
		if s[i:i + 2] == two_gram:
			count += 1
	if max < count:
		max = count
		max_2_gram = two_gram
print(max_2_gram)


def co(a, s):
	c = 0
	for i in range(len(s) - 1):
		if s[i] == a[0] and s[i + 1] == a[1]:
			c += 1
	return c
a = int(input())
s = input()
l = []
(count, ans) = (0, '')
for i in range(len(s) - 1):
	k = co(s[i:i + 2], s)
	l.append(k)
t = l.index(max(l))
print(s[t:t + 2])


n = int(input())
s = str(input())
listado = {}
for i in range(len(s) - 1):
	gram = s[i:i + 2]
	if gram in listado.keys():
		listado[gram] = listado[gram] + 1
	else:
		listado[gram] = 1
max_gram = ''
max_gram_value = 0
for i in listado.keys():
	if listado[i] > max_gram_value:
		max_gram_value = listado[i]
		max_gram = i
print(max_gram)


n = int(input())
s = input()
countDict = {}
for i in range(1, n):
	countDict[s[i - 1:i + 1]] = countDict.get(s[i - 1:i + 1], 0) + 1
print(sorted(countDict.items(), key=lambda x: (-x[1], x[0]))[0][0])


n = int(input())
s = input()
it = 0
prev = ''
keys = {}
for char in s:
	if char.isupper():
		it += 1
		if it != 2:
			prev = char
			continue
		try:
			if keys[prev + char] == 2:
				pass
			keys[prev + char] = keys[prev + char] + 1
		except:
			keys[prev + char] = 1
		it = 1
		prev = char
max_key = max(keys, key=lambda k: keys[k])
print(max_key, end='')


n = int(input())
s = input()
table = {}
for i in range(1, n):
	gram = s[i - 1:i + 1]
	table[gram] = table.get(gram, 0) + 1
(res, maxT) = (gram, table[gram])
for (k, v) in table.items():
	if v > maxT:
		maxT = v
		res = k
print(res)


n = int(input())
str1 = input()
lst = []
for i in range(len(str1) - 1):
	lst.append(str1[i:i + 2])
maxy = -1
for i in lst:
	if maxy <= lst.count(i):
		res = i
		maxy = lst.count(i)
print(res)


n = int(input())
s = input()
d = {}
max = ['', 0]
for i in range(n - 1):
	if s[i:i + 2] in d:
		d[s[i:i + 2]] += 1
	else:
		d[s[i:i + 2]] = 1
	if d[s[i:i + 2]] > max[1]:
		max[0] = s[i:i + 2]
		max[1] = d[s[i:i + 2]]
print(max[0])


x = int(input())
y = input()
a = []
z = []
for i in range(len(y) - 1):
	s = y[i] + y[i + 1]
	a.append(s)
for i in a:
	z.append(a.count(i))
print(a[z.index(max(z))])


t = int(input())
a = input()
m = 0
for i in range(t):
	word = a[i:i + 2]
	c = 1
	for j in range(t):
		if j in range(i, i + 2):
			continue
		elif a[j:j + 2] == word:
			c += 1
	if c > m:
		m = c
		ans = word
print(ans)


from sys import stdin, stdout

def main():
	n = int(stdin.readline())
	s = stdin.readline().strip()
	d = dict()
	largest = ''
	max_val = 0
	for i in range(n - 1):
		gram = s[i:i + 2]
		val = d.get(gram, 0) + 1
		d[gram] = val
		if val > max_val:
			largest = gram
			max_val = val
	stdout.write(str(largest) + '\n')
main()


import sys
input = sys.stdin.readline
from math import ceil, floor

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def nCr(n, k):
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def upper_bound(a, x, lo=0):
	hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if a[mid] < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def primefs(n):
	primes = {}
	while n % 2 == 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
MAXN = int(1000000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def factoriazation(x):
	ret = {}
	while x != 1:
		ret[spf[x]] = ret.get(spf[x], 0) + 1
		x = x // spf[x]
	return ret

def int_array():
	return list(map(int, input().strip().split()))

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
n = int(input())
s = input().strip()
dick = {}
for i in range(n - 1):
	ks = s[i] + s[i + 1]
	dick[ks] = dick.get(ks, 0) + 1
maxi = max(list(dick.values()))
for i in dick:
	if dick[i] == maxi:
		print(i)
		break


from collections import Counter
n = int(input())
s = input()
l = list()
for i in range(0, n - 1):
	temp = s[i:i + 2]
	l.append(temp)
c = Counter(l)
print(c.most_common()[0][0])


def main():
	n = int(input())
	s = input()
	maxc = 0
	ans = ''
	for i in range(n - 1):
		st = s[i:i + 2]
		count = 0
		for j in range(n - 1):
			if s[j:j + 2] == st:
				count += 1
		if maxc < count:
			maxc = count
			ans = st
	print(ans)
main()


n = int(input())
s = input()
d = {}
for x in range(n - 1):
	if not s[x:x + 2] in d:
		d[s[x:x + 2]] = 0
	d[s[x:x + 2]] += 1
a = 0
for (x, y) in d.items():
	if y > a:
		a = y
		w = x
print(w)


a = int(input())
l = input()
ans = 0
tt = ''
cnt = 0
l1 = []
for i in range(a - 1):
	dvu = l[i] + l[i + 1]
	if dvu in l1:
		pass
	else:
		l1.append(dvu)
		cnt = 0
		for j in range(a - 1):
			if dvu == l[j] + l[j + 1]:
				cnt += 1
		if cnt > ans:
			tt = dvu
			ans = cnt
print(tt)


def occurrences(string, sub):
	count = start = 0
	while True:
		start = string.find(sub, start) + 1
		if start > 0:
			count += 1
		else:
			return count
n = int(input())
st = input()
temp = ''
res = ''
max = 0
for i in range(0, n - 1):
	temp = st[i] + st[i + 1]
	if occurrences(st, temp) > max:
		max = occurrences(st, temp)
		res = temp
print(res)


n = eval(input())
s = input()
lst = []
for i in range(0, n - 1):
	lst.append(s[i:i + 2])
lst.sort()
lst.append('')
c = 0
ctmp = 0
tmp = lst[0]
for i in range(0, len(lst)):
	if lst[i] == tmp:
		c += 1
	else:
		if c > ctmp:
			ctmp = c
			index = i - 1
		tmp = lst[i]
		c = 1
print(lst[index])


n = int(input(''))
s = input('')
l = []
m = []
for i in range(len(s) - 1):
	if s[i] + s[i + 1] not in l:
		l.append(s[i] + s[i + 1])
for i in range(len(l)):
	count = 0
	for j in range(len(s) - 1):
		if s[j] + s[j + 1] == l[i]:
			count += 1
	m.append(count)
print(l[m.index(max(m))])


n = int(input())
s = input()
m = 0
dic = {}
for i in range(n - 1):
	x = s[i] + s[i + 1]
	dic[x] = dic.get(x, 0) + 1
for item in dic:
	if dic[item] > m:
		m = dic[item]
		s = item
print(s)


n = int(input())
s = input()
arr = []
d = {}
if len(s) == 2:
	print(s)
	exit(0)
for i in range(len(s)):
	for j in range(i + 1, len(s)):
		s1 = s[i:j + 1]
		if len(s1) == 2:
			d[s1] = d.get(s1, 0) + 1
			arr.append(s1)
		elif len(s1) > 2:
			break
max1 = max(d.values())
for ele in arr:
	if d[ele] == max1:
		print(ele)
		break


n = int(input())
s = input()
d = {}
for i in range(0, n - 1):
	if s[i:i + 2] in d:
		d[s[i:i + 2]] = d[s[i:i + 2]] + 1
	else:
		d[s[i:i + 2]] = 1
m = 0
ans = ''
for k in d:
	if d[k] > m:
		ans = k
		m = d[k]
print(ans)


n = int(input())
s = input()
l = list((s[i:i + 2] for i in range(len(s))))
new = list(set(l))
dic = {}
a = -1
b = ''
for i in range(len(new)):
	dic[new[i]] = l.count(new[i])
	if l.count(new[i]) > a and len(new[i]) == 2:
		a = l.count(new[i])
		b = new[i]
print(b)


x = int(input())
y = input()
z = {}
for i in range(x - 1):
	if y[i:i + 2] in z:
		z[y[i:i + 2]] += 1
	else:
		z[y[i:i + 2]] = 1
print(max(z, key=z.get))


int(input())
s = input()
A = []
string = ''
count = 0
for i in range(0, len(s) - 1):
	A.append(s[i] + s[i + 1])
for i in A:
	if A.count(i) > count:
		count = A.count(i)
		string = i
print(string)


n = int(input())
a = input()
d = {}
for i in range(1, n):
	if a[i - 1] + a[i] in d:
		d[a[i - 1] + a[i]] += 1
	else:
		d[a[i - 1] + a[i]] = 1
print(max(d, key=d.get))


n = int(input(''))
str = input('')
b = {}
for i in range(len(str) - 1):
	s = str[i] + str[i + 1]
	if s in b.keys():
		b[s] += 1
	else:
		b[s] = 1
max = 0
maxkey = ''
for i in b.keys():
	if b[i] > max:
		max = b[i]
		maxkey = i
print(maxkey)


input()
s1 = input()
s = [s1[i:i + 2] for i in range(len(s1))]
print(max(s, key=s.count))


import operator
l = int(input())
count = dict()
s = input()
for x in range(l - 1):
	count[s[x:x + 2]] = count.get(s[x:x + 2], 0) + 1
res = max(count.items(), key=operator.itemgetter(1))[0]
print(res)


n = int(input())
s = input()
apps = {}
pr = ''
m = 0
mk = ''
for ch in s:
	if pr != '':
		if pr + ch in apps.keys():
			apps[pr + ch] += 1
			if apps[pr + ch] > m:
				mk = pr + ch
				m = apps[pr + ch]
		else:
			apps[pr + ch] = 1
			if apps[pr + ch] > m:
				mk = pr + ch
				m = apps[pr + ch]
	pr = ch
print(mk)


n = int(input())
s = input()
d = []
ans = ''
max_ = 0
for i in range(n - 1):
	if not s[i] + s[i + 1] in d:
		d.append(s[i] + s[i + 1])
		f = 0
		for j in range(i, n - 1):
			if s[j] + s[j + 1] == s[i] + s[i + 1]:
				f += 1
		if f > max_:
			max_ = f
			ans = s[i] + s[i + 1]
print(ans)


len_s = int(input())
s = input()
mdict = {}
for i in range(len_s - 1):
	c = s[i:i + 2]
	if mdict.get(c, -1) == -1:
		mdict[c] = 1
	else:
		mdict[c] += 1
max_1 = max((e for e in mdict.values()))
for key in mdict.keys():
	if mdict[key] == max_1:
		print(key)
		break


n = int(input())
s = input()
subs = []
for i in range(len(s) - 1):
	subs.append(s[i:i + 2])
from collections import Counter
c = Counter(subs)
maxs = ''
maxn = 0
for i in c:
	if c[i] > maxn:
		maxn = c[i]
		maxs = i
print(maxs)


n = int(input())
k = input()
c = []
maxm = 0
maxn = ''
for i in range(len(k) - 1):
	c.append(k[i] + k[i + 1])
for j in range(len(c)):
	if c.count(c[j]) > maxm:
		maxn = c[j]
		maxm = c.count(c[j])
print(maxn)


l = int(input())
s = input()
mx = 0
mxI = None
d = {}
for i in range(l - 1):
	s2 = s[i:i + 2]
	if s2 not in d:
		d[s2] = 1
	else:
		d[s2] += 1
	if d[s2] > mx:
		mx = d[s2]
		mxI = s2
print(mxI)


from collections import defaultdict
N = int(input())
s = str(input())
d = defaultdict(int)
for i in range(N - 1):
	d[s[i] + s[i + 1]] += 1
res = max(d.items(), key=lambda a: a[1])
print(res[0])


input()
s = list(input())
d = {}
for i in range(len(s) - 1):
	f = s[i] + s[i + 1]
	if f not in d:
		d[f] = 0
	d[f] += 1
(m, n) = (0, 0)
for i in d:
	if d[i] > m:
		m = d[i]
		n = i
print(n)


from collections import Counter, defaultdict
BS = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'

def to_base(s, b):
	res = ''
	while s:
		res += BS[s % b]
		s //= b
	return res[::-1] or '0'
alpha = 'abcdefghijklmnopqrstuvwxyz'
from math import floor, ceil, pi
primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997, 1009, 1013, 1019, 1021, 1031, 1033, 1039, 1049, 1051, 1061, 1063, 1069, 1087, 1091, 1093, 1097, 1103, 1109, 1117, 1123, 1129, 1151, 1153, 1163, 1171, 1181, 1187, 1193, 1201, 1213, 1217, 1223, 1229, 1231, 1237, 1249, 1259, 1277, 1279, 1283, 1289, 1291, 1297, 1301, 1303, 1307, 1319, 1321, 1327, 1361, 1367, 1373, 1381, 1399, 1409, 1423, 1427, 1429, 1433, 1439, 1447, 1451, 1453, 1459, 1471, 1481, 1483, 1487, 1489, 1493, 1499, 1511, 1523, 1531, 1543, 1549, 1553, 1559, 1567, 1571, 1579, 1583, 1597, 1601, 1607, 1609, 1613, 1619, 1621, 1627, 1637, 1657, 1663, 1667, 1669, 1693, 1697, 1699, 1709, 1721, 1723, 1733, 1741, 1747, 1753, 1759, 1777, 1783, 1787, 1789, 1801, 1811, 1823, 1831, 1847, 1861, 1867, 1871, 1873, 1877, 1879, 1889, 1901, 1907, 1913, 1931, 1933, 1949, 1951, 1973, 1979, 1987, 1993, 1997, 1999, 2003, 2011, 2017, 2027, 2029, 2039, 2053, 2063, 2069, 2081, 2083, 2087, 2089, 2099, 2111, 2113, 2129, 2131, 2137, 2141, 2143, 2153, 2161, 2179, 2203, 2207, 2213, 2221, 2237, 2239, 2243, 2251, 2267, 2269, 2273, 2281, 2287, 2293, 2297, 2309, 2311, 2333, 2339, 2341, 2347, 2351, 2357, 2371, 2377, 2381, 2383, 2389, 2393, 2399, 2411, 2417, 2423, 2437, 2441, 2447, 2459, 2467, 2473, 2477, 2503, 2521, 2531, 2539, 2543, 2549, 2551, 2557, 2579, 2591, 2593, 2609, 2617, 2621, 2633, 2647, 2657, 2659, 2663, 2671, 2677, 2683, 2687, 2689, 2693, 2699, 2707, 2711, 2713, 2719, 2729, 2731, 2741, 2749, 2753, 2767, 2777, 2789, 2791, 2797, 2801, 2803, 2819, 2833, 2837, 2843, 2851, 2857, 2861, 2879, 2887, 2897, 2903, 2909, 2917, 2927, 2939, 2953, 2957, 2963, 2969, 2971, 2999, 3001, 3011, 3019, 3023, 3037, 3041, 3049, 3061, 3067, 3079, 3083, 3089, 3109, 3119, 3121, 3137, 3163, 3167, 3169, 3181, 3187, 3191, 3203, 3209, 3217, 3221, 3229, 3251, 3253, 3257, 3259, 3271, 3299, 3301, 3307, 3313, 3319, 3323, 3329, 3331, 3343, 3347, 3359, 3361, 3371, 3373, 3389, 3391, 3407, 3413, 3433, 3449, 3457, 3461, 3463, 3467, 3469, 3491, 3499, 3511, 3517, 3527, 3529, 3533, 3539, 3541, 3547, 3557, 3559, 3571, 3581, 3583, 3593, 3607, 3613, 3617, 3623, 3631, 3637, 3643, 3659, 3671, 3673, 3677, 3691, 3697, 3701, 3709, 3719, 3727, 3733, 3739, 3761, 3767, 3769, 3779, 3793, 3797, 3803, 3821, 3823, 3833, 3847, 3851, 3853, 3863, 3877, 3881, 3889, 3907, 3911, 3917, 3919, 3923, 3929, 3931, 3943, 3947, 3967, 3989, 4001, 4003, 4007, 4013, 4019, 4021, 4027, 4049, 4051, 4057, 4073, 4079, 4091, 4093, 4099, 4111, 4127, 4129, 4133, 4139, 4153, 4157, 4159, 4177, 4201, 4211, 4217, 4219, 4229, 4231, 4241, 4243, 4253, 4259, 4261, 4271, 4273, 4283, 4289, 4297, 4327, 4337, 4339, 4349, 4357, 4363, 4373, 4391, 4397, 4409, 4421, 4423, 4441, 4447, 4451, 4457, 4463, 4481, 4483, 4493, 4507, 4513, 4517, 4519, 4523, 4547, 4549, 4561, 4567, 4583, 4591, 4597, 4603, 4621, 4637, 4639, 4643, 4649, 4651, 4657, 4663, 4673, 4679, 4691, 4703, 4721, 4723, 4729, 4733, 4751, 4759, 4783, 4787, 4789, 4793, 4799, 4801, 4813, 4817, 4831, 4861, 4871, 4877, 4889, 4903, 4909, 4919, 4931, 4933, 4937, 4943, 4951, 4957, 4967, 4969, 4973, 4987, 4993, 4999, 5003, 5009, 5011, 5021, 5023, 5039, 5051, 5059, 5077, 5081, 5087, 5099, 5101, 5107, 5113, 5119, 5147, 5153, 5167, 5171, 5179, 5189, 5197, 5209, 5227, 5231, 5233, 5237, 5261, 5273, 5279, 5281, 5297, 5303, 5309, 5323, 5333, 5347, 5351, 5381, 5387, 5393, 5399, 5407, 5413, 5417, 5419, 5431, 5437, 5441, 5443, 5449, 5471, 5477, 5479, 5483, 5501, 5503, 5507, 5519, 5521, 5527, 5531, 5557, 5563, 5569, 5573, 5581, 5591, 5623, 5639, 5641, 5647, 5651, 5653, 5657, 5659, 5669, 5683, 5689, 5693, 5701, 5711, 5717, 5737, 5741, 5743, 5749, 5779, 5783, 5791, 5801, 5807, 5813, 5821, 5827, 5839, 5843, 5849, 5851, 5857, 5861, 5867, 5869, 5879, 5881, 5897, 5903, 5923, 5927, 5939, 5953, 5981, 5987, 6007, 6011, 6029, 6037, 6043, 6047, 6053, 6067, 6073, 6079, 6089, 6091, 6101, 6113, 6121, 6131, 6133, 6143, 6151, 6163, 6173, 6197, 6199, 6203, 6211, 6217, 6221, 6229, 6247, 6257, 6263, 6269, 6271, 6277, 6287, 6299, 6301, 6311, 6317, 6323, 6329, 6337, 6343, 6353, 6359, 6361, 6367, 6373, 6379, 6389, 6397, 6421, 6427, 6449, 6451, 6469, 6473, 6481, 6491, 6521, 6529, 6547, 6551, 6553, 6563, 6569, 6571, 6577, 6581, 6599, 6607, 6619, 6637, 6653, 6659, 6661, 6673, 6679, 6689, 6691, 6701, 6703, 6709, 6719, 6733, 6737, 6761, 6763, 6779, 6781, 6791, 6793, 6803, 6823, 6827, 6829, 6833, 6841, 6857, 6863, 6869, 6871, 6883, 6899, 6907, 6911, 6917, 6947, 6949, 6959, 6961, 6967, 6971, 6977, 6983, 6991, 6997, 7001, 7013, 7019, 7027, 7039, 7043, 7057, 7069, 7079, 7103, 7109, 7121, 7127, 7129, 7151, 7159, 7177, 7187, 7193, 7207, 7211, 7213, 7219, 7229, 7237, 7243, 7247, 7253, 7283, 7297, 7307, 7309, 7321, 7331, 7333, 7349, 7351, 7369, 7393, 7411, 7417, 7433, 7451, 7457, 7459, 7477, 7481, 7487, 7489, 7499, 7507, 7517, 7523, 7529, 7537, 7541, 7547, 7549, 7559, 7561, 7573, 7577, 7583, 7589, 7591, 7603, 7607, 7621, 7639, 7643, 7649, 7669, 7673, 7681, 7687, 7691, 7699, 7703, 7717, 7723, 7727, 7741, 7753, 7757, 7759, 7789, 7793, 7817, 7823, 7829, 7841, 7853, 7867, 7873, 7877, 7879, 7883, 7901, 7907, 7919]

def primef(n, plst=[]):
	if n == 1:
		return plst
	else:
		for m in primes:
			if n % m == 0:
				return primef(n // m, plst + [m])
		return primef(1, plst + [n])

def lmii():
	return list(map(int, input().split()))

def ii():
	return int(input())

def countOverlapping(string, sub):
	count = start = 0
	while True:
		start = string.find(sub, start) + 1
		if start > 0:
			count += 1
		else:
			return count
n = int(input())
s = input()
from itertools import permutations
import re
ans = None
tot = 0
for i in permutations(s, 2):
	i = ''.join(i)
	a = countOverlapping(s, i)
	if a > tot:
		tot = a
		ans = i
print(ans)


n = int(input())
s = input()
dic = {'boz': 0}
max_key = 'boz'
for i in range(n - 1):
	key = s[i] + s[i + 1]
	if key in dic:
		dic[key] += 1
	else:
		dic[key] = 1
	if dic[key] > dic[max_key]:
		max_key = key
print(max_key)


n = int(input())
s = input()
twog = []
for i in range(n - 1):
	twog.append(s[i] + s[i + 1])
maxi = twog.count(twog[0])
maxv = twog[0]
for i in range(1, len(twog) - 1):
	c = twog.count(twog[i])
	if c > maxi:
		maxi = c
		maxv = twog[i]
print(maxv)


n = int(input())
s = input()
lista = []
for i in range(len(s) - 1):
	lista.append(s[i] + s[i + 1])
cont = 0
res = ''
for par in lista:
	if lista.count(par) > cont:
		res = par
		cont = lista.count(par)
print(res)


input()
s = input()
n = len(s)
d = {}
for i in range(n - 1):
	string = s[i] + s[i + 1]
	d.setdefault(string, 0)
	d[string] += 1
max = ''
maxn = 0
for i in d:
	if d[i] > maxn:
		maxn = d[i]
		max = i
print(max)


n = int(input())
a = input()
mp = {}
maxi = 0
for i in range(n - 1):
	if a[i:i + 2] not in mp.keys():
		mp[a[i:i + 2]] = 1
		if maxi < mp[a[i:i + 2]]:
			maxi = mp[a[i:i + 2]]
	else:
		mp[a[i:i + 2]] += 1
		if maxi < mp[a[i:i + 2]]:
			maxi = mp[a[i:i + 2]]
for i in mp:
	if mp[i] == maxi:
		print(i)
		break


a = int(input())
s = input()
d = dict()
for i in range(a - 1):
	if s[i] + s[i + 1] not in d:
		d[s[i] + s[i + 1]] = 1
	else:
		d[s[i] + s[i + 1]] += 1
maxx = ''
p = 0
for i in d:
	if d[i] >= p:
		p = d[i]
		maxx = i
print(maxx)


n = int(input())
tgrams = [chr(ord('A') + i) + chr(ord('A') + j) for i in range(26) for j in range(26)]
freq = {tg: 0 for tg in tgrams}
s = input()
for i in range(n - 1):
	k = s[i:i + 2]
	freq[k] += 1
print(max(freq.items(), key=lambda x: x[1])[0])


T = input()
s = input()
r = int(T)
count = 0
t = []
g = ''
for i in range(0, r - 1):
	g = s[i] + s[i + 1]
	t.append(g)
mx = 0
b = ''
for i in range(0, len(t)):
	if t.count(t[i]) > mx:
		mx = t.count(t[i])
		b = t[i]
print(b)


import operator
n = input()
s = input()
key = ''
dict = {}
for x in range(0, len(s) - 1):
	key = s[x] + s[x + 1]
	if key in dict:
		dict[key] += 1
	else:
		dict[key] = 1
print(max(dict, key=dict.get))


n = int(input())
s = input()
d = {}
mx = 0
for i in range(len(s) - 1):
	s2 = s[i:i + 2]
	d[s2] = d.get(s2, 0) + 1
	if d[s2] > mx:
		res = s2
		mx = d[s2]
print(res)


a = input()
s = input()
d = dict()
for x in range(len(s) - 1):
	ss = s[x] + s[x + 1]
	if d.get(ss) == None:
		d[ss] = 1
	else:
		d[ss] += 1
maxx = 0
maxs = ''
for x in d:
	if d[x] > maxx:
		maxx = d[x]
		maxs = x
print(maxs)


n = int(input())
s = input()
cnt = {}
for i in range(len(s) - 1):
	x = s[i] + s[i + 1]
	try:
		cnt[x] += 1
	except KeyError:
		cnt[x] = 1
(ans, ma) = ('', 0)
for k in cnt:
	if cnt[k] > ma:
		ans = k
		ma = cnt[k]
print(ans)


import re
gram = []
time = []
n = int(input())
string = input()
for i in range(65, 91):
	for j in range(65, 91):
		gram.append(chr(i) + chr(j))
for i in gram:
	if i[0] != i[1]:
		found = re.findall(i, string)
		time.append((len(found), i))
	else:
		found = re.findall(i + '+', string)
		count = 0
		for j in found:
			count = count + len(j) - 1
		time.append((count, i))
time.sort(key=lambda x: x[0], reverse=True)
print(time[0][1])


import sys
from collections import defaultdict

def twogram(input, n):
	d = defaultdict(int)
	for i in range(n - 1):
		d[input[i:i + 2]] += 1
	return max(d, key=d.get)
n = int(sys.stdin.readline())
input = sys.stdin.readline()
print(twogram(input, n))


def solution(n, string):
	count = 0
	result = str()
	for i in range(0, n - 1):
		cur = 0
		for j in range(0, n - 1):
			if string[j] == string[i] and string[j + 1] == string[i + 1]:
				cur += 1
		if count < cur:
			count = cur
			result = string[i] + string[i + 1]
	return result
n = int(input())
string = input()
print(solution(n, string))


n = int(input())
s = input()
k = 0
m = 0
ms = ''
st = ''
for i in range(len(s) - 1):
	st = s[i] + s[i + 1]
	n = 0
	for j in range(len(s) - 1):
		if st[0] == s[j] and st[1] == s[j + 1]:
			n += 1
	if n > m:
		m = n
		ms = st
print(ms)


def count(strs):
	if len(strs) <= 2:
		return strs
	dicts = {}
	for i in range(len(strs) - 1):
		if strs[i] + strs[i + 1] in dicts:
			dicts[strs[i] + strs[i + 1]] += 1
		else:
			dicts[strs[i] + strs[i + 1]] = 0
	max = 0
	gram = ''
	for i in dicts:
		if dicts[i] >= max:
			max = dicts[i]
			gram = i
	return gram

def main():
	n = input()
	st = input()
	print(count(st))
main()


n = int(input())
s = input()
frequent = {}
for i in range(n - 1):
	two_gram = s[i] + s[i + 1]
	if two_gram in frequent:
		frequent[two_gram] += 1
	else:
		frequent[two_gram] = 1
l = [(v, k) for (k, v) in frequent.items()]
l = sorted(l)
print(l[-1][1])


n = int(input())
arr = input()
ls = []
for i in range(n - 1):
	ls.append(arr[i] + arr[i + 1])
ps = list(set(ls))
ma = 0
for i in ps:
	count = 0
	for j in ls:
		if j == i:
			count += 1
	if count > ma:
		ma = count
		p = i
print(p)


import operator
n = int(input())
s = input()
d = {}
for i in range(n - 1):
	d[s[i] + s[i + 1]] = 0
for i in range(n - 1):
	d[s[i] + s[i + 1]] += 1
d = sorted(d.items(), key=operator.itemgetter(1))
print(d[len(d) - 1][0])


n = int(input())
s = input()
alth = 'QWERTYUIOPASDFGHJKLZXCVBNM'
alth2 = [[0] * 26 for i in range(26)]
for i in range(n - 1):
	alth2[alth.find(s[i])][alth.find(s[i + 1])] += 1
maxi = 0
maxj = 0
for i in range(26):
	for j in range(26):
		if alth2[i][j] > alth2[maxi][maxj]:
			maxi = i
			maxj = j
print(alth[maxi] + alth[maxj])


n = int(input())
s = input()
d = dict()
for i in range(len(s)):
	if len(s[i:i + 2]) == 2:
		if d.get(s[i:i + 2]) == None:
			d[s[i:i + 2]] = 1
		else:
			d[s[i:i + 2]] += 1
m = 0
ans = ''
for (i, j) in d.items():
	if j > m:
		m = j
		ans = i
print(ans)


from collections import defaultdict
n = int(input())
s = input()
hm = defaultdict(lambda : 0)
(i, j) = (0, 1)
maxxcount = 0
while i < len(s) and j < len(s):
	x = s[i:j + 1]
	hm[x] += 1
	if hm[x] > maxxcount:
		maxxcount = hm[x]
	i += 1
	j += 1
for k in hm:
	if hm[k] == maxxcount:
		print(k)
		break


n = int(input())
letters = input()
anagrams = []
for i in range(n):
	if i < n - 1:
		anagrams.append(letters[i:i + 2])
final_anagrams = []
times = []
for item in anagrams:
	final_anagrams.append(item)
	times.append(anagrams.count(item))
	anagrams.remove(item)
print(final_anagrams[times.index(max(times))])


length = int(input())
string = input()
list_of_twos = {}
for i in range(0, length - 1):
	strang = string[i] + string[i + 1]
	if strang in list_of_twos:
		list_of_twos[strang] += 1
	else:
		list_of_twos[strang] = 1
greatest = 0
stringg = ''
for x in list_of_twos:
	if list_of_twos[x] >= greatest:
		stringg = x
		greatest = list_of_twos[x]
print(stringg)


n = int(input())
s = input()
d = {}
for i in range(n - 1):
	ss = s[i:i + 2]
	try:
		d[ss] += 1
	except:
		d[ss] = 1
(max_, ss_max) = (0, '')
for (ss, c) in d.items():
	if c > max_:
		ss_max = ss
		max_ = c
print(ss_max)


n = int(input())
s = input()
d = {}
for i in range(n - 1):
	dg = s[i:i + 2]
	if dg in d:
		d[dg] += 1
	else:
		d[dg] = 1
max_num = max(d.values())
for (k, v) in d.items():
	if v == max_num:
		print(k)
		break


n = int(input())
s = input()
s = list(s)
l = []
for i in range(n - 1):
	c = 0
	for j in range(n - 1):
		if s[i] == s[j] and s[i + 1] == s[j + 1]:
			c = c + 1
	l.append(c)
a = l.index(max(l))
for i in range(a, a + 2):
	print(s[i], end='')


n = int(input())
str1 = input()
lst1 = []
for i in range(n - 1):
	lst1.append(str1[i:i + 2])
print(max(lst1, key=lst1.count))


a = int(input())
s = input()
d = dict()
for i in range(a - 1):
	if s[i:i + 2] in d:
		d[s[i:i + 2]] += 1
	else:
		d[s[i:i + 2]] = 1
s1 = ''
max = 0
for i in d:
	if d[i] > max:
		s1 = i
		max = d[i]
print(s1)


(n, dic) = (int(input()), {})
s = input()
for i in range(1, n):
	try:
		dic[s[i - 1:i + 1]] += 1
	except:
		dic[s[i - 1:i + 1]] = 1
print(max(dic.keys(), key=dic.get))


import sys
a = int(sys.stdin.readline().rstrip('\n'))
s = sys.stdin.readline().rstrip('\n')
count = 0
mx = -1
m = ''
for i in range(len(s) - 1):
	ps = s[i] + s[i + 1]
	for j in range(len(s) - 1):
		if s[j] + s[j + 1] == ps:
			count += 1
	if count >= mx:
		mx = count
		m = ps
	count = 0
print(m)


n = int(input())
s = input()
m = 0
ans = ''
for i in range(n - 1):
	(p, k) = (s[i:i + 2], 0)
	for j in range(n - 1):
		if p == s[j:j + 2]:
			k += 1
	if k > m:
		(m, ans) = (k, p)
print(ans)


n = int(input())
s = input()
cnt = {}
for i in range(1, len(s)):
	ss = s[i - 1] + s[i]
	try:
		cnt[ss] += 1
	except:
		cnt[ss] = 1
m = 0
ans = ''
for i in cnt:
	if m < cnt[i]:
		m = cnt[i]
		ans = i
print(ans)


n = int(input())
s = input()
a = []
j = 0
for i in range(n):
	a.append(s[i:i + 2])
	if i == n - 2:
		break
a.sort()
oc = 1
ans = a[0]
m = 1
for i in range(len(a)):
	if i != 0:
		if a[i] == a[i - 1]:
			oc += 1
			if oc > m:
				m = oc
				ans = a[i - 1]
		else:
			oc = 1
print(ans)


n = int(input())
chars = list(input())
max_gram = None
max_occ = 0
gram_d = {}
for gram in zip(chars, chars[1:]):
	if gram not in gram_d:
		gram_d[gram] = 0
	gram_d[gram] += 1
	if gram_d[gram] > max_occ:
		max_occ = gram_d[gram]
		max_gram = gram
print(''.join(max_gram))


n = int(input())
s = input()
s = s[:n]
d = {}
for i in range(n - 1):
	z = s[i:i + 2]
	if z in d:
		d[z] += 1
	else:
		d[z] = 1
max_v = 0
max_el = ''
for (el, value) in d.items():
	if value > max_v:
		max_v = value
		max_el = el
print(max_el)


n = int(input())
s = list(input())
aux = []
for i in range(n - 1):
	t = s[i] + s[i + 1]
	if t not in aux:
		aux.append(t)
fq = [0] * len(aux)
dic = {a: i for (i, a) in enumerate(aux)}
for i in range(n - 1):
	fq[dic[s[i] + s[i + 1]]] += 1
maxi = 0
indice = 0
for i in range(len(fq)):
	if fq[i] > maxi:
		maxi = fq[i]
		indice = i
print(aux[indice])


import collections

class Solution:

	def solve(self, n, string):
		twoGrams = collections.defaultdict(int)
		for i in range(1, n):
			twoGrams[string[i - 1:i + 1]] += 1
		return sorted(twoGrams, key=twoGrams.get)[-1]
sol = Solution()
n = int(input().strip())
string = input().strip()
print(sol.solve(n, string))


n = int(input())

def m(List):
	counter = 0
	num = List[0]
	for i in List:
		c = List.count(i)
		if c > counter:
			counter = c
			num = i
	return num
s = input()
l = []
for i in range(1, n):
	l.append(s[i - 1:i + 1])
print(m(l))


import math

def main():
	n = int(input())
	string = str(input())
	d = {}
	for i in range(len(string) - 1):
		if d.get(string[i:i + 2]) == None:
			d[string[i:i + 2]] = 1
		else:
			d[string[i:i + 2]] += 1
	mx = 0
	ans = ''
	for x in d:
		if d[x] > mx:
			mx = d[x]
			ans = x
	print(ans)
main()


from sys import stdin, stdout
import math
N = int(input())
s = input()
freq = {}
for i in range(N - 1):
	two_gram = s[i] + s[i + 1]
	if two_gram not in freq:
		freq[two_gram] = 1
	else:
		freq[two_gram] += 1
maximum = max(freq, key=freq.get)
print(maximum)


x = int(input())
n = ' '.join(input()).split()
(substr, Max) = ('', 0)
for i in range(len(n)):
	Count = 0
	for j in range(len(n)):
		Count = Count + 1 if n[i:i + 2] == n[j:j + 2] else Count
	if Count > Max:
		Max = Count
		substr = n[i:i + 2]
print(''.join(substr))


input()
s = input()
m = 0
a = ''
j = ''
for i in range(len(s)):
	if j == s[i:i + 2]:
		if s.count(s[i:i + 2]) + 1 > m:
			m = s.count(s[i:i + 2]) + 1
			a = s[i:i + 2]
	elif s.count(s[i:i + 2]) * 2 - 1 > m:
		m = s.count(s[i:i + 2])
		a = s[i:i + 2]
	j = s[i:i + 2]
	if i == len(s) - 2:
		break
print(a)


from collections import defaultdict
N = int(input())
S = input()
cnts = defaultdict(int)
max_cnt = 0
max_two_gram = None
for i in range(N - 1):
	two_gram = S[i] + S[i + 1]
	cnts[two_gram] += 1
	if cnts[two_gram] > max_cnt:
		max_cnt = cnts[two_gram]
		max_two_gram = two_gram
print(max_two_gram)


from collections import defaultdict

def main():
	l = int(input())
	s = str(input())
	d = defaultdict(int)
	for i in range(l - 1):
		d[s[i:i + 2]] += 1
	print(sorted(d.items(), key=lambda k: k[1], reverse=True)[0][0])
main()


n = int(input())
s = str(input())
min = -10 ** 9
l = []
for i in range(0, len(s) - 1):
	d = s[i:i + 2]
	l.append(d)
f = set(l)
for i in f:
	d = l.count(i)
	if d > min:
		min = d
		string = i
print(string)


n = int(input())
s = input()
par = list()
repeticoes = dict()
for i in range(0, n - 1):
	par.append(''.join((s[i], s[i + 1])))
	if par[i] in repeticoes.keys():
		repeticoes[par[i]] = repeticoes[par[i]] + 1
	else:
		repeticoes[par[i]] = 1
	if i == n - 1:
		break
maior = 0
dupla = ''
for i in range(len(repeticoes)):
	if maior < list(repeticoes.values())[i]:
		maior = list(repeticoes.values())[i]
		dupla = list(repeticoes.keys())[i]
print(dupla)


n = int(input())
letters = [char for char in input()]
dictionary = {}
prev = letters[0]
for l in letters[1:]:
	curr = prev + l
	if curr in dictionary:
		dictionary[curr] += 1
	else:
		dictionary[curr] = 1
	prev = l
key = letters[0] + letters[1]
for (k, d) in dictionary.items():
	if d > dictionary[key]:
		key = k
print(key)


def poopy(b, a):
	dicc = {}
	for i in range(b - 1):
		if a[i:i + 2] in dicc:
			dicc[a[i:i + 2]] += 1
		else:
			dicc[a[i:i + 2]] = 1
	maxx = -1
	for i in dicc:
		if dicc[i] > maxx:
			maxx = dicc[i]
			ret = i
	return ret
print(poopy(int(input('')), input('')))


n = int(input())
s = input()
strLst = []
for i in range(n - 1):
	strLst += [s[i:i + 2]]

def most_frequent(lst):
	count = 0
	num = lst[0]
	for i in lst:
		freq = lst.count(i)
		if freq > count:
			count = freq
			num = i
	return num
print(most_frequent(strLst))


n = int(input())
s = input()
d = {}
for i in range(n - 1):
	key = s[i] + s[i + 1]
	if key not in d:
		d[key] = 1
	else:
		d[key] += 1
ans = ''
a = 0
for i in d:
	if d[i] > a:
		ans = i
		a = d[i]
print(ans)


n = int(input())
s = input()
d = {}
for i in range(n - 1):
	if d.get(s[i:i + 2]):
		d[s[i:i + 2]] += 1
	else:
		d[s[i:i + 2]] = 1
mx = 0
ans = ''
for i in d:
	if d[i] > mx:
		mx = d[i]
		ans = i
print(ans)


nb = int(input())
chaine = input()

def recherchenb(lat, chaine):
	occ = 1
	for i in range(0, len(chaine) - 1):
		if chaine[i:i + 2] == lat:
			occ += 1
	return occ
nbmax = 0
lat = ''
for i in range(0, len(chaine) - 1):
	nb = recherchenb(chaine[i:i + 2], chaine[i + 1:len(chaine)])
	if nb > nbmax:
		nbmax = nb
		lat = chaine[i:i + 2]
print(lat)


input()
s = input()
data = {}
maxi = -1
while len(s) != 0:
	if len(s[0:2]) == 2:
		if s[0:2] not in data.keys():
			data[s[0:2]] = 0
		else:
			data[s[0:2]] += 1
	s = s[1:]
for i in data:
	if data[i] > maxi:
		maxi = data[i]
		ans = i
print(ans)


n = int(input())
s = input()
a = {}
for i in range(n - 1):
	a[s[i:i + 2]] = a.get(s[i:i + 2], 0)
	a[s[i:i + 2]] += 1
print(sorted(a, key=a.__getitem__, reverse=True)[0])


N = input()
b = list(input())
a = [ord(x) for x in b]
c = [(a[i], a[i + 1]) for i in range(len(a) - 1)]
d = [[(i, j) for i in range(65, 91)] for j in range(65, 91)]
e = list(set().union(*d))
arr = []
i = 0
while i in range(len(e)):
	r = 0
	j = 0
	while j in range(len(c)):
		if c[j] == e[i]:
			r = r + 1
			j = j + 1
		else:
			j = j + 1
	arr.append(r)
	i = i + 1
print(''.join([chr(x) for x in e[arr.index(max(arr))]]))


import collections as c
n = int(input())
s = input()
d = c.Counter()
for i in range(n - 1):
	d[s[i] + s[i + 1]] += 1
print(d.most_common(1)[0][0])


n = int(input())
s = input()
ans = ''
l = 0
for i in range(n - 1):
	d = s[i] + s[i + 1]
	app = 0
	for j in range(n - 1):
		if s[j] + s[j + 1] == d:
			app += 1
	if app > l:
		if ans == d:
			l += app
		else:
			l = app
			ans = d
print(ans)


n = int(input())
s = input()
d = dict()
mv = -1
str = ''
ls = n - 1
for i in range(ls):
	t = s[i:i + 2]
	if t not in d:
		d[t] = 1
	else:
		d[t] += 1
	if d[t] > mv:
		str = t
		mv = d[t]
print(str)


dx = dict()
n = int(input())
x = input()
for i in range(n - 1):
	dx[x[i] + x[i + 1]] = dx.get(x[i] + x[i + 1], 0) + 1
ans = sorted(dx.items(), key=lambda x: -x[1])
print(ans[0][0])


n = int(input())
word = input()
cont_of_numbers = {}
for i in range(len(word) - 1):
	substring = word[i:i + 2]
	if substring in cont_of_numbers:
		cont_of_numbers[substring] += 1
	else:
		cont_of_numbers[substring] = 1
print(max(cont_of_numbers, key=cont_of_numbers.get))


(_, s) = (int(input()), input())
(a, b, d, k, v, i) = (s[0], s[1], {}, '', 0, 2)
try:
	while True:
		d[a + b] = d[a + b] + 1 if a + b in d else 1
		if v < d[a + b]:
			(k, v) = (a + b, d[a + b])
		(a, b, i) = (b, s[i], i + 1)
except IndexError:
	print(k)


def two_gram(x, n):
	if x is None:
		return None
	(l, count_m) = (len(x), {})
	for i in range(len(x) - 1):
		for j in range(i + 1, len(x)):
			cur = x[i] + x[j]
			curr = x.count(cur)
			count_m[cur] = curr
	count_m = sorted(count_m.items(), key=lambda kv: (kv[1], kv[0]))
	print(count_m[-1][0])
n = int(input())
x = str(input())
two_gram(x, n)


n = int(input())
s = input()
b = []
for i in range(n - 1):
	c = s[i] + s[i + 1]
	b.append(c)

def most_frequent(List):
	counter = 0
	num = List[0]
	for i in List:
		curr_frequency = List.count(i)
		if curr_frequency > counter:
			counter = curr_frequency
			num = i
	return num
print(most_frequent(b))


n = int(input())
s = input()
two = set()
litwo = list()
max = 0
ans = ''
for i in range(n - 1):
	two.add(s[i:i + 2])
	litwo.append(s[i:i + 2])
for item in two:
	if litwo.count(item) > max:
		max = s.count(item)
		ans = item
print(ans)


n = int(input()) - 1
s = input()
liste = []
for i in range(n):
	liste.append(s[i] + s[i + 1])
compteur = 0
laste = []
for j in range(len(liste)):
	compteur = 0
	for a in range(j, len(liste)):
		if liste[j] == liste[a]:
			compteur = compteur + 1
	laste.append([compteur, liste[j]])
ui = -1
sku = 0
for c in range(len(laste)):
	if laste[c][0] > sku:
		ui = c
		sku = laste[c][0]
print(laste[ui][1])


n = int(input())
s = list(input())
cnt = [0] * 1000
m = 0
for i in range(n - 1):
	c = 26 * (ord(s[i]) - 65) + ord(s[i + 1]) - 65
	cnt[c] += 1
	m = max(m, cnt[c])
for i in range(1000):
	if cnt[i] == m:
		x = i // 26 + 65
		y = i % 26 + 65
		print(chr(x) + chr(y))
		exit()


n = int(input())
s = input()
d = {}
ma = 0
ans = ''
for i in range(n - 1):
	if s[i] + s[i + 1] not in d:
		d[s[i] + s[i + 1]] = 1
	else:
		d[s[i] + s[i + 1]] += 1
	if ma < d[s[i] + s[i + 1]]:
		ma += 1
		ans = s[i] + s[i + 1]
print(ans)


n = int(input())
s = input()
mx = 0
ans = ''
dc = dict()
for i in range(n - 1):
	dbg = s[i:i + 2]
	if dbg not in dc:
		dc[dbg] = 1
	else:
		dc[dbg] += 1
	if dc[dbg] > mx:
		mx = dc[dbg]
		ans = dbg
print(ans)


a = int(input())
b = input()
c = []
d = []
for k in range(0, a - 1):
	word = b[k] + b[k + 1]
	occ = 0
	for m in range(0, a - 1):
		if word == b[m] + b[m + 1]:
			occ += 1
	c.append(occ)
	d.append(word)
v = max(c)
print(d[c.index(v)])


def hate_for_one_check(str_len, dgramm):
	if str_len == 2:
		print(dgramm)
		return
	cardmaster = []
	for sub in range(len(dgramm)):
		cardmaster.append(dgramm[sub:sub + 2])
		sub += 2
	if str_len % 2 == 0:
		del cardmaster[-1]
	result = dict()
	for sub in cardmaster:
		if sub not in result:
			result[sub] = 1
		else:
			result[sub] += 1
	max_value = max(result.values())
	max_keys = [k for (k, v) in result.items() if v == max_value]
	print(max_keys[0])
str_len = int(input())
dgramm = input()
hate_for_one_check(str_len, dgramm)


n = int(input())
s = input()
d = dict()
for i in range(n - 1):
	curr = s[i:i + 2]
	d[curr] = d.get(curr, 0) + 1
maxCount = 0
result = ''
for key in d.keys():
	if d[key] > maxCount:
		maxCount = d[key]
		result = key
print(result)


n = int(input())
y = input()
arr = []
score = []
for i in range(len(y) - 1):
	z = str(y[i]) + str(y[i + 1])
	if z in arr:
		for j in range(len(arr)):
			if arr[j] == z:
				score[j] += 1
	else:
		arr.append(z)
		score.append(1)
max = score[0]
index = 0
for i in range(1, len(score)):
	if max < score[i]:
		max = score[i]
		index = i
print(arr[index])


import operator
n = input()
str = input()
dic = {}
for i in range(len(str) - 1):
	str_aux = str[i] + str[i + 1]
	if str_aux in dic:
		cur_value = dic.get(str_aux)
		dic[str_aux] = cur_value + 1
	else:
		dic[str_aux] = 1
most_freq = max(dic, key=dic.get)
print(most_freq)


n = int(input())
s = input()
l = []
for i in range(n - 1):
	freq = 1
	tmp = s[i:i + 2]
	for j in range(i + 1, n - 1):
		if tmp == s[j:j + 2]:
			freq += 1
	l.append([freq, tmp])
l.sort()
print(l[len(l) - 1][1])


n = int(input())
s = input()
l = []
from collections import Counter
for i in range(0, len(s) - 1):
	l.append(s[i:i + 2])
l = Counter(l)
l = dict(l)
max = 0
for word in l:
	if l[word] > max:
		max = l[word]
		string = word
print(string)


n = int(input())
s = input()
a = {}
for i in range(len(s) - 1):
	if s[i] + s[i + 1] in a:
		a[s[i] + s[i + 1]] += 1
	else:
		a[s[i] + s[i + 1]] = 1
a1 = sorted(a.items(), key=lambda x: x[1], reverse=True)
print(a1[0][0])


import sys
import math
import bisect
import itertools

def main():
	n = int(input())
	s = input()
	d = dict()
	for i in range(1, n):
		t = s[i - 1:i + 1]
		if t not in d:
			d[t] = 0
		d[t] += 1
	max_val = max(list(d.values()))
	for k in d:
		if d[k] == max_val:
			print(k)
			break
main()


from collections import defaultdict
n = int(input())
s = input()
d = defaultdict(int)
for i in range(n - 1):
	ss = s[i:i + 2]
	d[ss] += 1
print(max(d, key=d.get))


from collections import defaultdict
from itertools import tee
n = int(input())
s = input()

def pairwise(iterable):
	(a, b) = tee(iterable)
	next(b, None)
	return zip(a, b)
d = defaultdict(int)
for (a, b) in pairwise(s):
	d[a + b] += 1
print(max(d.keys(), key=lambda key: d[key]))


n = int(input())
s = input()
d = dict()
for i in range(len(s) - 1):
	if s[i:i + 2] in d:
		d[s[i:i + 2]] += 1
	else:
		d[s[i:i + 2]] = 1
x = max(d.values())
for (key, value) in d.items():
	if value == x:
		print(key)
		break


n = int(input())
l = list(input())
count = 0
r = []
for i in range(n - 1):
	count = 0
	for j in range(n - 1):
		if l[i] == l[j] and l[i + 1] == l[j + 1]:
			count += 1
	r.append(count)
if n == 2:
	print(''.join(l))
else:
	s = max(r)
	a = r.index(s)
	print(l[a], end='')
	print(l[a + 1], end='')


l1 = int(input())
l2 = list(input())
lul = []
obj = {}
for i in range(l1 - 1):
	x = l2[i] + l2[i + 1]
	if x in obj:
		obj[x] += +1
	else:
		obj[x] = 1
max_key = max(obj, key=obj.get)
print(max_key)


n = input()
s = input()
m = 0
m_s = ''
for i in range(len(s) - 1):
	s1 = s[i:i + 2]
	c = 0
	for j in range(len(s) - 1):
		s2 = s[j:j + 2]
		if s1 == s2:
			c += 1
	if c > m:
		m = c
		m_s = s1
print(m_s)


from collections import Counter

def getAllConsecutiveStrings(string):
	length = len(string)
	consecutiveStrings = [string[i:j + 1] for i in range(length) for j in range(i, length) if len(string[i:j + 1]) == 2]
	consecutiveStrings = Counter(consecutiveStrings)
	print(max(consecutiveStrings, key=consecutiveStrings.get))
stringLength = int(input())
string = input()
getAllConsecutiveStrings(string)


n = int(input())
a = input()
b = dict()
for i in range(1, n):
	s = a[i - 1] + a[i]
	c = b.get(s, 0)
	b[s] = c + 1
mx = 0
ans = ''
for (key, value) in b.items():
	if value > mx:
		mx = value
		ans = key
print(ans)


n = int(input())
s = input()
a = {}
for i in range(n - 1):
	s1 = s[i:i + 2]
	if s1 in a:
		a[s1] += 1
	else:
		a[s1] = 1
m = 0
for (a, b) in a.items():
	if b > m:
		ans = a
		m = b
print(ans)


n = int(input())
s = input()
ans = []
for i in range(n - 1):
	pt = s[i:i + 2]
	cnt = 0
	for j in range(n - 1):
		if pt == s[j:j + 2]:
			cnt += 1
	ans.append((pt, cnt))
mx = ans[0][1]
r_ans = ans[0][0]
for i in ans:
	if i[1] > mx:
		mx = i[1]
		r_ans = i[0]
print(r_ans)


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)


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
del liste[0]
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)
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])


def main():
	n = int(input())
	s = input()
	two_grams = {}
	for i in range(n - 1):
		tg = s[i:i + 2]
		two_grams[tg] = two_grams.get(tg, 0) + 1
	print(next((tg for tg in two_grams if two_grams[tg] == max(two_grams.values()))))
main()


n = int(input())
s = input()
dic = {}
for i in range(len(s)):
	if i + 1 != len(s):
		k = s[i] + s[i + 1]
		if k in dic.keys():
			dic[s[i] + s[i + 1]] += 1
		else:
			dic[s[i] + s[i + 1]] = 1
print(max(dic, key=dic.get))


a = int(input())
o = input()
count1 = 0
count2 = 0
for i in range(0, len(o) - 1):
	o1 = o[i:2 + i]
	count1 = 0
	for j in range(i, len(o) - 1):
		o2 = o[j:2 + j]
		if o1 == o2:
			count1 = count1 + 1
	if count1 > count2:
		count2 = count1
		r = ''
		r = r + o1
print(r)


n = int(input())
st = input()
m = dict()
(ans, ansst) = (0, '')
for i in range(n - 1):
	subst = st[i:i + 2]
	if subst in m:
		m[subst] += 1
	else:
		m[subst] = 1
	if m[subst] > ans:
		ans = m[subst]
		ansst = subst
print(ansst)


n = int(input())
s = input()
cl = []
dic = {}
for i in range(n - 1):
	if s[i:i + 2] not in cl:
		dic.update({s[i:i + 2]: 0})
		cl.append(s[i:i + 2])
for i in range(n - 1):
	dic[s[i:i + 2]] += 1
inverse = [(value, key) for (key, value) in dic.items()]
print(max(inverse)[1])


aqqwe = input()
a = input()
b = []
c = []
index = 0
count = 0
for i in range(len(a) - 1):
	b.append(a[i] + a[i + 1])
for i in range(len(b)):
	if b.count(b[i]) > count:
		index = i
		count = b.count(b[i])
print(b[index])


def main():
	n = int(input())
	line = input()
	twograms = [[0] * 26 for i in range(26)]
	for i in range(n - 1):
		twograms[ord(line[i]) - 65][ord(line[i + 1]) - 65] += 1
	max_num = -1
	for i in range(26):
		for j in range(26):
			if twograms[i][j] > max_num:
				max_num = twograms[i][j]
				max_i = i
				max_j = j
	print(chr(65 + max_i), chr(65 + max_j), sep='')
main()


n = int(input())
b = list(input())
c = dict()
for i in range(n - 1):
	if b[i] + b[i + 1] in c:
		c[b[i] + b[i + 1]] += 1
	else:
		c[b[i] + b[i + 1]] = 1
g = max([c[s] for s in c])
for s in c:
	if c[s] == g:
		print(s)
		break


from collections import Counter

def solve(n: int, s: str):
	stat = Counter()
	(prev, *s) = s
	for symbol in s:
		stat[prev + symbol] += 1
		prev = symbol
	return stat.most_common(1)[0][0]
print(solve(int(input()), input()))


n = int(input())
s = input()
grams = set()
for i in range(n - 1):
	grams.add(s[i:i + 2])
total = 0
val = None
for gram in grams:
	c = 0
	for i in range(n - 1):
		if s[i:i + 2] == gram:
			c += 1
	if c > total:
		total = c
		val = gram
print(val)


def freq_twograms(s):
	LATIN_CNT = len('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
	ORD_A = ord('A')
	s = [ord(c) - ORD_A for c in s]
	freq_mat = [[0 for _ in range(LATIN_CNT)] for _ in range(LATIN_CNT)]
	max_freq = 0
	max_freq_i1 = 0
	max_freq_i2 = 0
	for i in range(len(s) - 1):
		i1 = s[i]
		i2 = s[i + 1]
		freq = freq_mat[i1][i2]
		freq += 1
		freq_mat[i1][i2] = freq
		if max_freq < freq:
			max_freq = freq
			max_freq_i1 = i1
			max_freq_i2 = i2
	return chr(max_freq_i1 + ORD_A) + chr(max_freq_i2 + ORD_A)
l = int(input(''))
s = input('')
print(freq_twograms(s))


n = int(input())
s = input()
d = dict()
for i in range(n - 1):
	x = s[i] + s[i + 1]
	if x in d.keys():
		d[x] += 1
	else:
		d[x] = 0
x = max(d.values())
for key in d.keys():
	if d[key] == x:
		print(key)
		exit()


def two_gram():
	total_letters = int(input())
	string = input()
	dic = {}
	for i in range(1, len(string)):
		temp = string[i - 1] + string[i]
		if temp not in dic:
			dic[temp] = 1
		else:
			dic[temp] += 1
	maximum = 0
	for i in dic:
		if dic[i] > maximum:
			maximum = dic[i]
			best = i
	print(best)
	return
two_gram()


n = int(input())
s = input()
mx = 0
ans = ''
for i in range(n - 1):
	st = s[i:i + 2]
	c = 0
	for j in range(n - 1):
		if st[0] == s[j] and st[1] == s[j + 1]:
			c += 1
	if c > mx:
		mx = c
		ans = st
print(ans)


n = int(input())
s = input()
m = {}
for i in range(n - 1):
	if s[i] + s[i + 1] not in m:
		m[s[i] + s[i + 1]] = 1
	else:
		m[s[i] + s[i + 1]] += 1
ima = -1
ma = 0
for i in m:
	if m[i] > ma:
		ma = m[i]
		ima = i
print(ima)


n = int(input())
s = input()
ans = []
count = []
for i in range(n - 1):
	if s[i:i + 2] in ans:
		count[ans.index(s[i:i + 2])] += 1
	else:
		ans.append(s[i:i + 2])
		count.append(1)
x = max(count)
print(ans[count.index(x)])


N = 26
a = [chr(ord('A') + i) + chr(ord('A') + j) for i in range(N) for j in range(N)]
b = {x: 0 for x in a}
input()
s = input()
for i in range(len(s) - 1):
	b[s[i] + s[i + 1]] += 1
print(list(b.keys())[list(b.values()).index(max(b.values()))])


n = int(input())
d = {}
s = input()
m = 0
msg = ''
for i in range(n):
	x = s[i:i + 2]
	if x in d.keys():
		d[x] += 1
		if d[x] > m:
			m = d[x]
			msg = x
	else:
		d[x] = 1
		if d[x] > m:
			m = d[x]
			msg = x
print(msg)


n = int(input())
s = input()
l = []
for i in range(0, len(s) - 1):
	l.append(s[i:i + 2])
max = 0
for word in l:
	if l.count(word) > max:
		max = l.count(word)
		string = word
print(string)


n = int(input())
s = input()
(t, c) = (0, 0)
s1 = ''
i = 0
while i < n - 1:
	t = s.count(s[i:i + 2], i + 1, n)
	if t != -1:
		if t >= c:
			c = t
			s1 = s[i:i + 2]
	i = i + 1
print(s1)


length = int(input())
my_string = list(input())
my_dict = dict()
for el in range(len(my_string[:-1])):
	my_dict[my_string[el] + my_string[el + 1]] = my_dict.get(my_string[el] + my_string[el + 1], 0) + 1
sorted_dict = sorted(my_dict.items(), key=lambda kv: kv[1], reverse=True)
print(sorted_dict[0][0])


n = int(input())
s = input()
mp = dict()
for i in range(1, n):
	sub = s[i - 1:i + 1]
	if mp.get(sub) == None:
		mp[sub] = 1
	else:
		mp[sub] += 1
mx = 0
ans = ''
for (key, value) in mp.items():
	if mx < value:
		mx = value
		ans = key
print(ans)


n = int(input())
s = input()
counter = 0
tempCounter = 0
for i in range(n - 1):
	x = s[i]
	y = s[i + 1]
	twoGram = x + y
	for j in range(n - 1):
		x = s[j]
		y = s[j + 1]
		testTwoGram = x + y
		if testTwoGram == twoGram:
			tempCounter += 1
	if tempCounter > counter:
		result = twoGram
		counter = tempCounter
	tempCounter = 0
print(result)


n = int(input())
arr = input()
s = {}
ans = 0
for i in range(1, n):
	if str(arr[i - 1:i + 1]) not in s:
		s[str(arr[i - 1:i + 1])] = 1
	else:
		s[str(arr[i - 1:i + 1])] += 1
for i in s:
	if s[i] >= ans:
		ans = s[i]
		ap = i
print(ap)


n = int(input())
l = input()
ans = []
fc = 0
for i in range(n - 1):
	c = 0
	for j in range(n - 1):
		if l[i] == l[j] and l[i + 1] == l[j + 1]:
			c += 1
			fc = max(c, fc)
	if c >= fc:
		fst = l[i]
		snd = l[i + 1]
if c == 0:
	print(l[0], l[1], sep='')
else:
	print(fst, snd, sep='')


n = int(input())
string = input()
string = string[0:n]
dic = {}
for i in range(n - 1):
	if string[i:i + 2] in dic:
		dic[string[i:i + 2]] = dic[string[i:i + 2]] + 1
	else:
		dic[string[i:i + 2]] = 1
print(max(dic, key=lambda x: dic.get(x)))


n = int(input())
s = input()
dic = {}
for i in range(0, n - 1):
	str = s[i:i + 2]
	if str in dic:
		dic[str] += 1
	else:
		dic[str] = 1
(max, mtime) = ('', 0)
for each in dic:
	if dic[each] > mtime:
		(max, mtime) = (each, dic[each])
print(max)


a = int(input())
b = input()
mp = {}
for i in range(len(b) - 1):
	try:
		mp[b[i:i + 2]] += 1
	except:
		mp[b[i:i + 2]] = 1
mx = 0
mv = ''
for (k, v) in mp.items():
	if v > mx:
		mx = v
		mv = k
print(mv)


n = int(input())
s = input()
twograms = []
for i in range(0, n):
	if i == n - 1:
		break
	twograms.append(s[i:i + 2])
print(max(set(twograms), key=twograms.count))


t = int(input())
x = input()
a = list(x)
l = []
for i in range(t - 1):
	s = ''.join(map(str, a[i:i + 2]))
	l.append(s)
y = max(set(l), key=l.count)
print(y)


n = int(input())
s = input()
m = 0
ans = ''
for x in range(n - 1):
	k = s[x:x + 2]
	j = 0
	for y in range(x, n - 1):
		if s[y:y + 2] == k:
			j += 1
	if j > m:
		m = j
		ans = k
print(ans)


n = int(input())
s = input()
m = {}
for i in range(len(s) - 1):
	subs = s[i:i + 2]
	if subs in m:
		m[subs] += 1
	else:
		m[subs] = 1
maxsubs = ''
maxc = 0
for (subs, count) in m.items():
	if count > maxc:
		maxsubs = subs
		maxc = count
print(maxsubs)


n = int(input())
s = input()
l = list(s)
res = ''
maxc = 0
for i in range(n - 1):
	temp = s[i:i + 2]
	c = 1
	for j in range(i + 1, n - 1):
		new = s[j:j + 2]
		if new == temp:
			c += 1
	if c > maxc:
		res = temp
		maxc = c
print(res)


n = int(input())
s = str(input())
r = []
for i in range(1, n):
	r += [s[i - 1] + s[i]]
r = sorted(r, key=lambda x: r.count(x))
print(r[-1])


n = int(input())
s = input()
i = 0
d = {}
for i in range(n - 1):
	t = s[i] + s[i + 1]
	if t in d:
		d[t] += 1
	else:
		d[t] = 1
mx = 0
gr = ''
for gram in d:
	if d[gram] > mx:
		mx = d[gram]
		gr = gram
print(gr)


a = input()
b = input()
c = []
for i in range(len(b) - 1):
	c.append(b[i:i + 2])
d = list(set(c))
x = 0
for i in d:
	if c.count(i) > x:
		x = c.count(i)
		z = i
print(z)


n = int(input())
s = input()
l = []
for i in range(len(s) - 1):
	l.append(s[i:i + 2])
s = set(l)
m = 0
for i in s:
	k = l.count(i)
	if k > m:
		m = k
		j = i
print(j)


inp0 = int(input())
inp = input()
Capitals = dict()
max = -1
key_max = ''
for i in range(inp0 - 1):
	Capitals[inp[i] + inp[i + 1]] = 0
for i in range(inp0 - 1):
	Capitals[inp[i] + inp[i + 1]] = Capitals[inp[i] + inp[i + 1]] + 1
for i in range(inp0 - 1):
	if max < Capitals[inp[i] + inp[i + 1]]:
		max = Capitals[inp[i] + inp[i + 1]]
		key_max = inp[i] + inp[i + 1]
print(key_max)


n = int(input())
s = input()
d = {}
for i in range(n - 1):
	if s[i:i + 2] in d.keys():
		d[s[i:i + 2]] += 1
	else:
		d[s[i:i + 2]] = 1
M = max(d.values())
best = None
for u in d.keys():
	if d[u] == M:
		best = u
print(best)


n = eval(input())
s = input()
memo = {'': 0}
best = ''
for i in range(n - 1):
	aux = s[i:i + 2]
	if aux in memo:
		memo[aux] = memo[aux] + 1
	else:
		memo[aux] = 1
	if memo[aux] > memo[best]:
		best = aux
print(best)


from math import *
from collections import *
from itertools import *
from functools import *
from bisect import *
from heapq import *
from operator import *
from sys import *
setrecursionlimit(100000000)
n = int(input())
s = input()
d = defaultdict(int)
for i in range(len(s) - 1):
	d[s[i:i + 2]] += 1
(ma, mb) = (0, s[0])
for x in d:
	if d[x] > ma:
		ma = d[x]
		mb = x
print(mb)


def main():
	n = int(input())
	s = input()
	ans = 0
	ans_str = ''
	for i in range(n - 1):
		tg = s[i:i + 2]
		total = 0
		for j in range(n - 1):
			if s[j] == tg[0] and s[j + 1] == tg[1]:
				total += 1
		if total > ans:
			ans = total
			ans_str = tg
	print(ans_str)
main()


num = int(input())
Str = input()
cnt = []
for i in range(num - 1):
	cnt.append(Str[i] + Str[i + 1])
print(max(cnt, key=cnt.count))


n = int(input())
s = input()
ans = 's'
ml = 0
for i in range(n - 1):
	c = s[i:i + 2]
	l = 0
	for j in range(n - 1):
		if c == s[j:j + 2]:
			l += 1
	if l > ml:
		ml = l
		ans = c
print(ans)


n = int(input())
s = input()
dic = {}
for i in range(n - 1):
	if s[i:i + 2] in dic:
		dic[s[i:i + 2]] += 1
	else:
		dic[s[i:i + 2]] = 1
print(max(dic, key=dic.get))


n = int(input())
s = input()
m = dict()
for i in range(0, n - 1):
	x = s[i] + s[i + 1]
	if x in m:
		m[x] += 1
	else:
		m[x] = 1
ans = 0
a = ''
for x in m:
	if m[x] > ans:
		ans = m[x]
		a = x
print(a)


n = int(input())
s = input()
ans = {}
max = -1
for i in range(0, len(s) - 1):
	temp = s[i] + s[i + 1]
	if temp not in ans:
		ans[temp] = 1
	else:
		ans[temp] += 1
	if ans[temp] > max:
		max = ans[temp]
for item in ans:
	if ans[item] == max:
		print(item)
		break


n = int(input())
s = input()
l = []
num = []
for i in range(n - 1):
	if s[i] + '' + s[i + 1] not in l:
		l.append(s[i] + '' + s[i + 1])
		num.append(1)
	else:
		num[l.index(s[i] + '' + s[i + 1])] += 1
print(l[num.index(max(num))])


n = int(input())
s = str(input())
dict = {}
for i in range(len(s) - 1):
	if s[i] + s[i + 1] in dict.keys():
		dict[s[i] + s[i + 1]] += 1
	else:
		dict[s[i] + s[i + 1]] = 1
min = 0
val = ''
for j in dict.keys():
	if dict[j] > min:
		min = dict[j]
		val = j
print(val)


n = int(input())
s = input()
lst = []
for i in range(n - 1):
	lst.append(s[i] + s[i + 1])
lstCnt = []
for ls in lst:
	lstCnt.append(lst.count(ls))
print(lst[lstCnt.index(max(lstCnt))])


n = int(input())
l = input().upper()
l = list(l)
h = 0
k = 0
b = 0
u = len(l) - 1
p = 0
for i in range(0, 1):
	g = l[i:i + 2]
	if g == ['U', 'R']:
		b = 2
		break
	else:
		for i in range(u):
			g = l[i:i + 2]
			if g == p:
				v = 0
			else:
				for j in range(i + 1, len(l)):
					if g == l[j:j + 2]:
						h = h + 1
			if h > k:
				p = g
				k = h
				h = 0
				b = 1
if b == 1:
	print(''.join(map(str, p)))
elif b == 2:
	print('IB')
else:
	print(''.join(map(str, g)))


n = int(input())
s = input()
ans = ''
maxi = -1
for i in range(n - 1):
	t = s[i:i + 2]
	c = 0
	for j in range(n - 1):
		if s[j:j + 2] == t:
			c += 1
	if c > maxi:
		ans = t
		maxi = c
print(ans)


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
print(list(frequencies.keys())[list(frequencies.values()).index(max(list(frequencies.values())))])


n = int(input())
s = input()
dic = {}
for i in range(0, n - 1):
	a = s[i:i + 2]
	if a in dic:
		dic[a] += 1
	else:
		dic[a] = 1
l = len(dic)
h = sorted(((value, key) for (key, value) in dic.items()))
print(h[l - 1][1])


n = int(input())
s = input()
c = {}
for i in range(len(s) - 1):
	if c.get(s[i:i + 2]):
		c[s[i:i + 2]] += 1
	else:
		c[s[i:i + 2]] = 1
_max = 0
_s = ''
for (k, v) in c.items():
	if v > _max:
		_s = k
		_max = v
print(_s)


n = int(input())
word = input()
pair = {}
for i in range(n - 1):
	s = word[i] + word[i + 1]
	if s in pair:
		pair[s] += 1
	else:
		pair[s] = 1
co = 0
for i in pair:
	if pair[i] > co:
		co = pair[i]
		x = i
print(x)


L = int(input())
S = input()
MAP = {}
for I in range(L - 1):
	M = S[I:I + 2]
	if M in MAP:
		MAP[M] += 1
	else:
		MAP[M] = 1
maxval = 0
maxkey = 'OH NO'
for key in MAP:
	if MAP[key] > maxval:
		maxval = MAP[key]
		maxkey = key
print(maxkey)


n = int(input())
str1 = input()
list1 = list(str1)
maxCountStr = ''
maxCount = 0
for i in range(len(list1) - 1):
	newStr = ''.join(list1[i:i + 2])
	count = 1
	for j in range(i + 1, len(list1) - 1):
		strVal = ''.join(list1[j:j + 2])
		if strVal == newStr:
			count += 1
	if count > maxCount:
		maxCountStr = newStr
		maxCount = count
print(maxCountStr)


n = int(input())
a = input()
d = dict()
for i in range(n - 1):
	if a[i:i + 2] in d:
		d[a[i:i + 2]] += 1
	else:
		d[a[i:i + 2]] = 1
maxi = d[a[:2]]
temp = a[:2]
for i in d:
	if d[i] > maxi:
		maxi = d[i]
		temp = i
print(temp)


n = int(input())
s = input()
mx = 0
dic = {}
dic2 = {}
for i in range(n - 1):
	if s[i:i + 2] in dic:
		dic[s[i:i + 2]] += 1
		mx = max(mx, dic[s[i:i + 2]])
	else:
		dic[s[i:i + 2]] = 1
		mx = max(mx, 1)
for (x, y) in dic.items():
	dic2[y] = x
print(dic2[mx])


n = int(input())
s = input()
pairs = []
for i in range(n - 1):
	pairs.append(s[i:i + 2])
maxi = 0
st = ''
for pair in set(pairs):
	if pairs.count(pair) > maxi:
		maxi = pairs.count(pair)
		st = pair
print(st)


n = int(input())
str1 = input()
dict1 = {}
for i in range(len(str1)):
	m = str1[i:2 + i]
	dict1[m] = dict1.get(m, 0) + 1
max_key = max(dict1, key=dict1.get)
print(max_key)


from collections import defaultdict
(n, s, d) = (int(input()), input(), defaultdict(int))
for i in range(n - 1):
	d[s[i:i + 2]] += 1
print(max(d.items(), key=lambda data: data[1])[0])


import sys
from collections import defaultdict

def twogram(input, n):
	d = defaultdict(int)
	for i in range(n - 1):
		d[input[i:i + 2]] += 1
	return max(d.items(), key=lambda item: item[1])[0]
n = int(sys.stdin.readline())
input = sys.stdin.readline()
print(twogram(input, n))


x = int(input())
y = input()
d = dict()
cntr = 0
maxim = 0
maxi = ''
for i in range(x - 1):
	gram = y[i] + y[i + 1]
	if gram in d:
		d[gram] = d[gram] + 1
	else:
		d[gram] = 1
	if cntr == 0:
		maxi = gram
		maxim = d[gram]
		cntr = cntr + 1
	elif d[gram] > maxim:
		maxi = gram
		maxim = d[gram]
print(maxi)


import sys
n = int(input())
string = input()
d = {}
for i in range(n - 1):
	if d.get(string[i] + string[i + 1]):
		d[string[i] + string[i + 1]] += 1
	else:
		d[string[i] + string[i + 1]] = 1
maxInt = -sys.maxsize
for i in d.items():
	if i[1] > maxInt:
		maxInt = i[1]
		out = i[0]
print(out)


n = int(input())
s = input()
F = {}
n = n - 1
res = 0
ans = ''
for i in range(n):
	x = s[i:i + 2]
	if x not in F:
		F[x] = 1
	else:
		F[x] = F[x] + 1
	if F[x] > res:
		res = F[x]
		ans = x
print(ans)


n = int(input())
s = list(input())
t = []
for i in range(n):
	if i != n - 1:
		t.append(s[i] + s[i + 1])
print(max(set(t), key=t.count))


n = int(input())
b = input()
s = 0
w = 0
z = str()
for i in range(1, n):
	if b[i] == b[i - 1]:
		for j in range(1, n):
			if b[i - 1] + b[i] == b[j - 1] + b[j]:
				w += 1
	if w - 1 > s:
		s = w
		z = b[i] + b[i]
	elif b.count(b[i - 1] + b[i]) > s:
		s = b.count(b[i - 1] + b[i])
		z = b[i - 1] + b[i]
print(z)


a = int(input())
s = input()
sma = ''
m = 0
for i in range(len(s) - 1):
	k = 0
	sm = s[i] + s[i + 1]
	for j in range(len(s) - 1):
		sm1 = s[j] + s[j + 1]
		if sm == sm1:
			k += 1
	else:
		if k > m:
			m = k
			sma = sm
print(sma)


from collections import defaultdict
couple = defaultdict(lambda : defaultdict(int))
n = int(input())
s = input()
for i in range(n - 1):
	couple[s[i]][s[i + 1]] += 1
maxi = 0
word = ''
for (key, value) in couple.items():
	for (key2, value2) in value.items():
		if value2 >= maxi:
			maxi = value2
			word = key + key2
print(word)


import sys
from math import *

def input():
	return sys.stdin.readline().strip()
n = int(input())
s = list(input())
d = dict()
for i in range(1, len(s)):
	k = s[i - 1] + s[i]
	d[k] = d.get(k, 0) + 1
m = 0
s = ''
for i in d:
	if d[i] > m:
		m = d[i]
		s = i
print(s)


from collections import defaultdict
n = int(input())
s = input()
d = defaultdict(int)
for i in range(n - 1):
	d[s[i:i + 2]] += 1
mkey = 0
m = 0
for key in d.keys():
	if d[key] > m:
		mkey = key
		m = d[key]
print(mkey)


n = int(input())
s = input()
grams = {}
mfg = ['', 0]
for index in range(len(s) - 1):
	if s[index] + s[index + 1] in grams:
		grams[s[index] + s[index + 1]] += 1
		if grams[s[index] + s[index + 1]] > mfg[1]:
			mfg[0] = s[index] + s[index + 1]
			mfg[1] = grams[s[index] + s[index + 1]]
	else:
		grams.update({s[index] + s[index + 1]: 1})
		if grams[s[index] + s[index + 1]] > mfg[1]:
			mfg[0] = s[index] + s[index + 1]
			mfg[1] = grams[s[index] + s[index + 1]]
print(mfg[0])


n = int(input())
S = input()
D = {}
M = 0
tM = ''
for i in range(1, len(S)):
	if S[i - 1:i + 1] in D:
		D[S[i - 1:i + 1]] += 1
	else:
		D[S[i - 1:i + 1]] = 1
	if D[S[i - 1:i + 1]] > M:
		tM = S[i - 1:i + 1]
		M = D[S[i - 1:i + 1]]
print(tM)


def main():
	n = int(input())
	s = input()
	lookup = {}
	for i in range(1, n):
		curr = s[i - 1:i + 1]
		if curr not in lookup:
			lookup[curr] = 1
		else:
			lookup[curr] += 1
	keys = list(lookup.keys())
	keys.sort(key=lambda x: lookup[x], reverse=True)
	print(keys[0])
main()


from collections import defaultdict
nb_letter = int(input())
letters = input()
dict_words = defaultdict(lambda : 0)
for x in range(0, nb_letter - 1):
	dict_words[letters[x] + letters[x + 1]] += 1
maxi = 0
word = ''
for key in dict_words:
	if dict_words[key] > maxi:
		maxi = dict_words[key]
		word = key
print(word)


def TwoGrams():
	n = int(input())
	s = input().strip()
	two_grams = dict()
	for i in range(n - 1):
		two_grams[s[i:i + 2]] = two_grams.setdefault(s[i:i + 2], 0) + 1
	return sorted([(two_grams[k], k) for k in two_grams.keys()], reverse=True)[0][1]
a = TwoGrams()
print(a)


qtd = int(input())
string = input()
dicionario = {}
for i in range(1, qtd):
	temp = string[i - 1] + string[i]
	if temp in dicionario:
		dicionario[temp] = dicionario[temp] + 1
	else:
		dicionario[temp] = 1
maiorn = 0
maiors = ''
for chave in dicionario:
	if dicionario[chave] > maiorn:
		maiorn = dicionario[chave]
		maiors = chave
print(maiors)


n = int(input())
s = input()
m = dict()
ans = 0
for i in range(n - 1):
	tempstr = s[i:i + 2]
	if tempstr in m:
		m[tempstr] += 1
	else:
		m[tempstr] = 1
	if m[tempstr] > ans:
		ans = m[tempstr]
for i in m:
	if m[i] == ans:
		print(i)
		break


n = input()
stri = str(input())
dep = {}
highestcount = 0
twogram = ''
if len(stri) > 2:
	for i in range(0, len(stri) - 1, 1):
		dep[stri[int(i):int(i + 2)]] = dep.get(stri[int(i):int(i + 2)], 0) + 1
		if dep.get(stri[int(i):int(i + 2)], 0) > highestcount:
			highestcount = dep.get(stri[int(i):int(i + 2)], 0)
			twogram = stri[int(i):int(i + 2)]
else:
	twogram = stri
print(twogram)


n = int(input())
s = input()
se = set()
for i in range(0, n - 1):
	se.add(s[i] + s[i + 1])
d = {}
for i in se:
	d[i] = 0
	for j in range(n - 1):
		if s[j] + s[j + 1] == i:
			d[i] += 1
d = sorted(d.items(), key=lambda x: x[1], reverse=True)
print(d[0][0])


n = int(input())
l = input()
lt = []
for i in range(n - 1):
	c = 0
	for j in range(n - 1):
		if l[i] + l[i + 1] == l[j] + l[j + 1]:
			c += 1
	lt.append(c)
mx = lt.index(max(lt))
print(l[mx] + l[mx + 1])


n = int(input())
s = input()
d = {}
for i in range(len(s) - 1):
	d[s[i] + s[i + 1]] = 0
for i in range(len(s) - 1):
	d[s[i] + s[i + 1]] += 1
maior = -1
smaior = ''
for i in d:
	if d[i] >= maior:
		smaior = i
		maior = d[i]
print(smaior)


def main():
	import sys
	l = int(sys.stdin.readline())
	st = sys.stdin.readline().strip('\n')
	two_grams = {}
	for x in range(len(st) - 1):
		curr = st[x:x + 2]
		if curr not in two_grams.keys():
			two_grams[curr] = 1
		else:
			two_grams[curr] += 1
	m = max(two_grams.values())
	for (k, v) in two_grams.items():
		if v == m:
			print(k)
			break
main()


n = int(input())
s = input()
lookup = {}
maximum = 0
string = ''
for i in range(n - 1):
	twogram = s[i:i + 2]
	if twogram in lookup:
		lookup[twogram] += 1
	else:
		lookup[twogram] = 1
	if lookup[twogram] > maximum:
		string = twogram
		maximum = lookup[twogram]
print(string)


n = int(input()) + 1
s = input()
D = {}
for i in range(2, n):
	r = s[i - 2:i]
	if r in D:
		D[r] += 1
	else:
		D[r] = 1
D = sorted(D.items(), key=lambda x: x[1], reverse=True)
print(D[0][0])


n = int(input())
s = input()
cnt = {}
for i in range(n - 1):
	if s[i] + s[i + 1] in cnt.keys():
		cnt[s[i] + s[i + 1]] += 1
	else:
		cnt[s[i] + s[i + 1]] = 1
m = max(cnt.values())
for k in cnt.keys():
	if cnt[k] == m:
		print(k)
		break


from collections import OrderedDict
n = int(input())
line = input()
ans = OrderedDict()
proverka = set()

def povtor(line, d):
	i = 0
	st = 0
	while True:
		st = line.find(d, st) + 1
		if st > 0:
			i += 1
		else:
			return i
for i in range(len(line) - 1):
	d = line[i:i + 2]
	if d in proverka:
		continue
	proverka.add(d)
	ans[d] = povtor(line, d)
j = max(zip(ans.values(), ans.keys()))[1]
print(j)


n = int(input())
ch = input()
d = {}
L = []
for i in range(len(ch) - 1):
	s = ch[i] + ch[i + 1]
	if s in L:
		d[s] += 1
	else:
		L.append(s)
		d[s] = 1
ll = [(x[1], x[0]) for x in d.items()]
print(max(ll)[1])


n = int(input())
str = input()
max = 0
str1 = ''
for j in range(n - 1):
	a = str[j:j + 2]
	m = 0
	for i in range(n - 1):
		if str[i:i + 2] == a:
			m += 1
	if m > max:
		max = m
		str1 = a
print(str1)


n = int(input())
s = input()
sl = []
for i in range(len(s)):
	ans = ''
	if i == len(s) - 1:
		continue
	else:
		ans = s[i] + s[i + 1]
		sl.append(ans)
c = []
for i in sl:
	ans1 = ''
	count = 0
	for j in range(n):
		if j == n - 1:
			continue
		else:
			ans1 = s[j] + s[j + 1]
			if ans1 == i:
				count += 1
	c.append(count)
m = c.index(max(c))
print(sl[m])


from collections import Counter

def main():
	n = int(input())
	inp = input()
	k = []
	for i in range(n - 1):
		k.append(inp[i] + inp[i + 1])
	l = Counter(k)
	print(max(l, key=l.get))
main()


n = int(input())
s = input()
l = []
for i in zip(s, s[1:]):
	l.append(''.join(i))
m = []
for i in l:
	if i not in m:
		m.append(i)
h = []
for i in m:
	h.append(l.count(i))
c = h.index(max(h))
print(m[c])


n = int(input())
a = input()
b = ''
d = ''
c = 0
e = ''
for i in range(n - 1):
	b = a[i] + a[i + 1]
	e = e + b
	e = e + '.'
	if e.count(b) > c:
		c = e.count(b)
		d = b
print(d)


from collections import defaultdict
n = int(input())
s = input()
c = defaultdict(int)
mx = 0
ans = ''
for i in range(n - 1):
	cand = s[i:i + 2]
	c[cand] += 1
	if c[cand] > mx:
		mx = c[cand]
		ans = cand
print(ans)


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
mod = int(pow(10, 9) + 7)
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def l():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
n = l()[0]
s = input()
A = []
for i in range(n - 1):
	A.append(s[i:i + 2])
m = 0
fg = ''
for i in range(len(A)):
	x = A.count(A[i])
	if x > m:
		m = x
		fg = A[i]
print(fg)


n = int(input())
s = input()
ans = ''
maxnum = 0
for i in range(n - 1):
	t = 0
	for j in range(n - 1):
		if s[i] == s[j] and s[i + 1] == s[j + 1]:
			t += 1
	if t > maxnum:
		maxnum = t
		ans = s[i:i + 2]
print(ans)


def main():
	(n, seq) = (int(input()), list(input()))
	tseq = zip(seq, seq[1:])
	dseq = {}
	ma = 0
	for a in tseq:
		if a in dseq:
			dseq[a] += 1
			if dseq[a] > ma:
				ma = dseq[a]
				aux = a
		else:
			dseq[a] = 1
			if not ma:
				ma = 1
				aux = a
	print(aux[0] + aux[1])
main()


def count(w, key):
	c = 0
	for i in range(len(w) - 1):
		if w[i:i + 2] == key:
			c += 1
	return c
a = {}
n = int(input())
w = input()
for _ in range(n - 1):
	key = w[_:_ + 2]
	a[key] = count(w, key)
	if _ > 0:
		if a[p] < a[key]:
			p = key
	else:
		p = key
print(p)


from collections import defaultdict
n = int(input())
s = input()
d = defaultdict(int)
n = len(s)
for i in range(len(s) - 1):
	d[s[i:i + 2]] += 1
ans = 0
res = ''
for i in d:
	if d[i] > ans:
		res = i
		ans = d[i]
print(res)


n = int(input())
s = input()
di = {}
for i in range(n - 1):
	k = s[i] + s[i + 1]
	if k not in di:
		di[k] = 0
	di[k] += 1
di = sorted(di, key=lambda x: di[x], reverse=True)
print(di[0])


n = int(input())
s = input()
m = ['', 0]
h = {}
for i in range(n - 1):
	sub = s[i] + s[i + 1]
	if sub in h:
		h[sub] += 1
	else:
		h[sub] = 1
	if h[sub] > m[1]:
		m[0] = sub
		m[1] = h[sub]
print(m[0])


n = int(input())
s = input()
(l, l1) = ([], [])

def subString(s, n):
	for i in range(n):
		for len in range(i + 1, n + 1):
			l.append(s[i:len])
subString(s, len(s))
for i in l:
	if len(i) == 2:
		l1.append(i)
max = 0
res = l1[0]
for i in l1:
	freq = l1.count(i)
	if freq > max:
		max = freq
		res = i
print(str(res))


n = int(input())
s = input()
dic1 = dict()
for i in range(len(s) - 1):
	t = s[i:i + 2]
	if t in dic1:
		dic1[t] += 1
	else:
		dic1[t] = 1
max = 0
ans = ''
for i in dic1:
	if dic1[i] > max:
		max = dic1[i]
		ans = i
print(ans)


n = int(input())
s = input()
d = {}
for i in range(0, n - 1):
	digram = s[i:i + 2]
	if digram not in d:
		d[digram] = 1
	else:
		d[digram] += 1
res = list(d.items())
for i in range(len(res)):
	res[i] = res[i][::-1]
res.sort(reverse=True)
print(res[0][1])


n = int(input())
r = input()
maxi = [0, 0]
for i in range(0, n - 1):
	t = 0
	for j in range(i + 1, n - 1):
		if r[i:i + 2] == r[j:j + 2]:
			t += 1
	if t > maxi[0]:
		maxi[0] = t
		maxi[1] = i
print(r[maxi[1]:maxi[1] + 2])


n = int(input())
s = input()
max_count = 0
for i in range(len(s) - 1):
	tmp = 0
	sub = s[i:i + 2]
	for j in range(len(s) - 1):
		if s[j:j + 2] == sub:
			tmp += 1
	if tmp > max_count:
		max_count = tmp
		ans = sub
print(ans)


a = int(input())
word = input()
w = []
num = []
r = []
n = None
m = None
p = ''
ind = None
ans = None
for i in range(0, a - 1):
	w.insert(i, word[i] + word[i + 1])
for i in range(65, 91):
	for k in range(65, 91):
		n = chr(i)
		m = chr(k)
		p = n + m
		r.append(p)
for u in range(0, 676):
	num.append(w.count(r[u]))
ind = num.index(max(num))
ans = r[ind]
print(ans)


def find(string, substring):
	count = 0
	start = 0
	while start < len(string):
		flag = string.find(substring, start)
		if flag != -1:
			start = flag + 1
			count += 1
		else:
			return count
n = int(input())
s = input().strip()
x = []
for i in range(n - 1):
	a = s[i]
	for j in range(i + 1, n):
		x.append(a + s[j])
count = 0
x = list(set(x))
for i in range(len(x)):
	if find(s, x[i]) > count:
		count = find(s, x[i])
		r = x[i]
print(r)


n = int(input())
s = input()
freq = {}
for i in range(n - 1):
	two_gram = s[i:i + 2]
	if two_gram not in freq:
		freq[two_gram] = 1
	else:
		freq[two_gram] = freq[two_gram] + 1
max_freq = 0
for key in freq:
	if freq[key] > max_freq:
		max_freq = freq[key]
		max_key = key
print(max_key)


n = int(input())
s = input()
twogramms = dict()
l = 0
r = 2
while r != n:
	twogramms[s[l:r]] = 0
	l += 1
	r += 1
twogramms[s[l:r]] = 0
mxcount = 1
l = 0
r = 2
while r != n:
	twogramms[s[l:r]] += 1
	l += 1
	r += 1
twogramms[s[l:r]] += 1
for (j, i) in twogramms.items():
	if i >= mxcount:
		ans = j
		mxcount = i
print(ans)


n = int(input())
s = input()
e = list(set(s))
sub = []
for i in range(len(e)):
	for j in range(len(e)):
		sub.append(e[i] + e[j])
res = []
for i in sub:
	c = 0
	for j in range(n - 1):
		if s[j] + s[j + 1] == i:
			c += 1
	res.append([c, i])
res = sorted(res)[::-1]
print(res[0][1])


length = int(input())
string = str(input())
_dict = dict()
for i in range(length - 1):
	Count = _dict.get(string[i:i + 2], 0)
	_dict.update({string[i:i + 2]: int(Count) + 1})
(maxElement, maxElementCount) = (0, -1)
for key in _dict:
	if _dict[key] > maxElementCount:
		maxElementCount = _dict[key]
		maxElement = key
print(maxElement)


n = int(input())
t = input()
d = {}
m = 0
sol = ''
for i in range(n - 1):
	if t[i:i + 2] not in d:
		d[t[i:i + 2]] = 1
	else:
		d[t[i:i + 2]] += 1
for j in d:
	if d[j] > m:
		m = d[j]
		sol = j
print(sol)


n = int(input())
i = 0
tables = []
scores = []
s = input()
while i < len(s) - 1:
	if s[i] + s[i + 1] not in tables:
		tables.append(s[i] + s[i + 1])
		scores.append(1)
	else:
		scores[tables.index(s[i] + s[i + 1])] += 1
	i += 1
print(tables[scores.index(max(scores))])


t = int(input())
s = input()
c = []
if len(s) == 2:
	print(s)
else:
	for i in range(len(s) - 2):
		x = s[i:i + 2]
		count = 0
		for j in range(i + 1, len(s)):
			if x == s[j:j + 2]:
				count += 1
		c.append(count)
	m = max(c)
	d = 0
	for j in range(len(c)):
		if c[j] == m:
			print(s[j:j + 2])
			break


n = int(input())
k = input()
a = []
b = []
for i in range(n - 1):
	(s, l) = (0, k[i] + k[i + 1])
	for j in range(n - 1):
		l2 = k[j] + k[j + 1]
		if l == l2:
			s = s + 1
	a.append(s)
	b.append(l)
print(b[a.index(max(a))])


n = int(input())
k = input()
d = {}
for i in range(len(k) - 1):
	m = ''.join(k[i:i + 2])
	if m in d:
		d[m] += 1
	else:
		d.update({m: 1})
m = 0
p = ''
for i in d:
	if d[i] > m:
		m = d[i]
		p = i
print(p)


n = int(input())
s = input()
l = []
counter = 0
for i in range(n - 1):
	x = s[i] + s[i + 1]
	l.append(x)
for i in l:
	f = l.count(i)
	if f > counter:
		counter = f
		g = i
print(g)


def most_frequent(array):
	return max(set(array), key=array.count)
n = int(input())
s = input()
two_grams = []
for i in range(n):
	two_grams.append(s[i:i + 2])
print(most_frequent(two_grams))


a = int(input())
b = input()
dict = {}
first = b[0]
point1 = 0
point2 = ''
for k in range(1, a):
	if first + b[k] not in dict:
		dict[first + b[k]] = 1
	else:
		dict[first + b[k]] += 1
	if dict[first + b[k]] > point1:
		point1 = dict[first + b[k]]
		point2 = first + b[k]
	first = b[k]
print(point2)


from collections import defaultdict
n = int(input())
s = input()
d = defaultdict(int)
max = 0
for i in range(n - 1):
	d[s[i] + s[i + 1]] += 1
	if d[s[i] + s[i + 1]] > max:
		max = d[s[i] + s[i + 1]]
		res = s[i] + s[i + 1]
print(res)


amount = int(input())
string = input()
array = {}
for i in range(len(string) - 1):
	if not string[i:i + 2] in array:
		array.update({string[i:i + 2]: 1})
	else:
		array[string[i:i + 2]] += 1
max_ = -1
res = ''
for key in array:
	if array[key] > max_:
		res = key
		max_ = array[key]
print(res)


N = int(input())
S = list(input())
dic = {}
pre_s = ''
tg = ''
for c in S:
	if pre_s != '':
		tg = pre_s + c
		if (tg in dic) == False:
			dic[tg] = 1
		else:
			dic[tg] += 1
	pre_s = c
currentMax = 0
ans = ''
for (key, value) in dic.items():
	if currentMax < value:
		currentMax = value
		ans = key
print(ans)


n = int(input())
s = input()
compteur = []
for i in range(n - 1):
	twogram = s[i] + s[i + 1]
	for j in compteur:
		if j[0] == twogram:
			j[1] += 1
			break
	else:
		compteur.append([twogram, 1])
compteur.sort(key=lambda x: x[1], reverse=True)
print(compteur[0][0])


n = int(input())
a = input()
d = {}
for i in range(1, n):
	h = a[i - 1] + a[i]
	try:
		d[h] += 1
	except:
		d.update({h: 1})
ans = 0
for i in d:
	if d[i] > ans:
		ans = d[i]
		r = i
print(r)


n = int(input())
s = input()
C = []
X = []
for i in range(1, n):
	x = s[i - 1] + s[i]
	c = 1
	for j in range(i, n - 1):
		if s[j] + s[j + 1] == x:
			c += 1
	C.append(c)
	X.append(x)
print(X[C.index(max(C))])


n = int(input())
s = input()
ans = {}
for i in range(1, n):
	before = i - 1
	twogram = s[before:i + 1]
	if twogram in ans:
		ans[twogram] += 1
	else:
		ans[twogram] = 1
s_ans = sorted(ans.items(), key=lambda item: item[1], reverse=True)
print(s_ans[0][0])


def nb_occ(ss, s):
	i = 0
	res = 0
	while i < len(s) - 1:
		if s[i] + s[i + 1] == ss:
			res += 1
		i += 1
	return res

def peterpartout(s, taille):
	if taille == 0 or taille == 1:
		return 'koto'
	else:
		d = {}
		i = 1
		res = s[0] + s[1]
		resocc = nb_occ(res, s)
		while i < taille - 1:
			tmp = s[i] + s[i + 1]
			if not tmp in d:
				nbocctmp = nb_occ(tmp, s[i:])
				if nbocctmp > resocc:
					res = tmp
					resocc = nbocctmp
				d[tmp] = 1
			i += 1
		return res
n = int(input())
s = input()
print(peterpartout(s, n))


dict = {}
n = int(input())
str = input()
for i in range(0, len(str) - 1):
	ss = str[i:i + 2]
	dict[ss] = 0
for i in range(0, len(str) - 1):
	ss = str[i:i + 2]
	dict[ss] += 1
maxOccur = ''
maxim = 0
for keys in dict:
	if dict[keys] > maxim:
		maxim = dict[keys]
		maxOccur = keys
print(maxOccur)


from collections import defaultdict
n = int(input())
s = input()
d = defaultdict(int)
for i in range(1, n):
	d[s[i - 1] + s[i]] += 1
num = 0
t = ''
for (k, v) in d.items():
	if v > num:
		t = k
		num = v
print(t)


n = int(input())
s = input()
(max, x) = (0, '')
for i in range(0, len(s) - 1):
	k = 0
	for j in range(0, len(s) - 1):
		if s[i:i + 2] == s[j:j + 2]:
			k += 1
	else:
		if k > max or max == 0:
			x = s[i:i + 2]
			max = k
print(x)


n = int(input())
s = input()
counts = dict()
for i in range(n - 1):
	name = s[i:i + 2]
	counts[name] = counts.get(name, 0) + 1
ans = sorted(counts, key=counts.get, reverse=True)
print(ans[0])


import itertools
input()
S = input()
P = 'QWERTYUIOPASDFGHJKLZXCVBNM'
L = []
for c1 in P:
	for c2 in P:
		L.append(c1 + c2)
max_ = 0
otv = ''
c = 0
for i in L:
	for j in range(len(S) - 1):
		if S[j] + S[j + 1] == i:
			c += 1
	if c > max_:
		max_ = c
		otv = i
	c = 0
print(otv)


num = int(input())
string = input()
num = int(num)
max_count = 0
max_str = ''
grams = []
for i in range(len(string) - 1):
	found = False
	a_string = string[i] + string[i + 1]
	if len(grams) == 0:
		grams.append([a_string, 1])
	else:
		for j in grams:
			if j[0] == a_string:
				j[1] += 1
				found = True
				break
		if not found:
			grams.append([a_string, 1])
for item in grams:
	if item[1] >= max_count:
		max_count = item[1]
		max_str = item[0]
print(max_str)


n = int(input())
s = input()
d = {}
for i in range(n - 1):
	p = s[i] + s[i + 1]
	d[p] = d.get(p, 0) + 1
a = max(d.values())
for i in d:
	if d[i] == a:
		print(i)
		break


n = int(input())
a = input()
l = []
s = ''
for i in range(len(a) - 1):
	s += a[i:i + 2]
	l.append(s)
	s = ''
b = max(l, key=l.count)
print(b)


from collections import defaultdict
n = int(input())
s = str(input())
d = defaultdict(lambda : 0)
length = len(s)
maximum = [0, '']
for i in range(0, length - 1):
	d[s[i:i + 2]] += 1
	if maximum[0] < d[s[i:i + 2]]:
		maximum[0] = d[s[i:i + 2]]
		maximum[1] = s[i:i + 2]
print(maximum[1])


n = int(input())
s = input()
d = {}
for i in range(n - 1):
	try:
		d[s[i:i + 2]] += 1
	except:
		d[s[i:i + 2]] = 1
man = -1
si = ''
for i in d.keys():
	if d[i] > man:
		man = d[i]
		si = i
print(si)


n = int(input())
s = str(input())
(maxm, temp) = (0, '')

def func1(f, s1):
	count = 0
	for val in range(len(s1) - 1):
		if s1[val] + s1[val + 1] == f:
			count += 1
	return count
for val in range(len(s) - 1):
	if func1(s[val] + s[val + 1], s) > maxm:
		maxm = func1(s[val] + s[val + 1], s)
		temp = s[val] + s[val + 1]
print(temp)


n = int(input())
s = input()
double_gram = {}
for i in range(1, n):
	word = s[i - 1] + s[i]
	if word in double_gram:
		double_gram[word] += 1
	else:
		double_gram[word] = 1
(max_key, max_num) = ('', 0)
for key in double_gram:
	if double_gram[key] > max_num:
		max_num = double_gram[key]
		max_key = key
print(max_key)


n = int(input())
s = input()
foo = []
if n % 2 == 0:
	foo.extend([s[i:i + 2] for i in range(0, n, 2)])
	foo.extend([s[i:i + 2] for i in range(1, n - 1, 2)])
else:
	foo.extend([s[i:i + 2] for i in range(0, n - 1, 2)])
	foo.extend([s[i:i + 2] for i in range(1, n, 2)])
count = 0
st = None
for i in foo:
	if foo.count(i) > count:
		count = foo.count(i)
		st = i
print(st)


import sys
input = sys.stdin.readline
n = int(input())
s = input()[:n]
mx = 0
m = ''
letters = 'abcdefghijklmnopqrstuvwxyz'.upper()
p = []
for i in range(26):
	for j in range(26):
		p.append(letters[i] + letters[j])
for i in p:
	c = 0
	for j in range(n - 1):
		if s[j] == i[0] and s[j + 1] == i[1]:
			c += 1
	if c > mx:
		mx = c
		m = i
print(m)


import sys
n = int(input())
lst = list(input())
maxin = 0
dvugramma = ''
if n == 2 or n == 3:
	print(lst[0] + lst[1])
	sys.exit()
for i in range(n - 1):
	x = 0
	var = lst[i] + lst[i + 1]
	for j in range(i + 1, n - 1):
		z = lst[j] + lst[j + 1]
		if var == ''.join(z):
			x += 1
	if x > maxin:
		maxin = x
		dvugramma = var
if maxin > 0:
	print(dvugramma)
	sys.exit()
print(lst[0] + lst[1])


import sys
import math
import collections
import operator as op
from collections import deque
from math import gcd, inf, sqrt, pi, cos, sin, ceil, log2, floor
from bisect import bisect_right, bisect_left
from functools import reduce
from sys import stdin, stdout, setrecursionlimit
setrecursionlimit(2 ** 20)

def ncr(n, r):
	r = min(r, n - r)
	numer = reduce(op.mul, range(n, n - r, -1), 1)
	denom = reduce(op.mul, range(1, r + 1), 1)
	return numer // denom

def prime_factors(n):
	i = 2
	factors = []
	while i * i <= n:
		if n % i:
			i += 1
		else:
			n //= i
			factors.append(i)
	if n > 1:
		factors.append(n)
	return list(factors)

def sumDigits(no):
	return 0 if no == 0 else int(no % 10) + sumDigits(int(no / 10))
MOD = 1000000007
PMOD = 998244353
N = 10 ** 9 + 7
LOGN = 30
T = 1
for _ in range(T):
	n = int(stdin.readline())
	a = str(stdin.readline().strip('\n'))
	d = {}
	for i in range(n - 1):
		ss = a[i] + a[i + 1]
		if ss not in d:
			d[ss] = 0
		d[ss] += 1
	ans = -1
	s = ''
	for k in d:
		if d[k] > ans:
			ans = d[k]
			s = k
	print(s)


inp = input()
inp1 = input()
(largest, q, p, sum, m) = (0, 0, 1, 0, 0)
while p < len(inp1):
	l1 = inp1[q] + inp1[p]
	m = 0
	sum = 0
	while m + 1 < len(inp1):
		if inp1[m] == l1[0] and inp1[m + 1] == l1[1]:
			sum += 1
		m += 1
	if sum > largest:
		largest = sum
		t = inp1[q] + inp1[p]
	p += 1
	q += 1
print(t)


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)
main()


n = int(input())
s = input()
p = 0
for i in range(n):
	ms = s[i:i + 2]
	t = 0
	for j in range(n):
		if ms == s[j:j + 2]:
			t += 1
	if t > p:
		p = t
		b = ms
print(b)


n = int(input())
s = input()
(mxcnt, mxstr) = (-1, '')
for i in range(n - 1):
	cnt = 0
	for j in range(n - 1):
		if s[i] == s[j] and s[i + 1] == s[j + 1]:
			cnt += 1
	if cnt > mxcnt:
		mxcnt = cnt
		mxstr = s[i:i + 2]
print(mxstr)


n = int(input())
c = str(input())
l = []
occ = []
for i in range(n - 1):
	t = c[i] + c[i + 1]
	if t in l:
		occ[l.index(t)] += 1
	else:
		l.append(t)
		occ.append(1)
print(l[occ.index(max(occ))])


x = int(input())
a = input()
x1 = []
for i in range(len(a) - 1):
	x1.append(a[i:i + 1] + a[i + 1:i + 2])
m = list(set(x1))
sum = 0
for j in range(len(m)):
	k = sum
	sum = max(sum, x1.count(m[j]))
	if sum != k:
		ans = m[j]
print(ans)


n = int(input())
st = input()
d = dict()
for i in range(n - 1):
	news = st[i:i + 2]
	if news in d:
		val = d[news]
		d[news] = val + 1
	else:
		d[news] = 1
maxm = 0
new1 = 1
for k in d:
	if d[k] > maxm:
		maxm = d[k]
		new1 = k
print(new1)


from collections import defaultdict
n = int(input())
s = input()
_mp = defaultdict(lambda : 0)
s += ' '
for i in range(n):
	_mp[s[i:i + 2]] += 1
res = [0, 0]
for i in _mp.keys():
	if res[-1] < _mp[i]:
		res[0] = i
		res[-1] = _mp[i]
print(res[0])


R = lambda : list(map(int, input().split(' ')))
input()
s = input()
a = []
for i in range(len(s) - 1):
	a.append(s[i:i + 2])
print(max(a, key=a.count))


def main():
	length = int(input())
	s = input()
	res = {}
	for i in range(length - 1):
		match = s[i:i + 2]
		if s[i:i + 2] not in res:
			res[match] = 0
		res[match] += 1
	print(sorted(res.items(), key=lambda x: x[1], reverse=True)[0][0])
main()


n = int(input())
s = str(input())
dic = {}
for i in range(n - 1):
	letra1 = s[i]
	letra2 = s[i + 1]
	twoGram = letra1 + letra2
	if twoGram not in dic:
		dic[twoGram] = 1
	else:
		dic[twoGram] += 1
maxcount = 0
for e in dic:
	count = dic[e]
	maxcount = max(count, maxcount)
for e in dic:
	if dic[e] == maxcount:
		print(e)
		break


from collections import Counter
n = int(input())
s = input()
arr = []
for i in range(1, len(s)):
	arr.append(str(s[i - 1] + s[i]))
c = Counter(arr)
a = c.most_common()[0]
print(a[0])


n = int(input())
s = input()
l = []
if len(s) == 2:
	print(s)
	exit(0)
for i in range(n - 2 + 1):
	x = s[i:i + 2]
	l.append(x)
ans = []
for i in l:
	ans.append(l.count(i))
print(l[ans.index(max(ans))])


q = int(input())
stroke = input()
d1 = {}
for i in range(q - 1):
	u = i + 2
	key = stroke[i:u]
	if not key in d1:
		d1[key] = 0
	d1[key] += 1
max_value = max(d1.values())
print([key for (key, value) in d1.items() if value == max_value][0])


n = int(input())
s = input().strip()
mapa = {}
for i in range(len(s) - 1):
	dwugrama = s[i] + s[i + 1]
	if dwugrama not in mapa:
		mapa[dwugrama] = 1
	else:
		mapa[dwugrama] += 1
m = max(mapa.values())
for i in mapa:
	if mapa[i] == m:
		print(i)
		break


from collections import defaultdict
n = int(input())
s = input()
ap = defaultdict(lambda : 0)
for i in range(len(s) - 1):
	ap[s[i:i + 2]] = ap[s[i:i + 2]] + 1
MAX = 0
ss = ''
for i in ap:
	if MAX < ap[i]:
		MAX = ap[i]
		ss = i
print(ss)


def sub(s):
	l = len(s)
	return [s[i:j + 1] for i in range(l) for j in range(i, l) if len(s[i:j + 1]) == 2]
from itertools import combinations
n = int(input())
s = input()
subst = sub(s)
x = max([(subst.count(i), i) for i in subst])
print(x[1])


n = int(input())
s = input()
lst = dict()
for i in range(n - 1):
	if s[i:i + 2] in lst:
		lst[s[i:i + 2]] = lst[s[i:i + 2]] + 1
	else:
		lst[s[i:i + 2]] = 1
b = ''
a = 0
for (u, v) in lst.items():
	if v > a:
		b = u
		a = v
print(b)


import sys

def main():
	n = int(input())
	s = input()
	ss = []
	for i in range(n - 1):
		ss.append(s[i:i + 2])
	t = {}
	for i in ss:
		t[i] = 0
	for i in ss:
		t[i] += 1
	m = None
	mi = 0
	for i in t:
		if t[i] > mi:
			m = i
			mi = t[i]
	print(m)
	pass
main()


n = int(input())
s = str(input())
ls = []
index = []
mx = 0
for i in range(len(s) - 1):
	ls.append(s[i] + s[i + 1])
	index.append(0)
for i in range(len(ls)):
	j = i + 1
	for j in range(len(ls)):
		if ls[i] == ls[j]:
			index[i] = index[i] + 1
			if index[i] > mx:
				mx = index[i]
print(ls[index.index(mx)])


n = int(input())
l = input()
from collections import Counter
counter = []
for i in range(len(l) - 1):
	counter.append(l[i] + l[i + 1])
print(Counter(counter).most_common()[0][0])


from collections import Counter
n = int(input())
s = input()
substrings = [s[i:i + 2] for i in range(n - 1)]
answer = [w for (w, count) in Counter(substrings).most_common(1)]
print(answer[0])


n = int(input())
sen = input()
dic = {}
for i in range(0, n - 1):
	if sen[i:i + 2] in dic:
		dic[sen[i:i + 2]] += 1
	else:
		dic[sen[i:i + 2]] = 1
print(list(dic.keys())[list(dic.values()).index(max(dic.values()))])


lgt = int(input())
inp_str = input()
if len(inp_str) == lgt:
	sub_list = []
	count_list = []
	for y in range(lgt - 1):
		if inp_str[y:y + 2] in sub_list:
			count_list[sub_list.index(inp_str[y:y + 2])] += 1
		else:
			sub_list.append(inp_str[y:y + 2])
			count_list.append(1)
print(sub_list[count_list.index(max(count_list))])


n = int(input())
s = input()
const = ord('A')
(r, c) = [26, 26]
tg = [[0 for x in range(r)] for y in range(c)]
(maxv, mx, my) = (0, 0, 0)
for i in range(n - 1):
	x = ord(s[i]) - const
	y = ord(s[i + 1]) - const
	tg[x][y] = tg[x][y] + 1
	if tg[x][y] > maxv:
		maxv = tg[x][y]
		mx = x
		my = y
print(chr(mx + const) + chr(my + const))


n = int(input())
s = input()
(ans, large) = ('', 0)
for i in range(n - 1):
	k = s[i:i + 2]
	j = 0
	cnt = 0
	while j < n - 1:
		if s[j:j + 2] == k:
			cnt += 1
		j += 1
	if cnt > large:
		large = cnt
		ans = k
print(ans)


from sys import stdin, stdout
double = ''
n = int(stdin.readline().rstrip())
s = stdin.readline().rstrip()
all_doubles = {}
for i in range(n - 1):
	if not s[i] + s[i + 1] in all_doubles:
		all_doubles[s[i] + s[i + 1]] = 1
	else:
		all_doubles[s[i] + s[i + 1]] += 1
max = 0
for (k, v) in all_doubles.items():
	if v > max:
		max = v
		double = k
stdout.write(double)


try:
	N = int(input())
	s = input()
	l = []
	l1 = dict()
	for i in range(len(s) - 1):
		l.append(s[i:i + 2])
	s = set(l)
	for i in s:
		l1[i] = l.count(i)
	ans = max(l1, key=l1.get)
	print(ans)
except EOFError:
	pass


input()
d = {}
q = input().strip()
for x in range(len(q) - 1):
	k = q[x:x + 2]
	d[k] = d[k] + 1 if k in d else 1
m = 0
w = 0
for x in d:
	if d[x] > m:
		m = d[x]
		w = x
print(w)


n = int(input())
a = input()
c = {}
for i in range(0, n - 1):
	temp = a[i] + a[i + 1]
	if not temp in c:
		x = 1
		c.update({temp: x})
	else:
		c[temp] = c[temp] + 1
l = sorted(c.values())
ma = l.pop()
for x in c:
	if c[x] == ma:
		print(x)
		break


number = int(input())
text = input()
max = 0
gram = ''
for z in range(0, number):
	count = 0
	for x in range(z, number - 2):
		gram1 = text[z] + text[z + 1]
		gram2 = text[x + 1] + text[x + 2]
		if gram1 == gram2:
			count = count + 1
	if count > max:
		gram = text[z] + text[z + 1]
		max = count
if max > 0:
	print(gram)
else:
	print(text[0] + text[1])


from collections import defaultdict

def find_substring_max_occurances_fixed_length(s, k):
	hmap = defaultdict(int)
	for length in range(2, 3):
		for i in range(0, n - length + 1):
			string = s[i:i + length]
			hmap[string] += 1
	mx = max(hmap.values())
	for (k, v) in hmap.items():
		if v == mx:
			return k
n = int(input())
s = input()
result = find_substring_max_occurances_fixed_length(s, 2)
print(result)


from collections import defaultdict
_ = input()
s = input()
d = defaultdict(lambda : 0)
for i in range(len(s) - 1):
	d[s[i:i + 2]] += 1
print(max(d.items(), key=lambda x: x[1])[0])


from collections import Counter
n = int(input())
s = input()
l = []
k = ''
for i in range(n - 1):
	k = s[i] + s[i + 1]
	l.append(k)
count = Counter(l)
p = max(count.values())
for x in count.keys():
	if count[x] == p:
		break
print(x)


n = int(input())
s = str(input())
ds = list()
cs = list()
for i in range(n - 1):
	t = s[i:i + 2]
	if t in ds:
		cs[ds.index(t)] += 1
	else:
		ds.append(t)
		cs.append(1)
o = [x for (_, x) in sorted(zip(cs, ds))]
print(o[-1])


n = int(input())
s = input()
pairs = []
for i in range(0, len(s) - 1):
	pairs.append('{}{}'.format(s[i], s[i + 1]))
nums = {}
for pair in pairs:
	nums[pair] = 0
for pair in pairs:
	nums[pair] += 1
ex = sorted(nums.values())[-1]
for item in nums.keys():
	if nums[item] == ex:
		print(item)
		break


n = int(input())
s = input()
cur_max = 0
map_ = dict()
res = ''
for i in range(len(s) - 1):
	gram = s[i] + s[i + 1]
	if map_.get(gram):
		map_[gram] += 1
	else:
		map_[gram] = 1
	if map_[gram] > cur_max:
		cur_max = map_[gram]
		res = gram
print(res)


n = int(input())
s = input()
d = {}
for i in range(1, n):
	delta = s[i - 1] + s[i]
	if delta in d.keys():
		d[delta] += 1
	else:
		d[delta] = 1
max = 0
res = ''
for i in d.keys():
	if d[i] > max:
		max = d[i]
		res = i
print(res)


a = int(input())
s = str(input())
count = {}
for i in range(a - 1):
	if s[i] + s[i + 1] in count:
		count[s[i] + s[i + 1]] += 1
	else:
		count[s[i] + s[i + 1]] = 1
c1 = -1
for value in count:
	if c1 < count[value]:
		c1 = count[value]
print(list(count.keys())[list(count.values()).index(c1)])


a = int(input())
b = input()
c = []
d = []
for i in range(a - 1):
	c.append(b[i] + b[i + 1])
for i in c:
	d.append(c.count(i))
print(c[d.index(max(d))])


n = int(input())
s = input()
maxT = 0
ans = ''
for i in range(26):
	c1 = chr(ord('A') + i)
	for j in range(26):
		c2 = chr(ord('A') + j)
		sub = str(c1) + str(c2)
		t = 0
		for k in range(n - 1):
			if sub == s[k:k + 2]:
				t += 1
		if t > maxT:
			maxT = t
			ans = sub
print(ans)


k = int(input())
n = input()
list = []
for i in range(0, k - 1):
	list = list + [n[i:i + 2]]
dic = {}
list2 = []
for i in list:
	if i not in list2:
		list2 += [i]
		dic[i] = 1
	else:
		dic[i] = dic[i] + 1
max = list2[0]
for i in list2:
	if dic[max] < dic[i]:
		max = i
print(max)


from collections import defaultdict
import operator

def solve(n, s):
	d = defaultdict(int)
	for i in range(0, n - 1):
		if s[i].isupper() and s[i + 1].isupper():
			d[s[i:i + 2]] += 1
	return max(d.items(), key=lambda x: x[1])[0]

def main():
	n = int(input())
	s = input()
	print(solve(n, s))
main()


from collections import Counter

def read_nums():
	return [int(x) for x in input().split()]

def main():
	input()
	s = input()
	c = Counter()
	for i in range(len(s) - 1):
		c[s[i:i + 2]] += 1
	max_val = max(c.values())
	for k in c:
		if c[k] == max_val:
			print(k)
			return
main()


from collections import Counter
n = int(input())
_str = input()
lst = []
for i in range(0, n - 1):
	lst.append(_str[i] + _str[i + 1])
flag = Counter()
for i in lst:
	flag[i] += 1
print(sorted(list(flag.items()), key=lambda _: _[1], reverse=True)[0][0])


import collections
a = int(input())
b = input()
d = collections.defaultdict(int)
for x in range(0, a - 1):
	d[b[x] + b[x + 1]] += 1
print(sorted(d, key=lambda x: d[x])[-1])


import sys

def f(n, array):
	d2gram = {}
	for (i, c) in enumerate(array):
		if i <= 0:
			continue
		ngram = array[i - 1] + c
		if ngram in d2gram:
			d2gram[ngram] += 1
		else:
			d2gram[ngram] = 1
	return max(d2gram, key=d2gram.get)
for line in sys.stdin:
	n = int(line)
	array = sys.stdin.readline()
	ans = f(n, array)
	print(ans)


input()
s = input()
substring_dict = {}
length = len(s) if len(s) % 2 == 0 else len(s) - 1
for i in range(length):
	if s[i:i + 2] not in substring_dict:
		substring_dict[s[i:i + 2]] = 1
	else:
		substring_dict[s[i:i + 2]] += 1
max_path = max(substring_dict.values())
for i in substring_dict:
	if substring_dict[i] == max_path:
		print(i)
		break


n = int(input())
r = str(input())
v = []
m = []
for i in range(n - 1):
	v.append(r[i] + r[i + 1])
for j in v:
	d = v.count(j)
	m.append(d)
print(v[m.index(max(m))])


n = int(input())
s = str(input())
maxc = 0
maxarg = ''
c = {}
for i in range(1, len(s)):
	subs = s[i - 1:i + 1]
	count = c.get(subs, 0)
	c[subs] = count + 1
	if c[subs] > maxc:
		maxc = c[subs]
		maxarg = subs
print(maxarg)


from collections import defaultdict
d = defaultdict(lambda : 0)
l = int(input())
s = input()
max = 0
substring = ''
for i in range(l - 1):
	if d[s[i] + s[i + 1]]:
		d[s[i] + s[i + 1]] += 1
		if d[s[i] + s[i + 1]] > max:
			max = d[s[i] + s[i + 1]]
			substring = s[i] + s[i + 1]
	else:
		d[s[i] + s[i + 1]] = 1
		if d[s[i] + s[i + 1]] > max:
			max = d[s[i] + s[i + 1]]
			substring = s[i] + s[i + 1]
print(substring)


n = int(input())
string = input()
maxi = 0
max_e = ''
hashtable = {}
for i in range(n - 1):
	temp = string[i] + string[i + 1]
	if temp in hashtable:
		hashtable[temp] += 1
		if hashtable[temp] > maxi:
			maxi = hashtable[temp]
			max_e = temp
	else:
		hashtable[temp] = 1
		if hashtable[temp] > maxi:
			maxi = hashtable[temp]
			max_e = temp
print(max_e)


n = int(input())
s = input()
s = [s[i] + s[i + 1] for i in range(n - 1)]
c = 0
for i in range(n - 1):
	a = s.count(s[i])
	if a > c:
		c = a
		d = s[i]
print(d)


def countie(s1, s2):
	k = 0
	for i in range(0, len(s1) - 1):
		if s1[i:i + 2] == s2:
			k += 1
	return k
n = int(input())
s = input()
k = 0
r = ''
for i in range(0, n - 1):
	if countie(s, s[i:i + 2]) > k:
		k = countie(s, s[i:i + 2])
		r = s[i:i + 2]
print(r)


n = int(input())
a = input()
l = []
dic = {}
for i in range(n - 1):
	s = a[i:i + 2]
	if s in l:
		dic[s] += 1
	else:
		dic[s] = 1
		l.append(s)
maxi = 0
for i in range(len(l)):
	if dic[l[i]] > maxi:
		value = l[i]
		maxi = dic[l[i]]
print(value)


n = int(input())
take = input()
take2 = list(take)
(count, pair, a) = ([], [], [])
for x in range(1, n):
	pair.append(take2[x - 1] + take2[x])
pair2 = set(pair)
pair3 = list(pair2)
for x in range(len(pair3)):
	a.append(pair.count(pair3[x]))
max2 = a.index(max(a))
print(pair3[max2])


n = int(input())
sir = str(input())

def hashcode(s):
	return 31 * (ord(s[0]) - 65) + ord(s[1]) - 65

def decode(cod):
	return (chr(cod // 31 + 65), chr(cod % 31 + 65))
v = dict()
maxsub = 1
index = (sir[0], sir[1])
v[hashcode(index)] = 1
for i in range(1, len(sir) - 1):
	t = (sir[i], sir[i + 1])
	cod = hashcode(t)
	if cod not in v:
		v[cod] = 1
	else:
		v[cod] += 1
		if v[cod] > maxsub:
			maxsub = v[cod]
			index = decode(cod)
sol = ''.join(index)
print(sol)


def grams(s):
	ans = 0
	i = 0
	while i + 1 < len(s):
		cur = s[i] + s[i + 1]
		x = 0
		for j in range(1, len(s)):
			val = s[j - 1] + s[j]
			if val == cur:
				x += 1
		if x > ans:
			ans = x
			fin = cur
		i += 1
	return fin
n = int(input())
s = input()
print(grams(s))


from collections import Counter as C
n = int(input())
s = input()
temp = str()
count = 0
ll = []
for i in range(0, n - 1):
	temp += s[i]
	temp += s[i + 1]
	ll.append(temp)
	temp = str()
print(C(ll).most_common(1)[0][0])


l = int(input())
s = input().strip()
count = 0
res = []
x = []
y = []
a = []
for i in range(0, l - 1, 1):
	x.append(s[i])
	y.append(s[i + 1])
	for j in range(i, l - 1):
		if s[i] == s[j] and s[i + 1] == s[j + 1]:
			count += 1
	res.append(count)
	count = 0
m = max(res)
count = 0
for i in range(0, l - 1, 1):
	x.append(s[i])
	y.append(s[i + 1])
	for j in range(i, l - 1):
		if s[i] == s[j] and s[i + 1] == s[j + 1]:
			count += 1
	if count == m:
		a.append(s[i])
		a.append(s[i + 1])
		break
	count = 0
ans = ''.join(a)
print(ans)


n = int(input())
s = input()
record = {}
for i in range(n - 1):
	ss = s[i] + s[i + 1]
	if ss not in record.keys():
		record[ss] = 1
	else:
		record[ss] += 1
sorted_record = sorted(record.items(), key=lambda x: x[1], reverse=True)
print(sorted_record[0][0])


n = int(input())
s = input()
(tmp, m, ans) = (0, 0, '')
for i in range(0, n - 1):
	s1 = s[i:i + 2]
	m = 0
	for j in range(0, n - 1):
		s2 = s[j:j + 2]
		if s2 == s1:
			m += 1
	if m > tmp:
		tmp = m
		ans = s1
print(ans)


from collections import defaultdict
n = int(input())
s = input()
Max = 0
out = ''
dic = defaultdict(lambda : 0)
for i in range(len(s) - 1):
	dic[s[i] + s[i + 1]] += 1
	if dic[s[i] + s[i + 1]] > Max:
		Max = dic[s[i] + s[i + 1]]
		out = s[i] + s[i + 1]
print(out)


n = int(input())
s = input()
ma = 0
ans = ''
for f1 in range(n - 1):
	h1 = s[f1] + s[f1 + 1]
	h2 = 0
	for f2 in range(n - 1):
		if h1 == s[f2] + s[f2 + 1]:
			h2 += 1
	if h2 > ma:
		ma = h2
		ans = h1
print(ans)


n = int(input())
s = input()
st = {}
m = 0
ma = ''
for i in range(n - 1):
	a = s[i] + s[i + 1]
	if a in st:
		st[a] += 1
	else:
		st[a] = 1
	if st[a] > m:
		m = st[a]
		ma = a
print(ma)


import re
n = int(input())
s = input()
ted = {}
for i in range(1, n):
	if s[i - 1:i + 1] in ted:
		ted[s[i - 1:i + 1]] += 1
	else:
		ted[s[i - 1:i + 1]] = 1
mx = max(ted.values())
for (key, val) in ted.items():
	if val == mx:
		print(key)
		break


n = int(input())
sl = input()
ans = []
anss = []
for i in range(n):
	if i < n - 1:
		k = sl[i] + sl[i + 1]
		ans.append(k)
		anss.append(0)
for i in range(len(ans)):
	for j in range(n):
		if j < n - 1:
			if ans[i] == sl[j] + sl[j + 1]:
				anss[i] += 1
m = -1
gauge = -1
for i in range(len(ans)):
	if int(anss[i]) > m:
		m = int(anss[i])
		gauge = i
print(ans[gauge])


n = int(input())
s = input()
max = 0
z = ''
for i in range(n - 1):
	x = s[i] + s[i + 1]
	c = 0
	for j in range(i + 1, n - 1):
		y = s[j] + s[j + 1]
		if y == x:
			c += 1
	if c > max:
		max = c
		z = x
if max == 0:
	print(s[0] + s[1])
else:
	print(z)


from collections import Counter
n = int(input())
line = input()
dvug = []
for i in range(len(line) - 1):
	dvug.append(line[i:i + 2])
ans = Counter(dvug)
print(ans.most_common(1)[0][0])


n = int(input())
word = input()
total_max = 0
for i in range(len(word) - 1):
	total = 0
	for j in range(i, len(word) - 1):
		if word[i:i + 2] == word[j:j + 2]:
			total += 1
			if total > total_max:
				total_max = total
				word_max = word[i:i + 2]
print(word_max)


n = int(input())
s = input()
d = {}
for i in range(n - 1):
	key = s[i] + s[i + 1]
	if key in d.keys():
		d[key] += 1
	else:
		d[key] = 1
max = 0
key = ''
for (k, v) in d.items():
	if v > max:
		max = v
		key = k
print(key)


n = int(input())
s = list(input())
di = {}
for i in range(n - 1):
	t = ''
	t += s[i]
	t += s[i + 1]
	if t in di:
		di[t] += 1
	else:
		di[t] = 1
a = ''
ma = -1
for i in di:
	if di[i] > ma:
		ma = di[i]
		a = i
print(a)


n = int(input())
s = input()
bigram = dict()
for i in range(n - 1):
	cur_s = s[i:i + 2]
	if cur_s in bigram:
		bigram[cur_s] += 1
	else:
		bigram[cur_s] = 1
ans = (0, '')
for (key, value) in bigram.items():
	if value > ans[0]:
		ans = (value, key)
print(ans[1])


a = int(input())
str = list(input())
tg = ''
(sl, mx, ident) = (len(str), 0, 0)
for i in range(sl - 1):
	t = 0
	for j in range(sl - 1):
		if str[i:i + 2] == str[j:j + 2]:
			t = t + 1
	if t >= mx:
		mx = t
		ident = i
d = str[ident:ident + 2]
for i in d:
	print(i, end='')


n = int(input())
s = str(input())
substring = []
for i in range(1, n):
	sub = s[i - 1] + s[i]
	temp = 0
	for i in range(1, n):
		if s[i - 1] == sub[0] and s[i] == sub[1]:
			temp += 1
	substring.append(temp)
print(s[substring.index(max(substring))] + s[substring.index(max(substring)) + 1])


from collections import defaultdict
n = int(input())
word = input()
count = defaultdict(lambda : 0)
for i in range(n - 1):
	count[word[i:i + 2]] += 1
sorted_count = sorted(count.items(), key=lambda x: x[1])
print(sorted_count[~0][0])


n = int(input())
s = input()
D = {}
for i in range(n - 1):
	if s[i:i + 2] in D:
		D[s[i:i + 2]] += 1
	else:
		D[s[i:i + 2]] = 1
maxi = -1
ans = ''
for (key, val) in D.items():
	if val > maxi:
		ans = key
		maxi = val
print(ans)


import string

def twoGram(n, s):
	maxCount = 0
	result = ''
	for i in range(n - 1):
		aux = s[i:i + 2]
		count = 0
		for j in range(n):
			if s[j:j + 2] == aux:
				count += 1
		if count > maxCount:
			maxCount = count
			result = aux
	print(result)
n = int(input())
s = input()
twoGram(n, s)


n = int(input())
s = input()
m = {}
result = 0
k = ''
for i in range(1, n):
	key = s[i - 1] + s[i]
	if not key in m:
		m[key] = 0
	m[key] += 1
	if m[key] > result:
		result = m[key]
		k = key
print(k)


n = int(input())
line = input()
array = list(line)
maior = 0
indice_maior = 0
for i in range(n - 1):
	count = 0
	for j in range(n - 1):
		if array[j] == array[i] and array[j + 1] == array[i + 1]:
			count += 1
	if count > maior:
		maior = count
		indice_maior = i
print(array[indice_maior] + array[indice_maior + 1])


import statistics
n = int(input())
s = input()
l = []
res = [s[i:j] for i in range(len(s)) for j in range(i + 1, len(s) + 1)]
for i in range(len(res)):
	if len(res[i]) == 2:
		l.append(res[i])
print(statistics.mode(l))


n = int(input())
s = input()
let = {}
for i in range(len(s) - 1):
	if s[i] + s[i + 1] in let:
		let[s[i] + s[i + 1]] += 1
	else:
		let[s[i] + s[i + 1]] = 1
max_el = -100000
ans = ''
for i in range(len(s) - 1):
	a = s[i] + s[i + 1]
	if let[a] > max_el:
		max_el = let[a]
		ans = a
print(ans)


import collections

def main():
	(n, s) = (int(input()), input())
	two_grams = [s[i] + s[i + 1] for i in range(len(s) - 1)]
	print(collections.Counter(two_grams).most_common()[0][0])
main()


n = int(input())
s = input()
twog = {}
for i in range(n - 1):
	st = s[i:i + 2]
	if st in twog:
		twog[st] += 1
	else:
		twog[st] = 1
maxkey = 0
maxval = 0
for (key, value) in twog.items():
	if value > maxval:
		maxval = value
		maxkey = key
print(maxkey)


p = int(input())
n = input()
liste = []
l2 = []
for i in range(p - 1):
	liste.append(n[i] + n[i + 1])
for j in range(len(liste)):
	a = 1
	b = liste[j]
	for i in range(len(liste)):
		if b == liste[i]:
			a = a + 1
	l2.append(a)
o = max(l2)
l = l2.index(o)
m = liste[l]
print(m)


from bisect import bisect
from collections import defaultdict
from math import gcd, sqrt, ceil, inf
from collections import Counter
import sys
sys.setrecursionlimit(10 ** 9)
hash = defaultdict(int)
n = int(input())
s = input()
ans = 0
for i in range(n - 1):
	s1 = s[i] + s[i + 1]
	hash[s1] += 1
	ans = max(ans, hash[s1])
for i in hash:
	if hash[i] == ans:
		print(i)
		exit()


n = int(input())
a = input()
b = ['']
j = 0
for i in range(1, n):
	x = a[j] + a[i]
	j += 1
	b.append(x)
mx = 0
for i in b:
	y = b.count(i)
	if y > mx:
		mx = y
		x = i
if x == '':
	x = b[1]
print(x)


n = int(input())
rec = input()
gramovi = {}
for i in range(n - 1):
	gram = rec[i] + rec[i + 1]
	if gram in gramovi.keys():
		gramovi[gram] += 1
	else:
		gramovi[gram] = 1
nv = 0
maxg = ''
for gram in gramovi.keys():
	if gramovi[gram] > nv:
		maxg = gram
		nv = gramovi[gram]
print(maxg)


n = int(input())
s = input()
resp = {}
m = 0
r = ''
for i in range(n - 1):
	resp[s[i:i + 2]] = 0
for i in range(n - 1):
	resp[s[i:i + 2]] += 1
for (key, value) in resp.items():
	if value > m:
		m = value
		r = key
print(r)


import sys
import math
get_string = lambda : sys.stdin.readline().strip()
get_int_list = lambda : list(map(int, sys.stdin.readline().strip().split()))
get_intList_from_str = lambda : list(map(int, list(sys.stdin.readline().strip())))
get_charList_from_str = lambda : list(sys.stdin.readline().strip())
get_char_list = lambda : sys.stdin.readline().strip().split()
get_int = lambda : int(sys.stdin.readline())
pt = lambda x: sys.stdout.write(str(x))
n = get_int()
s = get_string()
d = {}
for i in range(n - 1):
	temp = s[i:i + 2]
	if temp in d:
		d[temp] += 1
	else:
		d[temp] = 1
arr = sorted(d.items(), key=lambda x: x[1], reverse=True)
print(arr[0][0])


n = int(input())
string = input()
colves = []
pairs = []
for i in range(1, n):
	pair = string[i - 1:i + 1]
	if pair in pairs:
		colves[pairs.index(pair)] += 1
	else:
		pairs.append(pair)
		colves.append(1)
print(pairs[colves.index(max(colves))])


n = int(input())
c = input()
d = []
for i in range(len(c) - 1):
	x = ''
	x += c[i] + c[i + 1]
	d.append(x)
from collections import Counter
dix = Counter(d)
l = list(dix.keys())
l.sort(key=lambda l: dix[l], reverse=True)
print(l[0])


from collections import defaultdict
n = int(input())
s = input()
d = defaultdict(int)
for k in range(0, n - 1):
	d[s[k:k + 2]] += 1
m = -1
seqmax = ''
for k in d:
	if d[k] > m:
		seqmax = k
		m = d[k]
print(seqmax)


import operator
d = int(input())
s = input()
h = {}
for i in range(len(s) - 1):
	if not s[i:i + 2] in h:
		h[s[i:i + 2]] = 1
	else:
		h[s[i:i + 2]] += 1
h = sorted(h.items(), key=operator.itemgetter(1))
print(h[-1][0])


n = int(input())
s = input()
s1 = ''
m = 0
for i in range(n - 1):
	o = s[i:i + 2]
	t = 0
	for j in range(n - 1):
		if o == s[j:j + 2]:
			t += 1
	if t > m:
		m = t
		s1 = o
print(s1)


n = int(input())
given = input()
twograms = dict()
for i in range(len(given) - 1):
	twogram = given[i] + given[i + 1]
	if twogram in twograms:
		twograms[twogram] += 1
	else:
		twograms[twogram] = 1
print(max(twograms, key=lambda x: twograms[x]))


input()
s = input().strip()
grams = {}
for i in range(len(s) - 1):
	g = s[i:i + 2]
	if g in grams:
		grams[g] += 1
	else:
		grams[g] = 1
grams = sorted(grams.items(), key=lambda x: x[1], reverse=True)
print(grams[0][0])


t = int(input())
s = list(input())
l = []
c = []
for i in range(len(s) - 1):
	a = [s[i], s[i + 1]]
	l.append(a)
q = [list(item) for item in set((tuple(row) for row in l))]
for i in q:
	b = l.count(i)
	c.append(b)
f = c.index(max(c))
print(''.join((str(x) for x in q[f])))


from collections import defaultdict

def solve(n, s):
	d = defaultdict(int)
	for i in range(0, n - 1):
		if s[i].isupper() and s[i + 1].isupper():
			d[s[i:i + 2]] += 1
	maxi = -1
	r = ''
	for i in d:
		if d[i] > maxi:
			maxi = d[i]
			r = i
	return r

def main():
	n = int(input())
	s = input()
	print(solve(n, s))
main()


n = int(input())
pop = list(input())
tan = dict()
kom = []
for x in range(len(pop) - 1):
	if ''.join(pop[x:x + 2]) in tan:
		tan[''.join(pop[x:x + 2])] += 1
	else:
		tan[''.join(pop[x:x + 2])] = 1
for item in tan:
	kom.append(tan[item])
for item in tan:
	if tan[item] == max(kom):
		print(item)
		break
	else:
		pass


def longest_two_gram(s):
	occurences = {}
	for i in range(len(s) - 1):
		two_gram = s[i:i + 2]
		occurences.setdefault(two_gram, 0)
		occurences[two_gram] += 1
	best_two_gram = ''
	best = 0
	for (k, v) in occurences.items():
		if v > best:
			best = v
			best_two_gram = k
	return best_two_gram

def main():
	n = int(input())
	s = input()
	print(longest_two_gram(s))
main()


n = int(input())
s = input().strip()
value = s[0:2]
max = 0
for i in range(n - 1):
	ss = s[i:i + 2]
	count = 0
	for j in range(n - 1):
		if s[j:j + 2] == ss:
			count += 1
	if count > max:
		max = count
		value = s[i:i + 2]
print(value)


i = input
i()
a = i()
b = [*zip(a, a[1:])]
print(''.join(max(b, key=b.count)))


import operator
data = input()
s = input()
freq = {}
for (i, _) in enumerate(s[:-1]):
	tmp = s[i] + s[i + 1]
	freq[tmp] = freq.setdefault(tmp, 0) + 1
result = sorted(freq.items(), key=operator.itemgetter(1), reverse=True)
print(result[0][0])


n = input()
s = input()
li = [s[i:i + 2] for i in range(len(s) - 1)]
dicto = {}
for el in li:
	if el in list(dicto.keys()):
		dicto[el] += 1
	else:
		dicto[el] = 1
keys = list(dicto.keys())
if len(keys) != 0:
	mx = keys[0]
	for el in list(dicto.keys()):
		if dicto[el] >= dicto[mx]:
			mx = el
	print(mx)
else:
	print('')


n = input()
s = input()
d = {}
for i in range(1, len(s)):
	two_gram = s[i - 1] + s[i]
	if two_gram in d:
		d[two_gram] = d[two_gram] + 1
	else:
		d[two_gram] = 1
max = 0
for k in d.keys():
	if d[k] > max:
		max = d[k]
		ans = k
print(ans)


len = int(input().strip())
str = input()
hashtable = dict()
i = 0
while i <= len - 2:
	try:
		hashtable[str[i:i + 2]] += 1
	except:
		hashtable.update({str[i:i + 2]: 1})
	i += 1
finaltable = sorted(hashtable.items(), key=lambda item: (item[1], item[0]), reverse=True)
print(finaltable[0][0])


def count1(s, p):
	ans = 0
	for i in range(len(s) - 1):
		s1 = s[i:i + 2]
		if s1 == p:
			ans += 1
	return ans
n = int(input())
s = input()
c = -1
for i in range(n - 1):
	s1 = s[i:i + 2]
	c1 = count1(s, s1)
	if c1 > c:
		c = c1
		ans = s1
print(ans)


n = int(input())
s = input()
ans = ''
max_cnt = 0
for i in range(n - 1):
	current = s[i:i + 2]
	cnt = 0
	for j in range(n - 1):
		if s[j:j + 2] == current:
			cnt += 1
	if cnt > max_cnt:
		max_cnt = cnt
		ans = current
print(ans)


n = int(input())
s = input()
gram = {}
for i in range(n - 1):
	g = s[i:i + 2]
	if g not in gram:
		gram[g] = 1
	else:
		gram[g] += 1
m = 0
for k in gram:
	if gram[k] > m:
		m = gram[k]
		key = k
print(key)


from collections import Counter
n = int(input())
s = input()
c = Counter(zip(s, s[1:]))
print(''.join(c.most_common()[0][0]))


d = {}
n = int(input())
s = input()
for i in range(n - 1):
	if s[i] + s[i + 1] not in d:
		d[s[i] + s[i + 1]] = 1
	else:
		d[s[i] + s[i + 1]] += 1
p = max(d.values())
for (i, j) in d.items():
	if j == p:
		print(i)
		break


l = int(input())
s = input()
two_grams = []
gram_list = []
for i in range(l - 1):
	two_gram = s[i:i + 2]
	if two_gram not in gram_list:
		gram_list.append(two_gram)
		two_grams.append([two_gram, 1])
	else:
		for j in range(len(two_grams)):
			if two_grams[j][0] == two_gram:
				two_grams[j][1] += 1
index = 0
m = 0
for i in range(len(two_grams)):
	if two_grams[i][1] > m:
		m = two_grams[i][1]
		index = i
print(two_grams[index][0])


def doit(dic, string):
	if len(string) < 2:
		return string
	temp = string[0:2]
	if temp in dic.keys():
		dic[temp] = dic[temp] + 1
	else:
		dic[temp] = 1
	return doit(dic, string[1:])
number = int(input())
string = input()
dic = {}
doit(dic, string)
maximum = 0
hey = ''
for i in dic.keys():
	if dic[i] > maximum:
		maximum = dic[i]
		hey = i
print(hey)


n = int(input())
s = input()
dic = {}
for i in range(n - 1):
	cur = s[i:i + 2]
	if dic.__contains__(cur):
		dic[cur] += 1
	else:
		dic[cur] = 1
count = 0
for key in dic:
	if count < dic[key]:
		count = dic[key]
		res = key
print(res)


n = int(input())
st = input()
di = {}
for i in range(n - 1):
	a = st[i] + st[i + 1]
	if a in di:
		di[a] += 1
	else:
		di[a] = 1
mx = max(di.values())
for i in di:
	if di[i] == mx:
		print(i)
		exit(0)


int(input())
s = input()
dic = {}
for i in range(len(s) - 1):
	ss = s[i:i + 2]
	dic[ss] = dic.get(ss, 0) + 1
mx = dic[ss[0:2]]
mxa = ss[0:2]
for i in dic:
	if dic[i] > mx:
		mx = dic[i]
		mxa = i
print(mxa)


n = int(input())
s = input()
(simple, double) = ([], [])
for i in range(len(s) - 1):
	sub = s[i:i + 2]
	if sub not in simple:
		simple.append(sub)
		double.append([sub, 1])
	else:
		double[simple.index(sub)][1] += 1
double.sort(key=lambda x: x[1])
print(double[len(double) - 1][0])


n = int(input())
s = input()
l = []
flag = True
for i in range(len(s) - 1):
	s1 = s[i] + s[i + 1]
	l.append(s1)
l3 = []
c1 = 0
for i in l:
	if l.count(i) > 1:
		if c1 < l.count(i):
			c1 = l.count(i)
			l3 = i
			flag = False
if flag == False:
	print(l3)
if flag:
	print(s[0:2])


n = int(input())
s = input()
maxi = -1
ans = ''
a = 0
for i in range(n - 1):
	for j in range(i, n - 2):
		if s[i] + s[i + 1] == s[j + 1] + s[j + 2]:
			a += 1
	if a > maxi:
		maxi = a
		ans = s[i] + s[i + 1]
	a = 0
print(ans)


lili = {}
n = int(input())
s = input()
for i in range(n - 1):
	tmp = s[i] + s[i + 1]
	if tmp in lili:
		lili[tmp] += 1
	else:
		lili[tmp] = 1
anst = s[0] + s[1]
ansn = lili.get(s[0] + s[1])
for i in lili:
	if lili.get(i) > ansn:
		ansn = lili.get(i)
		anst = i
print(anst)


length = input('')
string = input('')
length = int(length)
combo = []
for i in range(length - 1):
	if string[i:i + 2] not in combo:
		combo.append(string[i:i + 2])
		combo.append(1)
	else:
		combo[combo.index(string[i:i + 2]) + 1] += 1
maximum = 0
position = -1
for i in range(1, len(combo), 2):
	if combo[i] > maximum:
		position = i
		maximum = combo[i]
print(combo[position - 1])


from collections import defaultdict as dd
n = int(input())
s = input().strip()
d = dd(int)
m = 0
for i in range(n - 1):
	k = s[i:i + 2]
	d[k] += 1
	if d[k] > m:
		m = d[k]
		ans = k
print(ans)


n = int(input())
s = input()
from collections import Counter
c = Counter(zip(s, s[1:]))
c = max(c.items(), key=lambda x: x[1])[0]
print(''.join(c))


n = int(input())
s = input()
dic = {}
for i in range(n - 1):
	dic[s[i:i + 2]] = dic.get(s[i:i + 2], 0) + 1
print(max(dic, key=dic.get))


from collections import *
Dict = defaultdict(lambda : 0)
n = int(input())
Str = list(input())
for i in range(n - 1):
	tem_str = Str[i] + Str[i + 1]
	Dict[tem_str] += 1
Astr = ''
Avalue = 0
for (key, value) in Dict.items():
	if Avalue < value:
		Avalue = value
		Astr = key
print(Astr)


N = int(input())
L = list(input())
max = 0
for i in range(N - 1):
	count = 1
	for j in range(i + 1, N - 1):
		if L[j] == L[i] and L[j + 1] == L[i + 1]:
			count += 1
	if count >= max:
		max = count
		x = i
print(L[x] + L[x + 1])


l = int(input())
s = input()
dgrams = set()
for i in range(l - 1):
	dgrams.add(s[i:i + 2])
count = 0
gr = ''
for i in dgrams:
	c = 0
	for j in range(l - 1):
		if s[j:j + 2] == i:
			c += 1
	if c > count:
		count = c
		gr = i
print(gr)


n = int(input())
s = input()
d = {}
if n == 2:
	print(s)
	exit()
for x in range(len(s) - 1):
	sub = s[x:x + 2]
	if sub not in d:
		d[sub] = 1
	else:
		d[sub] += 1
v = list(d.values())
k = list(d.keys())
print(k[v.index(max(v))])


def solution():
	n = int(input())
	st = input()
	d = {}
	mxs = ''
	mxi = 0
	for i in range(1, len(st)):
		s = st[i - 1] + st[i]
		d[s] = d.get(s, 0) + 1
		if mxi < d[s]:
			mxi = d[s]
			mxs = s
	print(mxs)
solution()


import collections
d = collections.defaultdict(int)
n = int(input())
s = str(input())
k = 2
for i in range(n - k + 1):
	twogram = s[i:i + k]
	d[twogram] += 1
mx = max(d.values())
for i in d:
	if d[i] == mx:
		print(i)
		break


n = input()
s = input()
dic = dict()
for i in range(int(n) - 1):
	if s[i:i + 2] in dic:
		dic[s[i:i + 2]] += 1
	else:
		dic[s[i:i + 2]] = 0
max = 0
res = ''
for i in dic.keys():
	if dic[i] >= max:
		res = i
		max = dic[i]
print(res)


num = int(input())
word = input()
dic = {}
for i in range(len(word) - 1):
	if word[i] + word[i + 1] in dic:
		dic[word[i] + word[i + 1]] = dic[word[i] + word[i + 1]] + 1
	else:
		dic[word[i] + word[i + 1]] = 1
print(max(dic, key=dic.get))


x = int(input(''))
st = input('')
substrings = []
for i in range(0, x - 1):
	gram = st[i] + st[i + 1]
	for j in range(0, len(substrings)):
		if substrings[j]['gram'] == gram:
			substrings[j]['freq'] += 1
	else:
		substrings.append({'gram': gram, 'freq': 1})
mx = substrings[0]
for i in range(0, len(substrings)):
	if substrings[i]['freq'] > mx['freq']:
		mx = substrings[i]
print(mx['gram'])


n = int(input())
s = input()
row = []
a = []
for i in range(26):
	a.append([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
for i in range(n - 1):
	a[ord(s[i]) - ord('A')][ord(s[i + 1]) - ord('A')] += 1
ans1 = 0
ans2 = 0
for i in range(26):
	for j in range(26):
		if a[i][j] > a[ans1][ans2]:
			ans1 = i
			ans2 = j
print(chr(ord('A') + ans1) + chr(ord('A') + ans2))


x = int(input())
str = input()
i = 0
maxCount = 1
maxsubstr = str[0] + str[1]
while i < len(str) - 1:
	subStr = str[i] + str[i + 1]
	j = i + 1
	count = 1
	while j < len(str) - 1:
		if str[j] == subStr[0] and str[j + 1] == subStr[1]:
			count += 1
		j += 1
	if maxCount < count:
		maxsubstr = subStr
		maxCount = count
	i += 1
print(maxsubstr)


k = int(input())
n = input()[:k]
l = []
s = ''
c = 0
for x in range(0, len(n)):
	for y in range(0, len(n)):
		if x <= y:
			s += n[y]
			if len(s) == 2:
				l.append(s)
	s = ''
for x in l:
	if l.count(x) > c:
		p = x
		c = l.count(x)
print(p)


n = int(input())
s = input()
d = {}
for i in range(1, n):
	gm = s[i - 1] + s[i]
	if gm in d:
		d[gm] = d[gm] + 1
	else:
		d[gm] = 1
mx = -1
mxc = ''
for i in d:
	if d[i] > mx:
		mx = d[i]
		mxc = i
print(mxc)


def count_substring(string, sub_string):
	l = len(sub_string)
	count = 0
	for i in range(len(string) - len(sub_string) + 1):
		if string[i:i + len(sub_string)] == sub_string:
			count += 1
	return count
n = int(input())
s = input()
mx = -1
for i in range(0, len(s) - 1):
	temp = s[i:i + 2]
	ch = 0
	v = mx
	if True:
		mx = max(mx, count_substring(s, temp))
	if mx != v:
		v = mx
		op = temp
print(op)


n = int(input())
s = input()
tg = {}
m = [0, '']
for i in range(n - 1):
	_tg = s[i] + s[i + 1]
	if _tg not in tg:
		tg[_tg] = 1
	else:
		tg[_tg] += 1
	if tg[_tg] > m[0]:
		m[0] = tg[_tg]
		m[1] = _tg
print(m[1])


n = int(input())
s = input()
ma = -float('inf')
ans = ''
for i in range(n - 1):
	st = s[i:i + 2]
	c = 0
	for j in range(n - 1):
		if st == s[j:j + 2]:
			c += 1
	if c > ma:
		ma = c
		ans = str(st)
print(ans)


from collections import Counter

def most_frequent(List):
	occurence_count = Counter(List)
	return occurence_count.most_common(1)[0][0]
str_len = int(input())
str = input()
str_list = []
for i in range(str_len - 1):
	str_list.append(str[i] + str[i + 1])
print(most_frequent(str_list))


n = int(input())
m = input()
m = list(m)
l = []
for i in range(len(m) - 1):
	s = m[i:i + 2]
	y = 0
	for j in range(len(m)):
		p = m[j:j + 2]
		if s == p:
			y = y + 1
	l.append(y)
g = l.index(max(l))
print(m[g] + m[g + 1])


n = input()
a = input()
key_value = [['1', 0]]
key = False
for i in range(len(a) - 1):
	res = ''
	res += a[i] + a[i + 1]
	for j in range(len(key_value)):
		if res == key_value[j][0]:
			key = True
			break
	if key == True:
		key_value[j][1] += 1
		key = False
	else:
		key_value.append([res, 1])
max = 0
for t in range(len(key_value)):
	if max < key_value[t][1]:
		max = key_value[t][1]
		index = key_value.index(key_value[t])
print(key_value[index][0])


n = int(input())
s = input()
ls = []
di = {}
for i in range(n - 1):
	ls.append(s[i] + s[i + 1])
for i in range(n - 1):
	if ls[i] in di:
		di[ls[i]] += 1
	else:
		di[ls[i]] = 1
t = 0
s = 'a'
for J in di:
	if di[J] > t:
		t = di[J]
		s = J
print(s)


import time
length = int(input())
string = input()
length_of_gram = 2
dict_gram = {}

def find_max(dict_gram):
	max = 0
	max_key = ''
	for (key, value) in dict_gram.items():
		if value > max:
			max = value
			max_key = key
	return max_key

def print_dict(dict_gram):
	for (key, value) in dict_gram.items():
		print(key + ':' + str(value))
for i in range(length - length_of_gram + 1):
	curr_string = string[i:i + length_of_gram]
	if curr_string in dict_gram.keys():
		dict_gram[curr_string] = dict_gram[curr_string] + 1
	else:
		dict_gram[curr_string] = 1
key = find_max(dict_gram)
print(key)


n = int(input())
s = str(input())
all = []
for i in range(n - 1):
	all.append(s[i:i + 2])
ans = ' '
number = 0
for i in all:
	if number < all.count(i):
		ans = i
		number = all.count(i)
print(ans)


n = int(input())
s = input()
d = {}
ans = None
m = 0
for i in range(n - 1):
	ss = s[i:i + 2]
	if ss not in d:
		d[ss] = 0
	d[ss] += 1
	if d[ss] > m:
		m = d[ss]
		ans = ss
print(ans)


n = int(input())
s = input()
bestL = 0
best = ''
for i in range(n - 1):
	a = s[i:i + 2]
	cnt = 0
	for j in range(n - 1):
		b = s[j:j + 2]
		if b == a:
			cnt += 1
	if cnt > bestL:
		bestL = cnt
		best = a
print(best)


n = int(input())
text = input()
ar = {}
maxx = 0
for i in range(n - 1):
	if text[i] + text[i + 1] not in ar:
		ar[text[i:i + 2]] = 0
	ar[text[i:i + 2]] += 1
	maxx = max(maxx, ar[text[i:i + 2]])
for i in ar:
	if ar[i] == maxx:
		print(i)
		break


n = int(input())
s = input().upper()
res = 0
ans = ''
for i in range(n - 1):
	count = 0
	for j in range(n - 1):
		if s[j] == s[i] and s[j + 1] == s[i + 1]:
			count += 1
	if res < count:
		res = count
		ans = s[i] + s[i + 1]
print(ans)


from collections import defaultdict
input()
s = input()
d = defaultdict(int)
for t in zip(s, s[1:]):
	d[t] += 1
print(''.join(max(d, key=d.get)))


n = int(input())
s = input()
b = [[0 for j in range(27)] for i in range(27)]
for i in range(n - 1):
	b[ord(s[i]) - 64][ord(s[i + 1]) - 64] += 1
c = 0
ch = str()
for i in range(1, 27):
	if max(b[i]) > c:
		c = max(b[i])
		ch = chr(i + 64) + chr(b[i].index(max(b[i])) + 64)
print(ch)


d_grams = {}
n = int(input())
for i in range(26):
	for j in range(26):
		d_grams[chr(65 + i), chr(65 + j)] = 0
data = str(input())
prev = None
for el in data:
	if prev == None:
		prev = el
	else:
		d_grams[prev, el] += 1
		prev = el
ans = None
max_ = 0
for el in d_grams.keys():
	if max_ < d_grams[el]:
		max_ = d_grams[el]
		ans = el
print(ans[0] + ans[1])


n = int(input())
s = input()
ok = [s[i - 1:i + 1] for i in range(1, n)]
mp = {}
for strings in ok:
	if mp.get(strings) == None:
		mp[strings] = 1
	else:
		mp[strings] += 1
mx = 0
ans = ''
for (key, value) in mp.items():
	if mx < value:
		mx = value
		ans = key
print(ans)


n = int(input())
s = input()
res = 1
tmp = s[:2]
for i in range(n - 2):
	tmp1 = s[i:i + 2]
	re = 1
	for j in range(i + 1, n - 1):
		if s[j:j + 2] == tmp1:
			re += 1
	if re > res:
		res = re
		tmp = tmp1
print(tmp)


num = int(input())
s = input()
k = 1
dic = {}
lis = []
for i in range(num):
	temp = s[i:i + 2]
	for q in range(i + 1, num):
		if temp == s[q:q + 2]:
			k += 1
	dic[k] = temp
	lis.append(k)
	k = 0
print(dic[max(lis)])


len = int(input())
string = input()
dict = {}
for i in range(len - 1):
	twogram = string[i:i + 2]
	if twogram in dict:
		dict[twogram] += 1
	else:
		dict[twogram] = 1
print(max(dict, key=dict.get))


(m, n) = (int(input()), input())
l = []
for i in range(m - 1):
	l.append(n[i:i + 2])
b = max(l, key=l.count)
print(b)


from math import ceil, sqrt, log, gcd

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().split())

def li():
	return list(mi())
n = ii()
s = si()
a = []
for i in range(n - 1):
	a.append(s[i:i + 2])
m = {}
for i in a:
	if i not in m:
		m[i] = 1
	else:
		m[i] += 1
maxi = 0
for i in m.keys():
	if m[i] > maxi:
		ans = i
		maxi = m[i]
print(ans)


n = int(input())
s = input()
counter = 0
m = 0
for i in range(0, n - 1):
	for j in range(i, n - 1):
		if s[i:i + 2] == s[j:j + 2]:
			counter += 1
	if m < counter:
		m = counter
		tmp = s[i:i + 2]
	counter = 0
print(tmp)


n = int(input())
s = input()
a = [0] * (26 * 26)
k = 0
for i in range(26):
	for j in range(26):
		a[k] = chr(ord('A') + i) + chr(ord('A') + j)
		k += 1
c = [0] * (26 * 26)
for i in range(len(s) - 1):
	for j in range(26 * 26):
		if s[i:i + 2] == a[j]:
			c[j] += 1
ind = c.index(max(c))
print(a[ind])


n = int(input())
s = str(input())
all = []
dif = []
difk = []
m = 0
for i in range(n - 1):
	all.append(s[i] + s[i + 1])
for i in range(len(all)):
	if dif.count(all[i]) == 0:
		dif.append(all[i])
for i in range(len(dif)):
	difk.append(all.count(dif[i]))
m = difk.index(max(difk))
print(dif[m])


from statistics import mode

def most_common(name):
	return mode(name)
n = int(input(''))
word = input('')
word1 = []
for i in range(len(word) - 1):
	word1.append(word[i:i + 2])
a = most_common(word1)
print(a)


from collections import Counter
from itertools import combinations
import sys
num = input()
string = input()
if len(string) == 2:
	print(string)
	sys.exit(0)
ans = dict()
for i in range(len(string) - 1):
	if string[i:i + 2] not in ans.keys():
		ans[string[i:i + 2]] = 1
	else:
		ans[string[i:i + 2]] += 1
print(max(ans, key=ans.get))


from collections import defaultdict
x = int(input())
d = defaultdict(int)
a = input()
s = 0
l = ''
for i in range(1, x):
	k = a[i - 1] + a[i]
	d[k] += 1
	if d[k] > s:
		s = d[k]
		l = k
print(l)


n = int(input())
s = input()
d = {}
for i in range(0, len(s) - 1):
	str = s[i:i + 2]
	d[str] = 0
for i in range(0, len(s) - 1):
	str = s[i:i + 2]
	d[str] = d[str] + 1
max = 0
for (i, j) in d.items():
	if j > max:
		max = j
		str = i
print(str)


n = int(input())
str = input()
l = []
for i in range(n - 1):
	l.append(str[i] + str[i + 1])
d = dict()
for i in range(len(l)):
	d[l[i]] = 0
for i in range(len(l)):
	d[l[i]] = d[l[i]] + 1
for i in range(len(l)):
	if d[l[i]] == max(d.values()):
		print(l[i])
		break


k = int(input())
a = input()
b = {}
for i in range(k - 1):
	if a[i:i + 2] in b:
		b[a[i:i + 2]] += 1
	else:
		b[a[i:i + 2]] = 1
c = 0
d = 0
for (i, j) in b.items():
	if c < j:
		c = j
		d = i
print(d)


n = int(input())
s = input()
mx = None
for i in range(n - 1):
	sub = s[i:i + 2]
	count = 0
	for j in range(n - 1):
		if s[j:j + 2] == sub:
			count = count + 1
		if mx == None or count > mx:
			mx = count
			ans = sub
print(ans)


kolvo = int(input())
word = input().strip()
d = {}
for i in range(kolvo - 1):
	bigramm = word[i] + word[i + 1]
	if bigramm not in d:
		d[bigramm] = 1
	else:
		d[bigramm] += 1
max_value = max(d.values())
for (k, v) in d.items():
	if v == max_value:
		print(k)
		break


o = int(input())
s = list(input())
f = []
for i in range(len(s) - 1):
	f.append(s[i])
	f.append(s[i + 1])
	''.join(f)
k = []
for i in range(0, len(f) - 1, 2):
	k.append(f[i] + f[i + 1])
max = k.count(k[0])
new = k[0]
for i in range(1, len(k)):
	if k.count(k[i]) >= max:
		max = k.count(k[i])
		new = k[i]
print(new)


n = int(input())
s = input()
cnt = {}
mx = 0
mxd = ''
for i in range(n - 1):
	d = s[i] + s[i + 1]
	if d not in cnt:
		cnt[d] = 1
	else:
		cnt[d] += 1
	if mx < cnt[d]:
		mx = cnt[d]
		mxd = d
print(mxd)


from itertools import groupby
n = int(input())
s = list(input())
B = []
for i in range(n - 1):
	B.append(s[i:i + 2])
B.sort()
C = [len(list(group)) for (key, group) in groupby(B)]
j = C.index(max(C))
print(''.join(B[sum(C[:j])]))


from sys import stdin, stdout

def rint():
	return map(int, stdin.readline().split())
n = int(input())
s = input()
gram = dict()
for i in range(n - 1):
	if s[i:i + 2] in gram:
		gram[s[i:i + 2]] += 1
	else:
		gram[s[i:i + 2]] = 1
print(max(gram, key=lambda x: gram[x]))


import math, collections, sys
input = sys.stdin.readline
d = collections.defaultdict(int)
n = int(input())
s = input()
for i in range(n - 1):
	d[s[i] + s[i + 1]] += 1
z = []
for i in d.items():
	z.append([i[1], i[0]])
z.sort()
print(z[-1][1])


n = int(input())
s = input()
d = {}
for i in range(1, n):
	x = '{}{}'.format(s[i - 1], s[i])
	if x in d:
		d[x] += 1
	else:
		d[x] = 1
(m, res) = (-1, '')
for key in d:
	if d[key] > m:
		m = d[key]
		res = key
print(res)


def main():
	n = int(input())
	s = input()
	list = []
	findIndex = []
	lenList = 0
	for i in range(1, n):
		tg = s[i - 1] + s[i]
		(lenList, list, findIndex) = findElement(list, findIndex, tg, lenList)
	print(list[findIndex.index(max(findIndex))])

def findElement(list, findIndex, tg, lenList):
	if tg in list:
		findIndex[list.index(tg)] += 1
		return (lenList, list, findIndex)
	findIndex.append(1)
	list.append(tg)
	lenList += 1
	return (lenList, list, findIndex)
main()


n = int(input())
word = input()

def dicf(k, dic):
	for i in dic:
		if k == i:
			return True
	return False
dic = {}
for i in range(len(word) - 1):
	temp = word[i:i + 2]
	if dicf(temp, dic):
		dic[temp] += 1
	else:
		dic[temp] = 1
max = 0
for j in dic.values():
	if j > max:
		max = j
for i in dic:
	if dic[i] == max:
		output = i
		break
print(output)


n = int(input())
a = str(input())
ans = a[0:2]
max = 1
l = []
for i in range(n - 1):
	l.append(a[i:i + 2])
for i in range(len(l)):
	m = l.count(l[i])
	if m > max:
		max = m
		ans = l[i]
print(ans)


n = int(input())
s = input()
dic = dict()
for i in range(n - 1):
	ss = s[i] + s[i + 1]
	if ss not in dic:
		dic[ss] = 1
	else:
		dic[ss] += 1
m = 0
ans = ''
for i in dic:
	if dic[i] > m:
		m = dic[i]
		ans = i
print(ans)


substr = {}
n = int(input())
S = input()
i = 0
j = 2
while i < n:
	if S[i:j] in substr:
		substr[S[i:j]] += 1
	else:
		substr[S[i:j]] = 1
	i += 1
	j += 1
m = 0
for (k, v) in substr.items():
	if v > m:
		m = v
		s = k
print(s)


d = {}
l = int(input())
s = input()
for i in range(l - 1):
	sp = s[i:i + 2]
	if sp in d:
		d[sp] += 1
	else:
		d[sp] = 1
mx = 0
rs = ''
for j in d:
	if d[j] >= mx:
		mx = d[j]
		rs = j
print(rs)


n = int(input())
s = input()
d = dict()
for i in range(n - 1):
	x = s[i:i + 2]
	y = x
	if y in d:
		d[y] += 1
	else:
		d[y] = 1
(M, a) = (0, 0)
for z in d:
	if d[z] > M:
		(M, a) = (d[z], z)
print(a)


import sys
from collections import Counter

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7
N = INT()
S = input()
C = Counter()
for i in range(N - 1):
	p = S[i:i + 2]
	C[p] += 1
C = C.most_common()
ans = C[0][0]
print(ans)


n = int(input())
s = str(input())
k = dict()
z = s[:2]
m = 0
maxx = ''
for i in range(n - 1):
	z = s[i:i + 2]
	if z not in k:
		k[z] = 1
	else:
		k[z] = k[z] + 1
	if m < k[z]:
		m = k[z]
		maxx = z
print(maxx)


def main():
	n = int(input())
	word = input()
	wordSearch = word
	found = True
	dic = {}
	higherNum = 0
	higherKey = ''
	for i in range(n - 1):
		pair = word[i:i + 2]
		if pair not in dic:
			dic[pair] = 0
		else:
			continue
		index = 0
		wordSearch = word
		found = True
		while found:
			index = wordSearch.find(pair)
			if index != -1:
				dic[pair] = dic[pair] + 1
				if dic[pair] > higherNum:
					higherNum = dic[pair]
					higherKey = pair
				wordSearch = wordSearch[index + 1:len(wordSearch)]
			else:
				found = False
	print(higherKey)
main()


d = {}
n = int(input())
s = input()
for i in range(n - 1):
	a = s[i] + s[i + 1]
	if a in d:
		d[a] = d[a] + 1
	else:
		d[a] = 1
r = sorted(d.items(), key=lambda x: x[1], reverse=True)
f = list(r)
print(f[0][0])


class MAP(dict):

	def __missing__(self, key):
		self.key = 0
		return 0
n = int(input())
s = input()
_mp = MAP()
s += ' '
for i in range(n):
	_mp[s[i:i + 2]] += 1
res = [0, 0]
for i in _mp.keys():
	if res[-1] < _mp[i]:
		res[0] = i
		res[-1] = _mp[i]
print(res[0])


from collections import defaultdict
n = int(input())
s = input()
d = defaultdict(int)
for i in range(n - 1):
	d[s[i] + s[i + 1]] += 1
max_val = 0
max_str = ''
for k in d:
	if d[k] > max_val:
		max_val = d[k]
		max_str = k
print(max_str)


import collections
import itertools
import sys
from collections import defaultdict, Counter
from math import sqrt, ceil
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def ds(d):
	for i in range(2, d + 1):
		if d % i == 0:
			return i

def main():
	d = inp()
	v = input()
	res = defaultdict(lambda : 0)
	cc = ''
	for c in v:
		cc += c
		if len(cc) == 2:
			res[cc] += 1
			cc = cc[1]
	print(sorted(res.items(), key=lambda b: b[1], reverse=True)[0][0])
main()


n = int(input())
str1 = input()
ans = []
for i in range(n - 1):
	s = str1[i] + str1[i + 1]
	ans.append(s)
x = 0
for i in ans:
	if ans.count(i) > x:
		x = ans.count(i)
for i in ans:
	if ans.count(i) == x:
		print(i)
		break


def pair(s):
	count = 0
	wordCount = []
	WORD = ''
	word = []
	for i in range(len(s) - 1):
		WORD = s[i:i + 2]
		for j in range(len(s) - 1):
			if s[i:i + 2] == s[j:j + 2]:
				count += 1
		word.append(WORD)
		wordCount.append(count)
		count = 0
	m = max(wordCount)
	ind = wordCount.index(m)
	return word[ind]
n = input().strip()
st = input().strip()
print(pair(st))


n = int(input())
s = str(input())
o = ''
l = []
v = str(0)
c = str(0)
u = 0
for i in range(0, n - 1):
	o = s[i:i + 2]
	l.append(o)
c = int(l.count(l[0]))
for i in range(0, len(l)):
	v = int(l.count(l[i]))
	if v >= c:
		c = v
		u = i
print(l[u])


n = int(input())
s = input()
s1 = []
count = 0
count1 = 0
ss = ''
for i in range(n - 1):
	s1.append(s[i] + s[i + 1])
for i in range(len(s1)):
	for j in range(len(s1)):
		if s1[i] == s1[j]:
			count1 += 1
	if count < count1:
		count = count1
		ss = s1[i]
	count1 = 0
print(ss)


n = int(input())
k = input()
l = len(k)
x = {}
for i in range(l - 1):
	s = k[i] + k[i + 1]
	if s in x:
		x[s] += 1
	else:
		x[s] = 1
d = list(x.items())
d1 = []
for i in range(len(d)):
	d1.append(d[i][1])
print(d[d1.index(max(d1))][0])


n = int(input())
s = input()
D = dict()
for i in range(len(s) - 1):
	if s[i] + s[i + 1] in D:
		D[s[i] + s[i + 1]] += 1
	else:
		D[s[i] + s[i + 1]] = 1
Max = -1
ans = ''
for key in D:
	if D[key] > Max:
		Max = D[key]
		ans = key
print(ans)


n = input()
from collections import Counter as c
d = c()
s = input()
for i in range(len(s) - 1):
	d[s[i] + s[i + 1]] += 1
m = 0
for (elem, num) in d.items():
	if num > m:
		m = int(num)
		ans = elem[:]
print(ans)


d = {}
n = int(input())
s = input()
m = 0
l = ''
for i in range(n - 1):
	if d.get(s[i:i + 2]) == None:
		d[s[i:i + 2]] = 1
	else:
		d[s[i:i + 2]] += 1
while d != {}:
	a = d.popitem()
	if a[1] > m:
		m = a[1]
		l = a[0]
print(l)


import operator
n = int(input())
a = input()
res = {}
if n > 2:
	for i in range(n - 1):
		s = ''
		s = s + a[i] + a[i + 1]
		if s in res:
			res[s] += 1
		else:
			res[s] = 1
	print(max(res.items(), key=operator.itemgetter(1))[0])
else:
	print(a)


n = int(input())
s = input()
max_occurrence = -1
two_gram = ''
for i in range(len(s) - 1):
	current_two_gram = s[i] + s[i + 1]
	count = 1
	for j in range(i + 1, len(s) - 1):
		if s[j] + s[j + 1] == current_two_gram:
			count += 1
	if count > max_occurrence:
		max_occurrence = count
		two_gram = current_two_gram
print(two_gram)


n = int(input())
s = input()
d = {}
m = 0
res = ''
for i in range(n - 1):
	t = s[i:i + 2]
	if t not in d:
		d[t] = 1
	else:
		d[t] += 1
	if d[t] > m:
		m = d[t]
		res = t
print(res)


n = int(input())
s = input()
d = {}
for i in range(n - 1):
	if s[i] + s[i + 1] in d:
		d[s[i] + s[i + 1]] += 1
	else:
		d[s[i] + s[i + 1]] = 1
m = max(d.values())
for i in d:
	if d[i] == m:
		break
print(i)


n = int(input())
a = input()
v = []
for i in range(len(a) - 1):
	z = a[i:i + 2]
	v.append([a.count(z), z])
v.sort()
print(v[-1][1])


n = int(input())
s = input()
l = []
for i in range(0, len(s)):
	c = 0
	for j in range(0, len(s)):
		if s[i:i + 2] == s[j:j + 2]:
			c += 1
	l.append([s[i:i + 2], c])
count = []
for i in l:
	count.append(i[1])
ma = max(count)
for i in l:
	if ma == i[1]:
		print(i[0])
		break


q = int(input())
w = input()
e = w
e = list(e)
z = []
for i in range(q - 1):
	s = ''
	s = w[i] + w[i + 1]
	if not s in z:
		z.append(s)
n = 0
m = ''
b = 0
for i in z:
	b = 0
	for j in range(q - 1):
		s = ''
		s = w[j] + w[j + 1]
		if s == i:
			b += 1
	if b > n:
		n = b
		m = i
print(m)


n = int(input())
st = list(input())
d = {}
for i in range(n - 1):
	wk1 = st[i] + st[i + 1]
	if not wk1 in d:
		d[wk1] = 0
	d[wk1] += 1
most = 0
for i in d:
	if d[i] > most:
		most = d[i]
		ans = i
print(ans)


(n, s) = (int(input()), input())
d = dict()
for i in range(n - 1):
	try:
		d[s[i:i + 2]] += 1
	except:
		d[s[i:i + 2]] = 1
mx = 0
l = [i for i in d]
l.sort(key=lambda x: d[x], reverse=True)
print(l[0])


n = input()
s = input()
dic = dict()
for i in range(len(s) - 1):
	temp = s[i] + s[i + 1]
	if temp in dic:
		dic[temp] = dic[temp] + 1
	else:
		dic[temp] = 1
maxp = 0
maxn = ''
for (k, v) in dic.items():
	if v > maxp:
		maxp = v
		maxn = k
print(maxn)


string_length = int(input())
input_string = list(input())
two_gram_dict = {}
idx_i = 0
idx_j = 1
while idx_j < string_length:
	two_gram_key = ''.join(input_string[idx_i:idx_j + 1])
	if two_gram_key not in two_gram_dict:
		two_gram_dict[two_gram_key] = 1
	else:
		two_gram_dict[two_gram_key] += 1
	idx_i += 1
	idx_j += 1
maximal_two_grams = ''
maximal_count = 0
for key in two_gram_dict:
	if two_gram_dict[key] > maximal_count:
		maximal_two_grams = key
		maximal_count = two_gram_dict[key]
print(maximal_two_grams)


from sys import stdin, stdout

def solve(n, string):
	if n == 2:
		return string
	hash = dict()
	for i in range(n + 1):
		if string[i:i + 2] in hash:
			hash[string[i:i + 2]] += 1
		else:
			hash[string[i:i + 2]] = 1
	best = ''
	bc = 0
	for (sub, count) in hash.items():
		if count > bc:
			bc = count
			best = sub
	return best
n = int(stdin.readline())
string = stdin.readline()[:-1]
stdout.write(f'{solve(n, string)}\n')


n = int(input())
a = input()
(maximum, counter, b) = (0, 0, '')
for i in range(n - 1):
	for j in range(n - 1):
		if a[j:j + 2] == a[i:i + 2]:
			counter += 1
	if counter > maximum:
		b = a[i:i + 2]
		maximum = counter
	counter = 0
print(b)


a = int(input())
b = input()
d = {}
c = 0
while c != a - 1:
	x = b[c]
	y = b[c + 1]
	if x + y in d:
		d[x + y] = d[x + y] + 1
	else:
		d[x + y] = 1
	c = c + 1
print(max(d, key=d.get))


input()
s = input()
d = {}
for i in range(len(s) - 1):
	a = s[i:i + 2]
	if not a in d:
		d[a] = 0
	d[a] += 1
mss = ''
num = 0
for ss in d.keys():
	if d[ss] > num:
		mss = ss
		num = d[ss]
print(mss)


(n, s) = (int(input()), input())
(best, ans) = (0, '')
for i in range(n - 1):
	(c, sb) = (0, s[i:i + 2])
	for j in range(n - 1):
		if sb == s[j:j + 2]:
			c += 1
	if c > best:
		(ans, best) = (s[i:i + 2], c)
print(ans)


s = int(input())
n = input()
c = []
for i in range(len(n) - 1):
	c.append(n[i:i + 2])
a = []
for i in c:
	a.append(c.count(i))
print(c[a.index(max(a))])


def main():
	from collections import Counter
	l = int(input())
	s = input()
	c = []
	for i in range(0, l - 1):
		c.append(s[i] + s[i + 1])
	counter = Counter(c)
	most_repeated = ''
	most_repeated_cant = 0
	for two_gram in counter:
		if counter[two_gram] > most_repeated_cant:
			most_repeated = two_gram
			most_repeated_cant = counter[two_gram]
	return most_repeated
print(main())


import math
import sys
import itertools
import itertools
import collections

def sa(Type=int):
	return [Type(x) for x in input().split()]

def longestOneLen(arr):
	pass

def solve(t):
	n = int(input())
	s = input()
	cc = collections.defaultdict(int)
	for i in range(len(s) - 1):
		cc[s[i:i + 2]] += 1
	result = max(cc.items(), key=lambda x: x[1])[0]
	print(result)
solve(1)


n = int(input())
a = input()
i = 0
lst = []
lst2 = []
for i in range(n - 1):
	lst.append(a[i:i + 2])

def most_frequent(lst):
	return max(set(lst), key=lst.count)
lst2.append(most_frequent(lst))
print(lst2[0])


n = int(input())
s = input()
max = 0
for i in range(n - 1):
	c = 0
	for j in range(n - 1):
		if s[i] == s[j] and s[i + 1] == s[j + 1]:
			c += 1
		if max < c:
			max = c
			result = s[i] + s[i + 1]
print(result)


def f(s, c, n):
	ret = 0
	for i in range(n - 1):
		if s[i] + s[i + 1] == c:
			ret += 1
	return ret
n = int(input())
s = input()
m = 0
for i in range(n - 1):
	c = s[i] + s[i + 1]
	if f(s, c, n) > m:
		m = f(s, c, n)
		ans = c
print(ans)


n = int(input())
m = input()
a = {}
for i in range(n - 1):
	if m[i] + m[i + 1] not in a:
		a[m[i] + m[i + 1]] = 1
	else:
		a[m[i] + m[i + 1]] += 1
print(max(a.items(), key=lambda x: x[1])[0])


n = int(input())
string = input()
grams = {}
for i in range(n - 1):
	two = string[i] + string[i + 1]
	if two not in grams:
		grams[two] = 1
	else:
		grams[two] += 1
maxV = 0
setf = ''
for i in grams:
	if grams[i] > maxV:
		maxV = grams[i]
		setf = i
print(setf)


n = int(input())
s = input()
count = {}
for i in range(len(s) - 1):
	if s[i:i + 2] in count:
		count[s[i:i + 2]] += 1
	else:
		count[s[i:i + 2]] = 1
print(max(count, key=count.get))


from collections import defaultdict
n = int(input())
s = input()
d = defaultdict(int)
for i in range(n - 1):
	k = s[i] + s[i + 1]
	d[k] += 1
d = dict(d)
l = list(d.values())
k = list(d.keys())
print(k[l.index(max(l))])


n = int(input())
s = input()
pairs = []
b = []
count = 1
for i in range(n - 1):
	pairs.append(s[i:i + 2])
pairs = sorted(pairs)
pairs_first = pairs[0]
b.append(pairs_first)
for j in range(1, len(pairs)):
	if pairs[j] == pairs_first:
		count += 1
		b.append(count * pairs[j])
	else:
		count = 1
		b.append(count * pairs_first)
		pairs_first = pairs[j]
print(max(b, key=len)[:2])


from collections import Counter
n = int(input())
s = input()
print(Counter((l1 + l2 for (l1, l2) in zip(s[:-1], s[1:]))).most_common(1)[0][0])


n = input()
string = input()
(current, tmp, result) = ('', '', '')
(counter, max_) = (0, -1)
for i in range(len(string) - 1):
	current = string[i] + string[i + 1]
	counter = 0
	for j in range(len(string) - 1):
		if i != j:
			tmp = string[j] + string[j + 1]
			if tmp == current:
				counter += 1
		if counter > max_:
			max_ = counter
			result = current
print(result)


from collections import Counter
d = Counter()

def d_d(st):
	if st in d.keys():
		d[st] += 1
	else:
		d[st] = 1
n = int(input())
s = input()
for i in range(n - 1):
	d_d(s[i] + s[i + 1])
l = str(d.most_common(1))
print(l[3] + l[4])


w = 2
input()
s = input()
p = [s[i:i + w] for i in range(0, len(s), w)]
k = {}
for i in p:
	if len(i) == 1:
		i = i * 2
	k[i] = s.count(i)
k = dict(sorted(k.items(), reverse=True))
print(max(k, key=k.get))


from collections import defaultdict
n = int(input())
s = input()
counts = defaultdict(int)
for (c1, c2) in zip(s, s[1:]):
	counts[c1 + c2] += 1
print(max(counts, key=lambda k: counts[k]))


from collections import Counter
size = int(input())
s = input()
l = len(s)
res = []
for i in range(l):
	for j in range(i, l):
		val = s[i:j + 1]
		if len(val) == 2:
			res.append(val)
val = dict(Counter(res))
ans = sorted(val, key=val.get, reverse=True)
print(ans[0])


n = int(input())
s = input()
a = []
for i in range(len(s) - 1):
	a.append(s[i:i + 2])
a = sorted(a)
b = set(a)
b = list(sorted(b))
f = [0] * len(b)
i = 0
j = 0
while i < len(a):
	if a[i] == b[j]:
		f[j] += 1
		i += 1
	else:
		j += 1
m = max(f)
for i in range(len(f)):
	if f[i] == m:
		print(b[i])
		break


from collections import *
R = lambda : map(int, input().split())
input()
s = input()
d = defaultdict(int)
for i in range(len(s) - 1):
	d[s[i:i + 2]] = d[s[i:i + 2]] + 1
import operator
print(max(d.items(), key=operator.itemgetter(1))[0])


n = int(input())
s = input()
l = []
c = 0
t = []
for i in range(len(s) - 1):
	str = s[i:i + 2]
	l.append(str)
for x in l:
	m = l.count(x)
	t.append(m)
for y in range(len(t)):
	if t[y] == max(t):
		b = y
print(l[b])


from collections import defaultdict
n = int(input())
s = input()
twogram = defaultdict(int)
for i in range(n - 1):
	twogram[s[i:i + 2]] += 1
maxcount = 0
ans = ''
for i in twogram:
	if twogram[i] > maxcount:
		maxcount = twogram[i]
		ans = i
print(ans)


import sys
import bisect
import heapq
from math import *
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
mod = pow(10, 9) + 7

def inp():
	return sys.stdin.readline().strip()

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def graph(vertex):
	return [[] for i in range(0, vertex + 1)]

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def lcm(a, b):
	return a * b // gcd(a, b)

def solve():
	n = int(inp())
	s = inp()
	sub = []
	cnt = [0] * n
	for i in range(0, n - 1):
		if s[i:i + 2] not in sub:
			sub.append(s[i:i + 2])
		else:
			temp = sub.index(s[i:i + 2])
			cnt[temp] += 1
	m = max(cnt)
	print(sub[cnt.index(m)])
testcase(1)


def dvygram(s):
	count1 = 0
	result = ''
	for i in range(len(s) - 1):
		count2 = 0
		for j in range(len(s) - 1):
			if s[j] == s[i] and s[j + 1] == s[i + 1]:
				count2 += 1
		if count1 < count2:
			count1 = count2
			result = s[i] + s[i + 1]
	return result
n = int(input())
t = input()
print(dvygram(t))


length = int(input())
string = input()
subs_list = [string[i:i + 2] for i in range(0, length - 2 + 1)]
max_occurences = 0
frequent = ''
for sub in subs_list:
	if max_occurences < subs_list.count(sub):
		frequent = sub
		max_occurences = subs_list.count(sub)
print(frequent)


n = int(input())
s = input()
i = 0
c = 0
string = ''
while i != n - 1:
	temp = s[i:i + 2]
	count = 0
	j = 0
	while j != n - 1:
		temp2 = s[j:j + 2]
		if temp == temp2:
			count += 1
		j += 1
	if count > c:
		c = count
		string = temp
	i += 1
print(string)


from collections import defaultdict
n = int(input())
s = input()
d = defaultdict(int)
for i in range(n - 1):
	d[s[i:i + 2]] += 1
print(max(d, key=lambda k: d[k]))


def decide(tmp, String, Max, Answer):
	if tmp[String] > Max:
		return (String, tmp[String])
	return (Answer, Max)
n = int(input())
s = input()
tmp = {}
Max = 0
Answer = 'no Answer'
for i in range(n - 1):
	String = s[i] + s[i + 1]
	if tmp.get(String, -1) == -1:
		tmp[String] = 1
		(Answer, Max) = decide(tmp, String, Max, Answer)
	else:
		tmp[String] += 1
		(Answer, Max) = decide(tmp, String, Max, Answer)
print(Answer)


n = int(input())
s = input()
maxm = 0
mar = ''
li = []
for i in range(n - 1):
	a = ''
	a = s[i] + s[i + 1]
	li.append(a)
for i in li:
	freq = li.count(i)
	if freq > maxm:
		maxm = freq
		mar = i
print(mar)


from collections import Counter as c
n = int(input())
s = input()
cnt = c(zip(s, s[1:]))
import operator
print(''.join(max(cnt.items(), key=operator.itemgetter(1))[0]))


n = int(input())
s = input()
ls = []
lc = []
for i in range(n):
	if i != n - 1:
		ls.append(s[i:2 + i])
for i in ls:
	ct = ls.count(i)
	lc.append(ct)
t = lc.index(max(lc))
print(ls[t])


n = int(input())
string = input()
a = []
if len(string) == 2:
	print(string)
else:
	for x in range(n - 1):
		if string[x:x + 2] not in a:
			a = a + [string[x:x + 2]]
	c = len(a)
	b = []
	for k in range(c):
		b = b + [0]
	for x in range(n):
		i = 0
		while i < c:
			if string[x:x + 2] == a[i]:
				b[i] = b[i] + 1
				break
			else:
				i = i + 1
	d = b.index(max(b), 0, c)
	print(a[d])


from sys import stdin

def read_lines(sep=' ', input_type=None):
	_lines = stdin.readlines()
	cast = input_type is not None
	lines = []
	for line in _lines:
		line = line[:-1].split(sep)
		if cast:
			line = [input_type(x) for x in line]
		lines.append(line)
	return lines
import collections
lines = read_lines(input_type=None)
t = lines[0]
string = lines[1][0]
counter = collections.defaultdict(int)
maxtgram = None
maxappear = 0
length = len(string)
for (i, char) in enumerate(string):
	if i < length - 1:
		tgram = string[i:i + 2]
		counter[tgram] += 1
		v = counter[tgram]
		if v > maxappear:
			maxappear = v
			maxtgram = tgram
print(maxtgram)


from collections import defaultdict
n = int(input())
l = input()
dico = defaultdict(int)
sommesMax = 0
striend = ''
for i in range(n - 1):
	dico[l[i] + l[i + 1]] += 1
for (key, values) in dico.items():
	if values > sommesMax:
		sommesMax = values
		striend = key
print(striend)


n = int(input())
s = list(input())
d = {}
i = 0
while i < n - 1:
	p = s[i] + s[i + 1]
	d[p] = 0
	i = i + 1
i = 0
while i < n - 1:
	p = s[i] + s[i + 1]
	d[p] = d[p] + 1
	i = i + 1
m = 0
a = ''
for key in d:
	if d[key] > m:
		m = d[key]
		a = key
print(a)


n = int(input())
s = input()
listkeys = []
a = 0
b = 1
pairs = dict()
for i in range(n - 1):
	pairs[s[a] + s[b]] = pairs.get(s[a] + s[b], 0) + 1
	listkeys.append(pairs[s[a] + s[b]])
	a += 1
	b += 1
maxkey = listkeys[0]
place = 0
for i in range(1, len(listkeys)):
	if listkeys[i] > maxkey:
		maxkey = listkeys[i]
		place = i
print(s[place] + s[place + 1])


t = int(input())
s = input()
l = []
p = ''
for i in range(len(s) - 1):
	p = ''
	p = p + s[i] + s[i + 1]
	l.append(p)
k = [0 for x in range(len(l))]
for i in range(len(l)):
	for j in range(len(l)):
		if l[i] == l[j]:
			k[i] = k[i] + 1
p = l[k.index(max(k))]
print(p)


from collections import Counter
hm = int(input())
inp = input()
lis = []
for i in range(hm - 1):
	s = inp[i] + inp[i + 1]
	lis.append(s)
c = Counter(lis)
print(c.most_common(1)[0][0])


n = input()
string = input()
pair_list = [value + string[i + 1] for (i, value) in enumerate(string[:-1])]
frequence = {i: pair_list.count(i) for i in pair_list}
print(*list({key: value for (key, value) in sorted(frequence.items(), key=lambda item: item[1])}.keys())[-1:])


n = int(input())
s = input()
lis = []
x = -1
for i in range(n - 1):
	k = s[i:i + 2]
	lis.append(k)
for a in lis:
	x = max(lis.count(a), x)
for a in lis:
	if x == lis.count(a):
		print(a)
		break


n = int(input())
str = input()
map = {}
for i in range(0, n - 1):
	subs = str[i:i + 2]
	if subs in map:
		map[subs] = map[subs] + 1
	else:
		map[subs] = 1
print(max(map, key=map.get))


import sys
n = int(input())
s = str(input())
p = []
c = []
for i in range(0, n - 1):
	a = s[i] + s[i + 1]
	p.append(a)
for i in range(0, len(p)):
	o = p.count(p[i])
	c.append(o)
u = max(c)
ind = c.index(u)
print(p[ind])


n = int(input())
a = input()
d = {}
for i in range(n - 1):
	if a[i:i + 2] not in d:
		d[a[i:i + 2]] = 1
	else:
		d[a[i:i + 2]] = d[a[i:i + 2]] + 1
max1 = 0
for i in d:
	if max1 < d[i]:
		max1 = d[i]
		ans = i
print(ans)


n = int(input())
s = str(input())
b = [s[i:i + 2] for i in range(n - 1)]
a = ['', 0]
for i in range(n - 1):
	if b.count(s[i:i + 2]) > a[1]:
		a[0] = s[i:i + 2]
		a[1] = b.count(s[i:i + 2])
print(a[0])


from itertools import tee
from collections import Counter

def line():
	return map(int, input().split())

def pairwise(it):
	(a, b) = tee(it)
	next(b)
	return zip(a, b)
input()
s = input()
print(''.join(Counter(pairwise(s)).most_common(1)[0][0]))


n = int(input())
s = input()
a = dict()
for i in range(n - 1):
	cur_dv = s[i:i + 2]
	a[cur_dv] = a.get(cur_dv, 0) + 1
max_dv = ''
maxx = -1
for dv in a:
	if a[dv] > maxx:
		maxx = a[dv]
		max_dv = dv
print(max_dv)


n = int(input())
data = input()
now = ''
maxi = 0
result = ''
for i in range(n - 1):
	now = data[i:i + 2]
	cnt = 0
	for j in range(n - 1):
		if now == data[j:j + 2]:
			cnt += 1
	if maxi <= cnt:
		result = now
		maxi = cnt
print(result)


input()
s = input()
d = {}
for i in range(len(s) - 1):
	ss = s[i:i + 2]
	if d.get(ss) == None:
		d[ss] = 1
	else:
		d[ss] += 1
maxV = 0
maxK = ''
for (key, value) in d.items():
	if value > maxV:
		maxV = value
		maxK = key
print(maxK)


import sys, math
from collections import Counter, deque, defaultdict
mod = 10 ** 9 + 7
INF = float('inf')

def inp():
	return int(sys.stdin.readline())

def inpl():
	return list(map(int, sys.stdin.readline().split()))
n = inp()
s = input()
cnt = defaultdict(int)
for i in range(n - 1):
	cnt[s[i:i + 2]] += 1
mx = 0
for key in list(cnt):
	if cnt[key] > mx:
		mx = cnt[key]
		res = key
print(res)


num = int(input())
string = input()
counter = 0
prevcounter = 0
letters = ''
actualletters = ''
for count in range(num - 1):
	letters = string[count] + string[count + 1]
	for count2 in range(num - 1):
		if string[count2] + string[count2 + 1] == letters:
			counter += 1
	if counter > prevcounter:
		prevcounter = counter
		actualletters = letters
	counter = 0
print(actualletters)


from collections import Counter

def main():
	input()
	s = input()
	print(''.join(Counter((ab for ab in zip(s, s[1:]))).most_common(1)[0][0]))
main()


n = int(input())
word = input()
i = 0
occurrences = dict()
while i < n - 1:
	if word[i] + word[i + 1] in occurrences:
		occurrences[word[i] + word[i + 1]] = occurrences[word[i] + word[i + 1]] + 1
	else:
		occurrences[word[i] + word[i + 1]] = 1
	i = i + 1
print(max(occurrences, key=lambda k: occurrences[k]))


from collections import Counter
n = int(input())
s = input()
a = []
for i in range(n - 1):
	a.append(s[i] + s[i + 1])
b = Counter(a)
maximum = max(b.values())
for i in b:
	if b[i] == maximum:
		print(i)
		break


n = int(input())
d = {}
s = input()
for i in range(n - 1):
	if s[i] + s[i + 1] in d:
		d[s[i] + s[i + 1]] += 1
	else:
		d[s[i] + s[i + 1]] = 1
imax = -1
ans = ''
for key in d:
	if d[key] > imax:
		imax = d[key]
		ans = key
print(ans)


n = int(input())
s = input()
cnt = [[0] * 26 for i in range(26)]
for i in range(1, n):
	cnt[ord(s[i]) - ord('A')][ord(s[i - 1]) - ord('A')] += 1
q = 0
(a, b) = (0, 0)
for i in range(26):
	for j in range(26):
		if cnt[i][j] > q:
			q = cnt[i][j]
			a = i
			b = j
print(chr(ord('A') + b) + chr(ord('A') + a))


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def main():
	n = I()
	s = S()
	c = collections.defaultdict(int)
	for i in range(n - 1):
		c[s[i:i + 2]] += 1
	m = max(c.values())
	for (k, v) in c.items():
		if v == m:
			return k
	return -1
print(main())


n = int(input())
s = input()
a = 0
ans = 0
v = []
m = []
for i in range(len(s) - 1):
	v.append(s[i:i + 2])
d = {}
for i in v:
	if i in d:
		d[i] += 1
	else:
		d[i] = 1
a = max(list(d.values()))
for i in d:
	if d[i] == a:
		ans = i
		break
print(ans)


import re
n = int(input())
s = input()
m = 0
max_string = ''
for i in range(n - 1):
	l = len([m.start() for m in re.finditer('(?=' + s[i:i + 2] + ')', s)])
	if l > m:
		m = l
		max_string = s[i:i + 2]
print(max_string)


n = int(input())
string = input()
maxi = 0
answer = ''

def repeat_inverse(two_char):
	count = 0
	for i in range(1, len(string)):
		if string[i - 1] == two_char[0] and string[i] == two_char[1]:
			count += 1
	return count
for i in range(len(string) - 1):
	two_char = string[i] + string[i + 1]
	temp = repeat_inverse(two_char)
	if temp > maxi:
		maxi = temp
		answer = two_char
print(answer)


n = int(input())
s = input()
d = {}
for i in range(n - 1):
	t = s[i:i + 2]
	if t not in d:
		d[t] = 0
	d[t] += 1
ans = ''
val = 0
for (k, v) in d.items():
	if val < v:
		(ans, val) = (k, v)
print(ans)


def countFreq(pat, txt):
	M = len(pat)
	N = len(txt)
	res = 0
	for i in range(N - M + 1):
		x = 0
		for j in range(M):
			if txt[i + j] != pat[j]:
				break
			x += 1
		if x == M:
			res += 1
			j = 0
	return res
n = int(input())
s = str(input())
a = []
for _ in range(len(s) - 1):
	a.append([countFreq(s[_:_ + 2], s), s[_:_ + 2]])

def sort1(val):
	return val[0]
a.sort(key=sort1, reverse=True)
print(a[0][1])


n = int(input())
str = input()
my_dict = {}
for i in range(n - 1):
	try:
		my_dict[str[i:i + 2]] += 1
	except:
		my_dict[str[i:i + 2]] = 1
mx = 0
mx_str = ''
for (k, v) in my_dict.items():
	if v > mx:
		mx = v
		mx_str = k
print(mx_str)


n = int(input())
st = input()
dos = {}
for i in range(n - 1):
	a = st[i:i + 2]
	if a not in list(dos.keys()):
		dos[a] = 1
	else:
		dos[a] += 1
result = sorted(dos.items(), key=lambda x: x[1], reverse=True)
print(result[0][0])


n = int(input())
s = input()
grams = {}
for i in range(len(s) - 1):
	try:
		grams[s[i:i + 2]] += 1
	except:
		grams[s[i:i + 2]] = 1
mx = 0
for (a, b) in grams.items():
	if b > mx:
		mx = b
		word = a
print(word)


n = int(input())
s = input()
p = s[0]
d = {}
for x in s[1:]:
	if (p, x) not in d:
		d[p, x] = 1
	else:
		d[p, x] += 1
	p = x
max_num = 0
max_pair = ('', '')
for (k, v) in d.items():
	if v > max_num:
		max_num = v
		max_pair = k
print(''.join(max_pair))


n = int(input())
s = input().split()
s = list(''.join(s))
m = ''.join(s)
l = {}

def count_sub(str, sub):
	length = len(str)
	counter = 0
	for i in range(length):
		for j in range(length):
			if str[i:j + 1] == sub:
				counter += 1
	return counter
for i in range(1, n):
	k = s[i - 1] + s[i]
	key = count_sub(m, k)
	d = {k: key}
	l.update(d)
print(max(l, key=l.get))


import re
from collections import Counter
n = input()
s = input()
ngramms = re.findall('.', s)
top = Counter(zip(ngramms, ngramms[1:])).most_common(1)[0]
print(''.join(top[0]))


from collections import Counter
n = int(input())
s = input().strip()
cnt = Counter()
for i in range(n - 1):
	cnt[s[i:i + 2]] += 1
print(max(cnt, key=lambda x: cnt[x]))


a = int(input())
b = input()
dic = {}
for c in range(0, len(b) - 1):
	d = b[c] + b[c + 1]
	if not d in dic:
		dic[d] = 1
	else:
		dic[d] = dic[d] + 1
mi = 0
ma = ''
for key in dic:
	if dic[key] > mi:
		ma = key
		mi = dic[key]
print(ma)


t = int(input())
a = list(input())
di = dict()
for i in range(len(a) - 1):
	if a[i] + a[i + 1] not in di:
		di[a[i] + a[i + 1]] = 1
	else:
		di[a[i] + a[i + 1]] += 1
b = list(di.keys())
a = list(di.values())
di = dict()
for i in range(len(a)):
	di[a[i]] = b[i]
print(di[max(a)])


num = input()
string = input()
rep = {}
for i in range(0, int(num) - 1):
	concat = ''.join((string[i], string[i + 1]))
	val = rep.get(concat)
	if val is None:
		rep[concat] = 1
	else:
		rep[concat] = val + 1
s = [(k, rep[k]) for k in sorted(rep, key=rep.get, reverse=True)]
print(s[0][0])


from sys import stdin, stdout
dic = dict()
n = int(stdin.readline())
s = stdin.readline()
mx = 0
mxans = ''
for i in range(n - 1):
	op = s[i:i + 2]
	if dic.get(op) != None:
		dic[op] += 1
		if dic[op] > mx:
			mx = dic[op]
			mxans = op
	else:
		dic[op] = 1
		if dic[op] > mx:
			mx = dic[op]
			mxans = op
stdout.write(mxans)


from collections import defaultdict
dic = defaultdict(int)
lenght = int(input())
line = input()
for i in range(lenght - 1):
	pair = line[i] + line[i + 1]
	dic[pair] += 1
print(max(dic, key=dic.get))


n = int(input())
s = input()
res = 0
x = ''
for i in range(n - 1):
	cur = 0
	for j in range(n - 1):
		if s[j] == s[i] and s[j + 1] == s[i + 1]:
			cur += 1
	if res < cur:
		res = cur
		x = s[i] + s[i + 1]
print(x)


l = int(input())
s = input()
a = []
for i in range(0, l - 1):
	a.append(s[i] + s[i + 1])
a.sort()
fs = ''
(m, c) = (0, 1)
for i in range(len(a)):
	count = a.count(a[i])
	if count > m:
		m = count
		fs = a[i]
print(fs)


n = int(input())
s = input()
check = dict()
for i in range(n - 1):
	t = s[i:i + 2]
	if t in check:
		check[t] += 1
	else:
		check[t] = 1
c = list(check.items())
c.sort(key=lambda x: x[1], reverse=True)
print(c[0][0])


n = int(input())
s = input()
grams = {}
for i in range(n - 1):
	grams[s[i] + s[i + 1]] = 0
for i in range(n - 1):
	grams[s[i] + s[i + 1]] += 1
max = 0
ans = s[:2]
for x in grams.keys():
	if grams[x] > max:
		max = grams[x]
		ans = x
print(ans)


from sys import stdin, stdout
import collections
n = int(stdin.readline())
s = stdin.readline()
map = {}
for i in range(len(s) - 2):
	temp = s[i] + s[i + 1]
	try:
		map[temp] += 1
	except:
		map[temp] = 1
map = collections.OrderedDict(sorted(map.items()))
s = max(map.values())
for (k, v) in map.items():
	if s == map[k]:
		stdout.write(k + '\n')
		break


n = int(input())
s = input()
l = []
c = 0
r = ''
for i in range(0, n - 1, 1):
	l.append(s[i] + s[i + 1])
l.sort()
for i in l:
	if l.count(i) > c:
		c = l.count(i)
		r = i
print(r)


n = int(input())
st = input()
mp = {}
for i in range(len(st) - 1):
	if str(st[i] + st[i + 1]) not in mp:
		mp[str(st[i] + st[i + 1])] = 1
	else:
		mp[str(st[i] + st[i + 1])] += 1
t = max(mp.values())
for key in mp:
	if mp[key] == t:
		print(key)
		break


n = int(input())
s = input()
t = {}
for i in range(0, len(s) - 1):
	s_cur = s[i] + s[i + 1]
	if t.get(s_cur) is None:
		t[s_cur] = 1
	else:
		t[s_cur] = t[s_cur] + 1
max = -1
max_str = ''
for i in range(0, len(s) - 1):
	s_cur = s[i] + s[i + 1]
	if t[s_cur] > max:
		max = t[s_cur]
		max_str = s_cur
print(max_str)


n = int(input())
s = input()
twograms = {}
for i in range(0, n - 1):
	gram = s[i:i + 2]
	if gram in twograms:
		twograms[gram] += 1
	else:
		twograms[gram] = 1
m = 0
maximum = ''
for gram in twograms:
	if twograms[gram] > m:
		m = twograms[gram]
		maximum = gram
print(maximum)


import collections as cc
I = lambda : list(map(int, input().split()))
(n,) = I()
s = input()
f = cc.defaultdict(int)
for i in range(n - 1):
	f[s[i:i + 2]] += 1
print(max(f, key=lambda s: f[s]))


length = int(input())
ss = input()
max = 0
max_substring = ''
dict = {}
for i in range(0, length - 1):
	substring = ss[i:i + 2]
	if substring not in dict:
		dict[substring] = 1
	else:
		dict[substring] = dict[substring] + 1
	if dict[substring] > max:
		max = dict[substring]
		max_substring = substring
print(max_substring)


from sys import stdin, stdout
import bisect
import math

def st():
	return list(stdin.readline())

def inp():
	return int(stdin.readline())

def li():
	return list(map(int, stdin.readline().split()))

def mp():
	return map(int, stdin.readline().split())

def pr(n):
	stdout.write(str(n) + '\n')

def soe(limit):
	l = [1] * (limit + 1)
	prime = []
	for i in range(2, limit + 1):
		if l[i]:
			for j in range(i * i, limit + 1, i):
				l[j] = 0
	for i in range(2, limit + 1):
		if l[i]:
			prime.append(i)
	return prime

def segsoe(low, high):
	limit = int(high ** 0.5) + 1
	prime = soe(limit)
	n = high - low + 1
	l = [0] * (n + 1)
	for i in range(len(prime)):
		lowlimit = low // prime[i] * prime[i]
		if lowlimit < low:
			lowlimit += prime[i]
		if lowlimit == prime[i]:
			lowlimit += prime[i]
		for j in range(lowlimit, high + 1, prime[i]):
			l[j - low] = 1
	for i in range(low, high + 1):
		if not l[i - low]:
			if i != 1:
				print(i)

def power(a, n):
	r = 1
	while n:
		if n & 1:
			r = r * a
			n = n - 1
		else:
			a = a * a
			n = n >> 1
	return r

def solve():
	n = inp()
	s = st()
	d = {}
	for i in range(n - 1):
		a = s[i] + s[i + 1]
		d[a] = d.get(a, 0) + 1
	ma = -1000
	for (i, j) in d.items():
		if j > ma:
			ma = j
			ele = i
	pr(ele)
solve()


n = int(input())
s = input()
max = 0
for i in range(n - 1):
	c = s[i] + s[i + 1]
	counter = 0
	for j in range(n - 1):
		if c == s[j] + s[j + 1]:
			counter += 1
	if counter > max:
		max = counter
		t = c
print(t)


n = int(input())
S = input()
cnt = []
for i in range(n - 1):
	cnt.append(S[i] + S[i + 1])
print(max(cnt, key=cnt.count))


from typing import Counter

def main():
	from collections import Counter
	N = int(input())
	S = input()
	mp = Counter()
	for i in range(N - 1):
		mp[S[i:i + 2]] += 1
	print(mp.most_common()[0][0])
main()


n = int(input())
s = input()
m = {}
for i in range(n - 1):
	bigram = s[i:i + 2]
	if bigram not in m:
		m[bigram] = 0
	m[bigram] += 1
m_sorted = sorted(list(m.items()), key=lambda x: x[1], reverse=True)
print(m_sorted[0][0])


def count_understrings(s, s1):
	c = 0
	for i in range(len(s) - 1):
		tmp = s[i]
		tmp = tmp + s[i + 1]
		if tmp == s1:
			c += 1
	return c
n = int(input())
s = input()
s = s + ' '
ans = ''
max = 0
for i in range(n - 1):
	kol = 0
	sb = s[i]
	sb = sb + s[i + 1]
	kol = count_understrings(s, sb)
	if kol >= max:
		max = kol
		ans = sb
print(ans)


n = int(input())
str = input()
rec = [[0 for i in range(30)] for i in range(30)]
Max = 0
for i in range(n - 1):
	a = ord(str[i]) - ord('A') + 1
	b = ord(str[i + 1]) - ord('A') + 1
	rec[a][b] = rec[a][b] + 1
	if rec[a][b] > Max:
		Max = rec[a][b]
		ansa = a - 1
		ansb = b - 1
print(chr(ansa + ord('A')) + chr(ansb + ord('A')))


n = int(input())
a = input()
l = list(a)
d = []
c = []
for i in range(1, n):
	d.append(a[i - 1:i + 1])
for i in range(1, n):
	sum = d.count(l[i - 1] + l[i])
	c.append(sum)
z = c.index(max(c))
print(a[z:z + 2])


n = int(input())
a = input()
res = ''
maxcount = 0
if n == 1 or n == 2:
	print(a)
else:
	for i in range(n - 1):
		s = a[i] + a[i + 1]
		count = 0
		for j in range(n - 1):
			if s == a[j] + a[j + 1]:
				count += 1
		if count > maxcount:
			maxcount = count
			res = s
	print(res)


input()
S = input()
maps = {}
for i in range(1, len(S)):
	if S[i - 1:i + 1] in maps:
		maps[S[i - 1:i + 1]] += 1
	else:
		maps[S[i - 1:i + 1]] = 1
an = ''
ma = 0
for i in maps:
	if maps[i] > ma:
		an = i
		ma = maps[i]
print(an)


num = int(input(''))
string = input('')
occ = {}
highest = 0
highestStr = ''
for i in range(len(string) - 1):
	if string[i:i + 2] in occ:
		occ[string[i:i + 2]] += 1
	else:
		occ[string[i:i + 2]] = 1
	if occ[string[i:i + 2]] > highest:
		highest = occ[string[i:i + 2]]
		highestStr = string[i:i + 2]
print(highestStr)


n = int(input())
s = input()
freq = {}
for i in range(n):
	if i + 1 < n:
		S = s[i] + s[i + 1]
		freq[S] = freq.get(S, 0) + 1
mx = 0
ans = ''
for i in freq:
	if freq[i] > mx:
		mx = freq[i]
		ans = i
print(ans)


n = int(input())
string = list(input())
twoGrams = {}
i = 0
while i < n - 1:
	twoGram = string[i] + string[i + 1]
	keys = list(twoGrams.keys())
	if twoGram not in keys:
		twoGrams[twoGram] = 1
	else:
		twoGrams[twoGram] += 1
	i += 1
maxTwoGram = max(list(twoGrams.items()), key=lambda item: item[1])
print(maxTwoGram[0])


n = int(input())
a = input()
d = {}
for i in range(n - 1):
	if a[i:i + 2] not in d:
		d[a[i:i + 2]] = 1
	else:
		d[a[i:i + 2]] += 1
k = list(d.keys())
val = list(d.values())
print(k[val.index(max(val))])


length = int(input())
x = input()
l = list()
d = list()
i = 0
while i < len(x) - 1:
	l.append(x[i:i + 2])
	i += 1
for j in l:
	p = l.count(j)
	d.append((p, j))
print(max(d)[1])


from collections import Counter
x = int(input())
y = input()
substrings = [y[i:i + 2] for i in range(x - 1)]
the_two_gram_string = [z for (z, count) in Counter(substrings).most_common(1)]
print(the_two_gram_string[0])


n = int(input())
x = input()
d = {}
for i in range(n - 1):
	if x[i:i + 2] in d:
		d[x[i:i + 2]] += 1
	else:
		d[x[i:i + 2]] = 1
v = list(d.values())
k = list(d.keys())
print(k[v.index(max(v))])


import sys
sys.setrecursionlimit(10 ** 6)
debug_mode = True if len(sys.argv) > 1 and sys.argv[1] == '-d' else False
if debug_mode:
	import os
	inf = open(os.path.basename(__file__).replace('.py', '.in'))

	def input():
		return inf.readline()
from collections import defaultdict

def main():
	n = int(input().strip())
	s = input().strip()
	tg = defaultdict(int)
	for i in range(1, n):
		tg[s[i - 1:i + 1]] += 1
	print(max(tg, key=lambda key: tg[key]))
main()
if debug_mode:
	inf.close()


n = int(input())
k = input()
d = {}
for i in range(1, n):
	d[k[i - 1] + k[i]] = d.get(k[i - 1] + k[i], 0) + 1
c = 0
m = ''
for avt in sorted(d.keys()):
	if d[avt] > c:
		c = d[avt]
		m = avt
print(m)


l = int(input())
s = input()
a = []
c = []
for i in range(l - 1):
	st = s[i:i + 2]
	a.append(st)
for j in a:
	n = a.count(j)
	c.append(n)
m = max(c)
x = c.index(m)
print(a[x])


from sys import stdin
from collections import deque
n = int(stdin.readline())
s = stdin.readline()
dictt = {}
q = deque()
q.append(s[0])
q.append(s[1])
new = q.popleft()
if str(new + q[-1]) not in dictt:
	dictt[str(new + q[-1])] = 1
else:
	dictt[str(new + q[-1])] += 1
for i in range(2, n):
	q.append(s[i])
	new = q.popleft()
	if str(new + q[-1]) not in dictt:
		dictt[str(new + q[-1])] = 1
	else:
		dictt[str(new + q[-1])] += 1
K = max(dictt, key=dictt.get)
print(K)


from collections import defaultdict
n = int(input())
string = str(input())
mydict = defaultdict(int)
for i in range(len(string) - 1):
	temp = string[i] + string[i + 1]
	if temp not in mydict:
		mydict[temp] = 1
	else:
		mydict[temp] += 1
vals = list(mydict.values())
keys = list(mydict.keys())
print(keys[vals.index(max(vals))])


n = int(input())
s = input()
d = []
for i in range(len(s) - 1):
	d.append(s[i:i + 2])
ds = list(set(d))
cnt = [0 for i in range(len(ds))]
for i in range(len(ds)):
	for j in range(len(d)):
		cnt[i] += 1 if ds[i] == d[j] else 0
ans_cnt = 0
ans = -1
for i in range(len(ds)):
	if cnt[i] > ans_cnt:
		ans_cnt = cnt[i]
		ans = ds[i]
print(ans)


from collections import Counter

def read():
	return int(input())

def readlist():
	return list(map(int, input().split()))

def readmap():
	return map(int, input().split())
N = read()
S = input()
ls = []
for i in range(N - 1):
	ls.append(S[i:i + 2])
c = Counter(ls)
maxx = 0
for (k, v) in c.items():
	if v > maxx:
		maxx = v
		idx = k
print(idx)


n = int(input())
s = input()
a = []
b = []
for i in range(n - 1):
	if s[i:i + 2] not in a:
		a.append(s[i:i + 2])
		b.append(1)
	else:
		b[a.index(s[i:i + 2])] += 1
print(a[b.index(max(b))])


n = int(input())
s = input()
a = list()
b = [0] * (n - 1)
for i in range(1, n):
	a.append(s[i - 1] + s[i])
	if s[i - 1] + s[i] in a:
		b[a.index(s[i - 1] + s[i])] += 1
print(a[b.index(max(b))])


import sys
nk = sys.stdin.readline()
while nk:
	st = sys.stdin.readline().replace('\n', '')
	two_g = {}
	for i in range(len(st) - 1):
		tg = st[i] + st[i + 1]
		if tg in two_g:
			two_g[tg] += 1
		else:
			two_g[tg] = 1
	max_v = 0
	ans = ''
	for (k, v) in two_g.items():
		if v > max_v:
			ans = k
			max_v = v
	print(ans)
	nk = sys.stdin.readline()


n = int(input())
string = input()
patterns = []
for i in range(n - 1):
	patterns.append(string[i] + string[i + 1])
occurrences = len(patterns) * [0]
for i in range(len(patterns)):
	occurrences[i] = patterns.count(patterns[i])
maxi = max(occurrences)
print(patterns[occurrences.index(maxi)])


def compute(n, s):
	dic = {}
	most_common = ''
	for i in range(n - 1):
		cur = s[i:i + 2]
		if not cur in dic:
			dic[cur] = 1
		else:
			dic[cur] += 1
		if not most_common:
			most_common = cur
		elif dic[cur] > dic[most_common]:
			most_common = cur
	return most_common
n = int(input())
s = str(input())
print(compute(n, s))


n = int(input())
from collections import Counter
c = Counter()
s = input()
for i in range(n - 1):
	c[s[i:i + 2]] += 1
mx = max(c.values())
print([k for (k, v) in c.items() if v == mx][0])