# ABC0 C - 怪文書 / Dubious Document

from collections import defaultdict

si = lambda: eval(input())

ni = lambda: int(eval(input()))

nm = lambda: list(map(int, input().split()))

nl = lambda: list(map(int, input().split()))



N = ni()

S = [eval(input()) for _ in range(N)]

ABC = set()

t = set()



for i,s in enumerate(S):

    if i == 0:

        for ss in s:

            ABC.add(ss)

            t.add(ss)

    else:

        ABC = ABC & t

        t = set()

        for ss in s:

            t.add(ss)

if len(ABC)==0:

    print('')

    exit()



ABC = list(ABC)

D = defaultdict(lambda: 10000)

for s in S:

    for abc in ABC:

        t = s.count(abc)

        D[abc] = min(t,D[abc])



ANS = ''

for k in D:

    ANS += k*D[k]



L = []

for ans in ANS:

    L.append(ans)



L.sort()

print((''.join(L)))

n=int(eval(input()))

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

c=[[0]*26 for i in range(n)]

a=[0]*26



for i,ss in enumerate(s):

    for sss in ss:

        c[i][ord(sss)-97]+=1



for i in range(26):

    tmp=10**9

    for j in range(n):

        tmp=min(tmp,c[j][i])

    a[i]=tmp



ans=[]

for i,aa in enumerate(a):

    t_str=chr(i+97)

    ans+=[t_str]*aa

ans.sort()

print((''.join(ans)))

# ABC0 C - 怪文書 / Dubious Document
from collections import defaultdict

si = lambda: eval(input())
ni = lambda: int(eval(input()))
nm = lambda: list(map(int, input().split()))
nl = lambda: list(map(int, input().split()))
N = ni()
S = [eval(input()) for _ in range(N)]
ABC = set()
t = set()
for i, s in enumerate(S):
    if i == 0:
        for ss in s:
            ABC.add(ss)
            t.add(ss)
    else:
        ABC = ABC & t
        t = set()
        for ss in s:
            t.add(ss)
if len(ABC) == 0:
    print("")
    exit()
ABC = list(ABC)
D = defaultdict(lambda: 10000)
for s in S:
    for abc in ABC:
        t = s.count(abc)
        D[abc] = min(t, D[abc])
ANS = ""
for k in D:
    ANS += k * D[k]
L = []
for ans in ANS:
    L.append(ans)
L.sort()
print(("".join(L)))

n = int(eval(input()))
s = [eval(input()) for i in range(n)]
c = [[0] * 26 for i in range(n)]
a = [0] * 26
for i, ss in enumerate(s):
    for sss in ss:
        c[i][ord(sss) - 97] += 1
for i in range(26):
    tmp = 10**9
    for j in range(n):
        tmp = min(tmp, c[j][i])
    a[i] = tmp
ans = []
for i, aa in enumerate(a):
    t_str = chr(i + 97)
    ans += [t_str] * aa
ans.sort()
print(("".join(ans)))

-# ABC0 C - 怪文書 / Dubious Document -from collections import defaultdict - -si = lambda: eval(input()) -ni = lambda: int(eval(input())) -nm = lambda: list(map(int, input().split())) -nl = lambda: list(map(int, input().split())) -N = ni() -S = [eval(input()) for _ in range(N)] -ABC = set() -t = set() -for i, s in enumerate(S): -    if i == 0: -        for ss in s: -            ABC.add(ss) -            t.add(ss) -    else: -        ABC = ABC & t -        t = set() -        for ss in s: -            t.add(ss) -if len(ABC) == 0: -    print("") -    exit() -ABC = list(ABC) -D = defaultdict(lambda: 10000) -for s in S: -    for abc in ABC: -        t = s.count(abc) -        D[abc] = min(t, D[abc]) -ANS = "" -for k in D: -    ANS += k * D[k] -L = [] -for ans in ANS: -    L.append(ans) -L.sort() -print(("".join(L))) +n = int(eval(input())) +s = [eval(input()) for i in range(n)] +c = [[0] * 26 for i in range(n)] +a = [0] * 26 +for i, ss in enumerate(s): +    for sss in ss: +        c[i][ord(sss) - 97] += 1 +for i in range(26): +    tmp = 10**9 +    for j in range(n): +        tmp = min(tmp, c[j][i]) +    a[i] = tmp +ans = [] +for i, aa in enumerate(a): +    t_str = chr(i + 97) +    ans += [t_str] * aa +ans.sort() +print(("".join(ans)))