# immigrated
import sys
from string import ascii_letters
ascii_orders = sorted(ord(c) for c in ascii_letters)
n = int(input())
v1 = []
v2 = []
cnt = [[[0] * 128 for _ in range(128)] for _ in range(128)]
# cnt[i][j][k] = 文字ijkを部分列に含む文字列の個数
st1 = [0] * 128
st2 = [[0] * 128 for _ in range(128)]
for i, s in enumerate(sys.stdin.readlines()):
l = len(s)
v1.clear()
v2.clear()
for j, c in enumerate(s):
v = ord(c)
for u in v1:
if st2[u][v] == 0:
st2[u][v] = j + 1
v2.append((u, v))
if st1[v] == 0:
v1.append(v)
st1[v] = j + 1
for u, v in v2:
for b in v1:
if st2[u][v] < st1[b]:
cnt[u][v][b] += 1
st2[u][v] = 0
for b in v1:
st1[b] = 0
print(i, s, v1, v2)
print(st1)
# print('\n'.join(str([st2[i][j] for j in ascii_orders]) for i in ascii_orders))
print('\n'.join(str([cnt[i][j] for j in ascii_orders]) for i in ascii_orders))
m = 0
ret = [0] * 3
for i in ascii_orders:
for j in ascii_orders:
for k in ascii_orders:
if cnt[i][j][k] > m:
ret[0] = i
ret[1] = j
ret[2] = k
m = cnt[i][j][k]
print(''.join(chr(i) for i in ret))