from string import ascii_lowercase



n = int(eval(input()))

strings = [eval(input()) for _ in range(n)]

alphabets = [a for a in ascii_lowercase]



counts = []

for a in alphabets:

    for i in range(n):

        count = strings[i].count(a)

        if count == 0:

            break

        if i == 0:

            m = count

            continue

        m = min(m, count)

    else:

        counts.append((a, m))



ans = ''

for count in counts:

    ans += count[0] * count[1]



print(ans)

n = int(eval(input()))

strings = [eval(input()) for _ in range(n)]



chars = []

for s in strings:

    chars += list(set(s))



used_in_all = []

for c in set(chars):

    if chars.count(c) == n:

        used_in_all.append(c)



if not used_in_all:

    print('')

    exit()



used_in_all.sort()



counts = []



for c in used_in_all:

    for i in range(n):

        count = strings[i].count(c)

        if i == 0:

            m = count

        m = min(m, count)

    counts.append((c, m))



ans = ''

for c in counts:

    ans += c[0] * c[1]



print(ans)
from string import ascii_lowercase

n = int(eval(input()))
strings = [eval(input()) for _ in range(n)]
alphabets = [a for a in ascii_lowercase]
counts = []
for a in alphabets:
    for i in range(n):
        count = strings[i].count(a)
        if count == 0:
            break
        if i == 0:
            m = count
            continue
        m = min(m, count)
    else:
        counts.append((a, m))
ans = ""
for count in counts:
    ans += count[0] * count[1]
print(ans)

n = int(eval(input()))
strings = [eval(input()) for _ in range(n)]
chars = []
for s in strings:
    chars += list(set(s))
used_in_all = []
for c in set(chars):
    if chars.count(c) == n:
        used_in_all.append(c)
if not used_in_all:
    print("")
    exit()
used_in_all.sort()
counts = []
for c in used_in_all:
    for i in range(n):
        count = strings[i].count(c)
        if i == 0:
            m = count
        m = min(m, count)
    counts.append((c, m))
ans = ""
for c in counts:
    ans += c[0] * c[1]
print(ans)

-from string import ascii_lowercase - -alphabets = [a for a in ascii_lowercase] +chars = [] +for s in strings: +    chars += list(set(s)) +used_in_all = [] +for c in set(chars): +    if chars.count(c) == n: +        used_in_all.append(c) +if not used_in_all: +    print("") +    exit() +used_in_all.sort() -for a in alphabets: +for c in used_in_all: -        count = strings[i].count(a) -        if count == 0: -            break +        count = strings[i].count(c) -            continue -    else: -        counts.append((a, m)) +    counts.append((c, m)) -for count in counts: -    ans += count[0] * count[1] +for c in counts: +    ans += c[0] * c[1]