n = int(eval(input()))

S = "abcdefghijklmnopqrstuvwxyz"

C = [[0 for k in range(n)] for l in range(26)]

for k in range(n):

    t = eval(input())

    for e in t:

        C[ord(e)-97][k] += 1

ans = ""

for k in range(26):

    ans += S[k]*min(C[k])

print(ans)

from collections import Counter

N = int(eval(input()))

W = [Counter(eval(input())) for k in range(N)]

A = [100000]*26

S = "abcdefghijklmnopqrstuvwxyz"

for e in W:

    for s in S:

        A[ord(s)-97] = min(A[ord(s)-97],e[s])



ans = ""

for k in range(26):

    ans += S[k]*A[k]

print(ans)

n = int(eval(input()))
S = "abcdefghijklmnopqrstuvwxyz"
C = [[0 for k in range(n)] for l in range(26)]
for k in range(n):
    t = eval(input())
    for e in t:
        C[ord(e) - 97][k] += 1
ans = ""
for k in range(26):
    ans += S[k] * min(C[k])
print(ans)

from collections import Counter

N = int(eval(input()))
W = [Counter(eval(input())) for k in range(N)]
A = [100000] * 26
S = "abcdefghijklmnopqrstuvwxyz"
for e in W:
    for s in S:
        A[ord(s) - 97] = min(A[ord(s) - 97], e[s])
ans = ""
for k in range(26):
    ans += S[k] * A[k]
print(ans)

-n = int(eval(input())) +from collections import Counter + +N = int(eval(input())) +W = [Counter(eval(input())) for k in range(N)] +A = [100000] * 26 -C = [[0 for k in range(n)] for l in range(26)] -for k in range(n): -    t = eval(input()) -    for e in t: -        C[ord(e) - 97][k] += 1 +for e in W: +    for s in S: +        A[ord(s) - 97] = min(A[ord(s) - 97], e[s]) -    ans += S[k] * min(C[k]) +    ans += S[k] * A[k]