N = int(input())

S = [input() for _ in range(N)]



import string 

letters=string.ascii_lowercase

dic = {}

def alpha(N,dic):

  for i in letters:

    dic[i] = [0] * N

alpha(N,dic)



for i in range(N):

  for j in range(len(S[i])):

    dic[S[i][j]][i] += 1

#print(dic)

ans = []

for i in letters:

  ans.append(i * min(dic[i]))

print(*ans,sep="")

N = int(input())

S = [input() for _ in range(N)]

dic = {}

X = sorted(list(set(S[0])))

for i in X:

  dic[i] = 51

for i in range(N):

  for x in X:

    dic[x] = min(dic[x],S[i].count(x))

for i in X:

  print(i * dic[i],end="")

N = int(input())
S = [input() for _ in range(N)]
import string

letters = string.ascii_lowercase
dic = {}


def alpha(N, dic):
    for i in letters:
        dic[i] = [0] * N


alpha(N, dic)
for i in range(N):
    for j in range(len(S[i])):
        dic[S[i][j]][i] += 1
# print(dic)
ans = []
for i in letters:
    ans.append(i * min(dic[i]))
print(*ans, sep="")

N = int(input())
S = [input() for _ in range(N)]
dic = {}
X = sorted(list(set(S[0])))
for i in X:
    dic[i] = 51
for i in range(N):
    for x in X:
        dic[x] = min(dic[x], S[i].count(x))
for i in X:
    print(i * dic[i], end="")

-import string - -letters = string.ascii_lowercase - - -def alpha(N, dic): -    for i in letters: -        dic[i] = [0] * N - - -alpha(N, dic) +X = sorted(list(set(S[0]))) +for i in X: +    dic[i] = 51 -    for j in range(len(S[i])): -        dic[S[i][j]][i] += 1 -# print(dic) -ans = [] -for i in letters: -    ans.append(i * min(dic[i])) -print(*ans, sep="") +    for x in X: +        dic[x] = min(dic[x], S[i].count(x)) +for i in X: +    print(i * dic[i], end="")