import collections



n=int(eval(input()))

S=collections.Counter(list(eval(input())))

S0=list(S.items())

L=len(S0)

for i in range(L):

    S0[i]=list(S0[i])



for i in range(1,n):

    temp=list(eval(input()))

    for j in range(L):

        h=temp.count(S0[j][0])

        if h<S0[j][1]:

            S0[j][1]=h





ans=[]



for i in range(L):

    if S0[i][1]!=0:

        for j in range(S0[i][1]):

            ans.append(S0[i][0])



ans.sort()

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



n=int(eval(input()))



abc="abcdefghijklmnopqrstuvwxyz"



cnt=[[0]*n for _ in range(26)]



for i in range(n):

    temp=eval(input())

    for j in range(26):

        cnt[j][i]=temp.count(abc[j])



ans=[]



for i in range(26):

    for j in range(min(cnt[i])):

        ans.append(abc[i])



print(("".join(ans)))
import collections

n = int(eval(input()))
S = collections.Counter(list(eval(input())))
S0 = list(S.items())
L = len(S0)
for i in range(L):
    S0[i] = list(S0[i])
for i in range(1, n):
    temp = list(eval(input()))
    for j in range(L):
        h = temp.count(S0[j][0])
        if h < S0[j][1]:
            S0[j][1] = h
ans = []
for i in range(L):
    if S0[i][1] != 0:
        for j in range(S0[i][1]):
            ans.append(S0[i][0])
ans.sort()
print(("".join(ans)))

n = int(eval(input()))
abc = "abcdefghijklmnopqrstuvwxyz"
cnt = [[0] * n for _ in range(26)]
for i in range(n):
    temp = eval(input())
    for j in range(26):
        cnt[j][i] = temp.count(abc[j])
ans = []
for i in range(26):
    for j in range(min(cnt[i])):
        ans.append(abc[i])
print(("".join(ans)))

-import collections - -S = collections.Counter(list(eval(input()))) -S0 = list(S.items()) -L = len(S0) -for i in range(L): -    S0[i] = list(S0[i]) -for i in range(1, n): -    temp = list(eval(input())) -    for j in range(L): -        h = temp.count(S0[j][0]) -        if h < S0[j][1]: -            S0[j][1] = h +abc = "abcdefghijklmnopqrstuvwxyz" +cnt = [[0] * n for _ in range(26)] +for i in range(n): +    temp = eval(input()) +    for j in range(26): +        cnt[j][i] = temp.count(abc[j]) -for i in range(L): -    if S0[i][1] != 0: -        for j in range(S0[i][1]): -            ans.append(S0[i][0]) -ans.sort() +for i in range(26): +    for j in range(min(cnt[i])): +        ans.append(abc[i])