Snuke loves "paper cutting": he cuts out characters from a newspaper headline and rearranges them to form another string.  He will receive a headline which contains one of the strings S_1,...,S_n tomorrow. He is excited and already thinking of what string he will create. Since he does not know the string on the headline yet, he is interested in strings that can be created regardless of which string the headline contains.  Find the longest string that can be created regardless of which string among S_1,...,S_n the headline contains. If there are multiple such strings, find the lexicographically smallest one among them.
from collections import Counter
n=int(input())
s=[input() for i in range(n)]
ans=''
l='abcdefghijklmnopqrstuvwxyz'
for i in range(len(l)):
  c=10**9
  for j in range(n):
    c=min(c,s.count(l[i]))
  for j in range(c):
    ans+=l[i]
print(ans)
from collections import Counter
n=int(input())
s=[input() for i in range(n)]
ans=''
l='abcdefghijklmnopqrstuvwxyz'
for i in range(len(l)):
  c=10**9
  for j in range(n):
    c=min(c,s[j].count(l[i]))
  for j in range(c):
    ans+=l[i]
print(ans)