

from collections import defaultdict



N = int(eval(input()))

S = []

for i in range(N):

    S.append(input().rstrip())

    



dic = defaultdict(int)

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

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





for s in S[1:]:

    temp_dic = defaultdict(int)

    for i in range(len(s)):

        temp_dic[s[i]] += 1

        

    for k, v in list(dic.items()):

        dic[k] = min(v, temp_dic[k])

        

ans = ""

for k,v in list(dic.items()):

    ans = ans + k*v



ans = sorted(ans)

print(("".join(ans)))
N = int(eval(input()))

S = []

for i in range(N):

    S.append(eval(input()))

    

ALPHA = "abcdefghijklmnopqrstuvwxyz"



ans = ""

for a in ALPHA:

    count = 50

    for s in S:

        if s.count(a) < count:

            count = s.count(a)

    

    ans += a*count

    

print(ans)
from collections import defaultdict

N = int(eval(input()))
S = []
for i in range(N):
    S.append(input().rstrip())
dic = defaultdict(int)
for i in range(len(S[0])):
    dic[S[0][i]] += 1
for s in S[1:]:
    temp_dic = defaultdict(int)
    for i in range(len(s)):
        temp_dic[s[i]] += 1
    for k, v in list(dic.items()):
        dic[k] = min(v, temp_dic[k])
ans = ""
for k, v in list(dic.items()):
    ans = ans + k * v
ans = sorted(ans)
print(("".join(ans)))

N = int(eval(input()))
S = []
for i in range(N):
    S.append(eval(input()))
ALPHA = "abcdefghijklmnopqrstuvwxyz"
ans = ""
for a in ALPHA:
    count = 50
    for s in S:
        if s.count(a) < count:
            count = s.count(a)
    ans += a * count
print(ans)

-from collections import defaultdict - -    S.append(input().rstrip()) -dic = defaultdict(int) -for i in range(len(S[0])): -    dic[S[0][i]] += 1 -for s in S[1:]: -    temp_dic = defaultdict(int) -    for i in range(len(s)): -        temp_dic[s[i]] += 1 -    for k, v in list(dic.items()): -        dic[k] = min(v, temp_dic[k]) +    S.append(eval(input())) +ALPHA = "abcdefghijklmnopqrstuvwxyz" -for k, v in list(dic.items()): -    ans = ans + k * v -ans = sorted(ans) -print(("".join(ans))) +for a in ALPHA: +    count = 50 +    for s in S: +        if s.count(a) < count: +            count = s.count(a) +    ans += a * count +print(ans)