import collections

n = int(eval(input()))

S = [list(eval(input())) for i in range(n)]



S.sort(key=lambda x: len(x))

table = collections.defaultdict(int)



len_s = len(S[0])

for i in range(1, n):

    for x in S[0]:

        if x in S[i]:

            S[i].pop(S[i].index(x))

        else:

            S[0].pop(S[0].index(x))



S[0].sort()

print(("".join(S[0])))

n = int(eval(input()))

S = [eval(input()) for i in range(n)]



alpha = "abcdefghijklmnopqrstuvwxyz"



count = [50]*26

for i, x in enumerate(alpha):

    for s in S:

        count[i] = min(count[i], s.count(x))

ans = []

for i, x in zip(count, alpha):

    ans.append(x*i)

print(("".join(ans)))

import collections

n = int(eval(input()))
S = [list(eval(input())) for i in range(n)]
S.sort(key=lambda x: len(x))
table = collections.defaultdict(int)
len_s = len(S[0])
for i in range(1, n):
    for x in S[0]:
        if x in S[i]:
            S[i].pop(S[i].index(x))
        else:
            S[0].pop(S[0].index(x))
S[0].sort()
print(("".join(S[0])))

n = int(eval(input()))
S = [eval(input()) for i in range(n)]
alpha = "abcdefghijklmnopqrstuvwxyz"
count = [50] * 26
for i, x in enumerate(alpha):
    for s in S:
        count[i] = min(count[i], s.count(x))
ans = []
for i, x in zip(count, alpha):
    ans.append(x * i)
print(("".join(ans)))

-import collections - -S = [list(eval(input())) for i in range(n)] -S.sort(key=lambda x: len(x)) -table = collections.defaultdict(int) -len_s = len(S[0]) -for i in range(1, n): -    for x in S[0]: -        if x in S[i]: -            S[i].pop(S[i].index(x)) -        else: -            S[0].pop(S[0].index(x)) -S[0].sort() -print(("".join(S[0]))) +S = [eval(input()) for i in range(n)] +alpha = "abcdefghijklmnopqrstuvwxyz" +count = [50] * 26 +for i, x in enumerate(alpha): +    for s in S: +        count[i] = min(count[i], s.count(x)) +ans = [] +for i, x in zip(count, alpha): +    ans.append(x * i) +print(("".join(ans)))