from collections import Counter

N = int(eval(input()))

D = {chr(x+97):100 for x in range(26)}

for i in range(N):

    C = Counter(eval(input()))

    for j in range(26):

        x = chr(j+97)

        D[x] = min(D[x],C[x])

Ans = ""

for i in range(26):

    x = chr(i+97)

    Ans += x*D[x]

print(Ans)
N = int(eval(input()))

S = []

for i in range(N):

    s = eval(input())

    S.append(s)



ans = []

chars = "abcdefghijklmnopqrstuvwxyz"

for c in chars:

    cnt = 999

    for i in range(N):

        cnt = min(cnt, S[i].count(c))

    for i in range(cnt):

        ans.append(c)



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

from collections import Counter

N = int(eval(input()))
D = {chr(x + 97): 100 for x in range(26)}
for i in range(N):
    C = Counter(eval(input()))
    for j in range(26):
        x = chr(j + 97)
        D[x] = min(D[x], C[x])
Ans = ""
for i in range(26):
    x = chr(i + 97)
    Ans += x * D[x]
print(Ans)

N = int(eval(input()))
S = []
for i in range(N):
    s = eval(input())
    S.append(s)
ans = []
chars = "abcdefghijklmnopqrstuvwxyz"
for c in chars:
    cnt = 999
    for i in range(N):
        cnt = min(cnt, S[i].count(c))
    for i in range(cnt):
        ans.append(c)
print(("".join(ans)))

-from collections import Counter - -D = {chr(x + 97): 100 for x in range(26)} +S = [] -    C = Counter(eval(input())) -    for j in range(26): -        x = chr(j + 97) -        D[x] = min(D[x], C[x]) -Ans = "" -for i in range(26): -    x = chr(i + 97) -    Ans += x * D[x] -print(Ans) +    s = eval(input()) +    S.append(s) +ans = [] +chars = "abcdefghijklmnopqrstuvwxyz" +for c in chars: +    cnt = 999 +    for i in range(N): +        cnt = min(cnt, S[i].count(c)) +    for i in range(cnt): +        ans.append(c) +print(("".join(ans)))