from collections import Counter

N = int(eval(input()))

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



C = []



for s in S:

  cnt = Counter()

  for cha in s:

    cnt[cha] += 1

  C.append(cnt)



merged = C[0]

for c in C:

  cnt = Counter()

  for (key1, value1) in list(merged.items()):

    for (key2, value2) in list(c.items()):

      if key1 == key2:

        cnt[key1] = min(value1, value2)

  merged = cnt



ans = ""



for (key, value) in list(merged.items()):

  ans += key * value



print(("".join(sorted(ans))))
from collections import Counter

N = int(eval(input()))

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



merged = S[0]

for s in S:

  merged &= s



ans = ""



for (key, value) in list(merged.items()):

  ans += key * value



print(("".join(sorted(ans))))
from collections import Counter

N = int(eval(input()))
S = [eval(input()) for i in range(N)]
C = []
for s in S:
    cnt = Counter()
    for cha in s:
        cnt[cha] += 1
    C.append(cnt)
merged = C[0]
for c in C:
    cnt = Counter()
    for (key1, value1) in list(merged.items()):
        for (key2, value2) in list(c.items()):
            if key1 == key2:
                cnt[key1] = min(value1, value2)
    merged = cnt
ans = ""
for (key, value) in list(merged.items()):
    ans += key * value
print(("".join(sorted(ans))))

from collections import Counter

N = int(eval(input()))
S = [Counter(eval(input())) for i in range(N)]
merged = S[0]
for s in S:
    merged &= s
ans = ""
for (key, value) in list(merged.items()):
    ans += key * value
print(("".join(sorted(ans))))

-S = [eval(input()) for i in range(N)] -C = [] +S = [Counter(eval(input())) for i in range(N)] +merged = S[0] -    cnt = Counter() -    for cha in s: -        cnt[cha] += 1 -    C.append(cnt) -merged = C[0] -for c in C: -    cnt = Counter() -    for (key1, value1) in list(merged.items()): -        for (key2, value2) in list(c.items()): -            if key1 == key2: -                cnt[key1] = min(value1, value2) -    merged = cnt +    merged &= s