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.

-----Constraints-----
 - 1 \leq n \leq 50
 - 1 \leq |S_i| \leq 50 for every i = 1, ..., n.
 - S_i consists of lowercase English letters (a - z) for every i = 1, ..., n.

-----Input-----
Input is given from Standard Input in the following format:
n
S_1
...
S_n

-----Output-----
Print the lexicographically smallest string among the longest strings that satisfy the condition.
If the answer is an empty string, print an empty line.

-----Sample Input-----
3
cbaa
daacc
acacac

-----Sample Output-----
aac

The strings that can be created from each of cbaa, daacc and acacac, are aa, aac, aca, caa and so forth.
Among them, aac, aca and caa are the longest, and the lexicographically smallest of these three is aac.
[{"code": "# \u3072\u3063\u304f\u308a\u304b\u3048\u3059\u306e\u304b\u3068\u304a\u4fdd\u3063\u305f\u3089180\u5ea6\u53cd\u8ee2\u3060\u3063\u305f\nn = int(input())\nd = []\nfor _ in range(n):\n    s = list(input())\n    d.append(s)\n\nd = sorted(d, key=lambda dd: len(dd), reverse=True)\nbase = {}\nfor c in d[0]:\n    if c not in base:\n        base[c] = 1\n    else:\n        base[c] += 1\n\nfor s in d[1:]:\n    tmp = {}\n    for c in s:\n        if c not in tmp:\n            tmp[c] = 1\n        else:\n            tmp[c] += 1\n    for k, v in base.items():\n        if k in tmp and base[k] >= 1:\n            base[k] = min(base[k], tmp[k])\n        else:\n            base[k] = -1\nans = []\nfor k, v in base.items():\n    if v > 0:\n        ans.append(k * v)\nans = sorted(ans)\nans = \"\".join(ans)\nprint(ans)", "passed": true, "time": 0.14, "memory": 14204.0, "status": "done"}, {"code": "#!/usr/bin/env python3\n\n# from numba import njit\nfrom collections import Counter\n# input = stdin.readline\n\n# @njit\ndef solve(n,a):\n  alphabetLst = {}\n  for i in range(n):\n    # i\u756a\u76ee\u306e\u6587\u5b57\u5217\u306e\u4e2d\u306e\u6587\u5b57\u3092\u6570\u3048\u308b\n    d = Counter(a[i])\n    for c in (chr(ord(\"a\") + i) for i in range(26)):\n      if not c in d.keys():\n        alphabetLst[c] = 0\n      elif not c in alphabetLst.keys():\n        alphabetLst[c] = d[c]\n      elif d[c] < alphabetLst[c]:\n        alphabetLst[c] = d[c]\n\n\n  res = []\n  for k,v in alphabetLst.items():\n    res += [k]*v\n\n  return \"\".join(res)\n\ndef main():\n  N = int(input())\n  a = [input() for _ in range(N)]\n  print(solve(N,a))\n  return\n\ndef __starting_point():\n  main()\n__starting_point()", "passed": true, "time": 0.14, "memory": 14236.0, "status": "done"}, {"code": "n=int(input())\nl = [input() for i in range(n)]\nL = [[0]*26 for i in range(n)]\ns = ''\n\nfor i in range(n):\n    for j in l[i]:\n        L[i][ord(j)-97] += 1\n\nM = L[0]\nfor k in range(1,n):\n    for g in range(26):\n        M[g] = min(L[k][g],M[g])\n\nfor a in range(26):\n    for b in range(M[a]):\n        s += chr(a+97)\nprint(s)", "passed": true, "time": 0.15, "memory": 14092.0, "status": "done"}, {"code": "alphabet = [\"a\", \"b\", \"c\", \"d\", \"e\", \"f\", \"g\", \"h\", \"i\", \"j\", \"k\", \"l\", \"m\", \"n\", \"o\", \"p\", \"q\", \"r\", \"s\", \"t\", \"u\", \"v\", \"w\", \"x\", \"y\", \"z\"]\n\nkey = dict()\nfor a in alphabet:\n  key[a] = 50\n\nn = int(input())\nfor i in range(n):\n  x = input()\n  for a in alphabet:\n    key[a] = min(key[a], x.count(a))\n\nfor k, v in key.items():\n  for _ in range(v):\n    print(k, end=\"\") \nprint()", "passed": true, "time": 0.16, "memory": 14248.0, "status": "done"}, {"code": "n=int(input())\nL = [50]*26\nfor i in range(n):\n  S = input()\n  for i in range(26):\n    L[i] = min(L[i],S.count(chr(97+i)))\nans = \"\"\nfor i in range(26):\n  ans += chr(97+i)*L[i]\nprint(ans)", "passed": true, "time": 0.26, "memory": 14088.0, "status": "done"}, {"code": "n = int(input())\nS = []\nans = ''\n\nfor i in range(n):\n    S.append(str(input()))\n\ndata1 = []\ndata2 = []\n\nfor i in range(len(S[0])):\n    if not S[0][i] in data1:\n        data1.append(S[0][i])\n        data2.append(1)\n    else:\n        data2[data1.index(S[0][i])] += 1\n\nfor i in range(1, n):\n    for j in range(len(data1)):\n        data2[j] = min(data2[j], S[i].count(data1[j]))\n\nfor i in range(len(data1)):\n    ans += data1[i] * data2[i]\n\nprint((''.join(sorted(ans))))\n\n", "passed": true, "time": 0.17, "memory": 14116.0, "status": "done"}, {"code": "from collections import defaultdict\nfrom collections import deque\nfrom collections import Counter\nimport itertools\nimport math\n\ndef readInt():\n\treturn int(input())\ndef readInts():\n\treturn list(map(int, input().split()))\ndef readChar():\n\treturn input()\ndef readChars():\n\treturn input().split()\n\nn = readInt()\nsn = [list(input()) for i in range(n)]\n\nans = \"\"\nfor i in range(97,123):\n\tm = float(\"inf\")\n\tfor j in sn:\n\t\tm = min(m,j.count(chr(i)))\n\tans+=chr(i)*m\n\nprint(ans)", "passed": true, "time": 0.14, "memory": 14044.0, "status": "done"}, {"code": "n = int(input())\nS = [input() for _ in range(n)]\n\nalp = 'abcdefghijklmnopqrstuvwxyz'\ncount = [float('inf') for _ in range(len(alp))]\n\nfor s in S:\n    for i in range(len(alp)):\n        count[i] = min(count[i], s.count(alp[i]))\n\nans = ''\nfor i in range(len(alp)):\n    ans += alp[i] * count[i]\nprint(ans)", "passed": true, "time": 0.26, "memory": 14320.0, "status": "done"}, {"code": "from collections import defaultdict\nimport string\nn = int(input())\n\nal = defaultdict(int)\nold = defaultdict(int)\n\ns = input()\nfor j in s:\n  old[j] += 1\n  al[j] += 1\n\nfor i in range(n-1):\n  s = input()\n  d = defaultdict(int)\n  for j in s:\n    d[j] += 1\n  for k in string.ascii_lowercase:\n    al[k] = min(old[k], d[k], al[k])\n  old = d\nans = \"\"\nfor k in string.ascii_lowercase:\n  ans += k * al[k]\nprint(ans)", "passed": true, "time": 0.23, "memory": 14324.0, "status": "done"}, {"code": "n=int(input())\ntable=[100]*26\nfor i in range(n):\n    k=[0]*26\n    s=input()\n    for j in s:\n        k[ord(j)-97]+=1\n    for j in range(26):\n        table[j]=min(table[j],k[j])\nans=\"\"\nfor i in range(26):\n    ans+=chr(i+97)*table[i]\nprint(ans)", "passed": true, "time": 0.18, "memory": 14348.0, "status": "done"}, {"code": "n = int(input())\nA = list(\"abcdefghijklmnopqrstuvwxyz\")\nB = [50]*26\nfor i in range(n):\n    C = [0]*26\n    s = input()\n    s = sorted(s)\n    for j in range(len(s)):\n        for k in range(26):\n            if s[j] == A[k]:\n                C[k] += 1\n                break\n    for m in range(26):\n        B[m] = min(B[m],C[m])\n\nD = [] \nfor i in range(26):\n    D.append(A[i]*B[i])\nD.sort()\nprint(*D, sep = \"\")", "passed": true, "time": 0.27, "memory": 14196.0, "status": "done"}, {"code": "from collections import Counter\nn=int(input())\ns=[input() for _ in range(n)]\n\nls=[chr(i) for i in range(ord(\"a\"),ord(\"z\")+1)]\nli=[9999 for _ in range(ord(\"a\"),ord(\"z\")+1)]\n\nc=[]\nfor x in s:\n   c.append(Counter(x))\n\nfor x in c:\n    for i,y in enumerate(ls):\n        li[i]=min(x[y],li[i])\n\nres=\"\"\nfor i,x in enumerate(li):\n    res+=ls[i]*x\nprint(res)", "passed": true, "time": 0.15, "memory": 14152.0, "status": "done"}, {"code": "import string\nn = int(input())\n#a, b = map(int,input().split())\n#l = list(map(int,input().split()))\n#l = [list(map(int,input().split())) for i in range(n)]\nsl = [list(input()) for i in range(n)]\n\nalpha = list(string.ascii_lowercase)\n\ndic = {si: sl[0].count(si) for si in alpha}\n\nfor s in sl:\n    for ch in alpha:\n        dic[ch] = min(dic[ch], s.count(ch))\nans = ''\nfor ch in alpha:\n    for i in range(dic[ch]):\n        ans += ch\nprint(ans)\n", "passed": true, "time": 0.26, "memory": 14056.0, "status": "done"}, {"code": "N = int(input())\nlet = [0]*26\nS = input()\nfor a in range(len(S)):\n  let[ord(S[a])-ord(\"a\")] += 1\n    \nfor i in range(N-1):\n  S = input()\n  let_S = [0]*26\n  for j in range(len(S)):\n    let_S[ord(S[j])-ord(\"a\")] += 1\n  for k in range(26):\n    if let[k] > let_S[k]:\n      let[k] = let_S[k]\n\nans = \"\"\nfor l in range(26):\n  ans += chr(ord(\"a\")+l)*let[l]\n\nprint(ans)", "passed": true, "time": 0.18, "memory": 14320.0, "status": "done"}, {"code": "n = int(input())\ns = [input() for _ in range(n)]\nans = set(s[0])\nfor i in range(1,n): ans = ans & set(s[i])\ncnt = [0] * len(ans)\nans = sorted(list(ans))\nfor i in range(n):\n    for j in range(len(ans)):\n        if cnt[j] == 0: cnt[j] = s[i].count(ans[j])\n        else:cnt[j] = min(cnt[j], s[i].count(ans[j]))\n\nA = \"\"\nfor x,y in zip(ans,cnt):\n    A += x*y\nprint(A)", "passed": true, "time": 0.19, "memory": 14196.0, "status": "done"}, {"code": "n = int(input())\n\ndic = {chr(97 + i): 50 for i in range(26)}\n\nfor _ in range(n):\n    s = list(map(str, input()))\n    for key in dic:\n        dic[key] = min(dic[key], s.count(key))\n\n\nres = \"\"\nfor key in dic:\n    if dic[key] != 0:\n        res += key * dic[key]\n\nprint(res)", "passed": true, "time": 0.14, "memory": 14064.0, "status": "done"}, {"code": "from collections import Counter\nn = int(input())\ns = [''] * n\nfor i in range(n):\n\ts[i] = input()\n\nr = s[0]\nfor i in range(1, n):\n\tset_c = set(r) & set(s[i])\n\tif len(set_c) == 0:\n\t\tprint('')\n\t\treturn\n\tnext_r = ''\n\tcnt_r = Counter(r)\n\tcnt_s = Counter(s[i])\n\tfor c in set_c:\n\t\tnext_r += c * min(cnt_r[c], cnt_s[c])\n\tr = next_r\nprint(''.join(sorted(r)))", "passed": true, "time": 0.14, "memory": 14240.0, "status": "done"}, {"code": "n = int(input())\nS = [input() for _ in range(n)]\nC = [ [0]*26 for _ in range(n)]\nfor i in range(n):\n  for x in S[i]:\n    k = ord(x) - ord('a')\n    C[i][k] += 1\n\ncount = C[0]\nfor i in range(1, n):\n  for k in range(26):\n    count[k] = min(count[k], C[i][k])\n\nans = []\nfor k in range(26):\n  if count[k]:\n\t  ans.append(chr(ord('a') + k) * count[k])\nprint(*ans, sep='')  ", "passed": true, "time": 0.15, "memory": 14100.0, "status": "done"}, {"code": "n=int(input())\nabc='abcdefghijklmnopqrstuvwxyz'\ns=[]\nt=[51]*len(abc)\n#print(t)\nfor i in range(n):\n    u=input()\n    for j in range(len(abc)):\n        v=u.count(abc[j])\n        t[j]=min(t[j],v)\nans=''\nfor j in range(len(abc)):\n    ans+=t[j]*abc[j]\nprint(ans)", "passed": true, "time": 0.15, "memory": 14108.0, "status": "done"}, {"code": "N=int(input())\nS=[input() for _ in range(N)]\n\nF = [[0]*N for _ in range(26)]\n\nf1=lambda c: ord(c) - ord('a')\nf2=lambda c: chr(c+97)\n\n\nfor i in range(N):\n    for s in S[i]:\n        F[f1(s)][i]+=1\n        \nans=''\nfor i in range(26):\n    t=min(F[i])\n    if t!=0:\n        ans+=t*f2(i)\nprint(ans)", "passed": true, "time": 0.18, "memory": 14048.0, "status": "done"}, {"code": "n = int(input())\nalp = [input() for _ in range(n)]\nans = ''\n\nfor i in range(97, 123):\n    cnt = 1001001001\n    for s in alp:\n        cnt = min(cnt, s.count(chr(i)))\n    ans += chr(i)*cnt\n\nprint(ans)", "passed": true, "time": 0.39, "memory": 14060.0, "status": "done"}, {"code": "from collections import Counter\nn = int(input())\ns = [input() for i in range(n)]\nsc = [Counter(list(_s)) for _s in s]\n\nans = ''\nfor i in range(26):\n    cnt = float('inf')\n    for _sc in sc:\n        cnt = min(cnt, _sc[chr(ord('a')+i)])\n    ans+=chr(ord('a')+i)*cnt\nprint(ans)\n", "passed": true, "time": 0.14, "memory": 14052.0, "status": "done"}, {"code": "from collections import Counter\n\nn = int(input())\na2z='abcdefghijklmnopqrstuvwxyz'\nC = Counter(input())\nfor _ in range(1, n):\n    c = Counter(input())\n    for i in a2z:\n        C[i] = min(C[i], c[i])\n\nans = \"\"\nfor k, v in sorted(C.items()):\n    ans += k*v\nprint(ans)", "passed": true, "time": 0.14, "memory": 14132.0, "status": "done"}, {"code": "from collections import Counter\nn = int(input())\ncl = {chr(i):0 for i in range(97,123)}\ns = input()\nfor k in Counter(s).keys():\n  cl[k] = Counter(s)[k]\nfor i in range(n-1):\n  s = input()\n  for k in cl.keys():\n    if cl[k]!=0:\n      cl[k] = min(cl[k],Counter(s).get(k,0))\nans = []\nfor k,v in cl.items():\n  if v!=0:\n    for i in range(v):\n      ans.append(k)\nprint(''.join(sorted(ans)))", "passed": true, "time": 0.14, "memory": 14120.0, "status": "done"}, {"code": "import collections\nn = int(input())\ns = list(input())\ns_cnt = collections.Counter(s)\n\nfor i in range(n-1):\n  tmp = input()\n  for k in s_cnt:\n    s_cnt[k] = min(s_cnt[k],tmp.count(k))\n\ns_cnt=dict(sorted(s_cnt.items(), key=lambda x:x[0]))\nans = \"\"      \nfor k in s_cnt:\n  ans += k*s_cnt[k]\nprint(ans)", "passed": true, "time": 0.23, "memory": 14076.0, "status": "done"}, {"code": "n=int(input())\nc=list(input())\nfor i in range(n-1):\n    t=[]\n    s=list(input())\n    for j in c:\n        if j in s:\n            t.append(j)\n            s.remove(j)\n    c=t\nc.sort()\nprint(\"\".join(c))", "passed": true, "time": 0.14, "memory": 14176.0, "status": "done"}, {"code": "import collections as c\nn=[c.Counter(input()) for _ in range(int(input()))];r=n[0]\nfor i in range(1,len(n)): r=r&n[i]\nprint(*sorted([i*j for i,j in r.items()]),sep='')", "passed": true, "time": 0.14, "memory": 14068.0, "status": "done"}, {"code": "from collections import defaultdict\nn = int(input())\nnew_d = {}\nfor i in range(ord(\"a\"), ord(\"z\") + 1):\n    new_d[chr(i)] = 50\nfor _ in range(n):\n    old_d = new_d\n    s = input()\n    d = defaultdict(int)\n    for c in s:\n        if c not in old_d:\n            continue\n        d[c] += 1\n    new_d = {}\n    for c in d.keys():\n        new_d[c] = min(old_d[c], d[c])\nans = \"\"\nfor c, v in sorted(new_d.items()):\n    ans += c * v\nprint(ans)", "passed": true, "time": 0.14, "memory": 14208.0, "status": "done"}, {"code": "n = int(input())\n\na = [99] * 26\nfor i in range(n):\n    s = input()\n    tmp = [0] * 26\n    for c in s:\n        x = ord(c) - ord('a')\n        tmp[x] += 1\n    for j in range(26):\n        a[j] = min(a[j], tmp[j])\n\nfor i in range(26):\n    c = chr(i + ord('a'))\n    print(c * a[i], end='')\nprint()\n", "passed": true, "time": 0.14, "memory": 14244.0, "status": "done"}, {"code": "n = int(input())\nli = []\nfor i in range(n):\n    li.append(input())\n\nfor i in [chr(ord(\"a\") + j) for j in range(26)]:\n    print(i*min([li[k].count(i) for k in range(n)]), end = \"\")\n\nprint(\"\")\n", "passed": true, "time": 0.14, "memory": 14188.0, "status": "done"}, {"code": "N = int(input())\nfrom collections import Counter\nS = [Counter(input()) for _ in range(N)]\n\nx = S[0]\nfor i in range(1, N):\n    x = x & S[i]\n\nans = []\nfor k, v in x.items():\n    for i in range(v):\n        ans.append(k)\nans = sorted(ans)\nprint(\"\".join(ans))", "passed": true, "time": 0.14, "memory": 14260.0, "status": "done"}, {"code": "from collections import Counter\nn = int(input())\nS = [input() for _ in range(n)]\n\ncount = Counter(S[0])\nfor s in S[1:]:\n  c = Counter(s)\n  count = count & c\n  \nls = sorted(count.items())\n\nans = \"\"\nfor i, j in ls:\n  ans += i * j\n  \nprint(ans)", "passed": true, "time": 0.14, "memory": 14112.0, "status": "done"}, {"code": "n = int(input())\nl = []\nfor i in range(n):\n    l.append(sorted(input()))\nl.sort(key=len)\nans = []\nfor i in l[0]:\n    for j in range(1, n):\n        if i not in l[j]:\n            break\n        else:\n            l[j].remove(i)\n    else:\n        ans.append(i)\nprint(*ans, sep=\"\")", "passed": true, "time": 0.25, "memory": 14300.0, "status": "done"}, {"code": "n = int(input())\na = input()\nalphabet = {}\nfor i in a:\n    alphabet.update({i: a.count(i)})\nfor i in range(n-1):\n    b = input()\n    for j in alphabet:\n        alphabet[j] = min(alphabet[j], b.count(j))\nans = []\nfor i in alphabet:\n    ans += [i]*alphabet[i]\nprint((''.join(sorted(ans))))\n    \n    \n    \n", "passed": true, "time": 0.14, "memory": 14240.0, "status": "done"}, {"code": "# C - \u602a\u6587\u66f8\ndef main():\n    n = int(input())\n    ans = list(input())\n\n    \n    for _ in range(n-1):\n        s = list(input())\n        temp = []\n        for j in ans:\n            if j in s:\n                s.remove(j)\n                temp.append(j)\n        else:\n            ans = temp\n    else:\n        ans.sort()\n        print((''.join(ans)))\n\ndef __starting_point():\n    main()\n\n__starting_point()", "passed": true, "time": 0.2, "memory": 14240.0, "status": "done"}, {"code": "n = int(input())\ns = sorted([list(input()) for _ in range(n)], key=len)\n\nans = []\nfor i in s[0]:\n  t = float(\"inf\")\n  for j in s:\n    t = min(t, j.count(i))\n  ans.append(i*t)\nans = sorted(list(set(ans)))\nprint(\"\".join(ans))", "passed": true, "time": 0.14, "memory": 14100.0, "status": "done"}, {"code": "from collections import Counter\nn=int(input())\ns=Counter(input())\nfor i in range(n-1):\n    s&=Counter(input())\nprint(\"\".join(sorted(s.elements())))", "passed": true, "time": 0.48, "memory": 14084.0, "status": "done"}, {"code": "n=int(input())\ns=[100]*26\nfor i in range(n):\n    a=[0]*26\n    for j in list(input()):\n        a[ord(j)-97]+=1\n    for j in range(26):\n        s[j]=min(s[j],a[j])\nans=''\nfor i in range(26):\n    for j in range(s[i]):\n        ans=ans+chr(i+97)\nprint(ans)", "passed": true, "time": 0.14, "memory": 14112.0, "status": "done"}, {"code": "a = ord('a')\nn = int(input())\nmemory = [[0] * 26 for _ in range(n)]\n\nfor i in range(n):\n    for s in input():\n        memory[i][ord(s) - a] += 1\n\nans = ''\nfor i in range(26):\n    ans += min(memory[j][i] for j in range(n)) * chr(a + i)\n\nprint(ans)", "passed": true, "time": 0.14, "memory": 14348.0, "status": "done"}, {"code": "import string\n\nn = int(input())\n\nd = dict()\nfor c in string.ascii_lowercase:\n    d[c] = []\n\nfor _ in range(n):\n    s = input()\n    for c in string.ascii_lowercase:\n        if s.count(c) != 0:\n            d[c].append(s.count(c))\n\nans = \"\"\nfor k, v in d.items():\n    if len(v) == n:\n        ans += k * min(v)\n\nprint(ans)", "passed": true, "time": 0.19, "memory": 14216.0, "status": "done"}, {"code": "n = int(input())\ncnt = [[0] * n for i in range(26)]\n\nfor i in range(n):\n    s = input()\n    for j in range(len(s)):\n        x = ord(s[j]) - 97\n        cnt[x][i] += 1\n\nans = ''\nfor i in range(26):\n    ans += min(cnt[i]) * chr(i+97)\nprint(ans)", "passed": true, "time": 0.14, "memory": 14088.0, "status": "done"}, {"code": "def main():\n    n = int(input())\n    s_lst = [str(input()) for _ in range(n)]\n    alp = list('abcdefghijklmnopqrstuvwxyz')\n\n    lst = []\n    for i in range(n):\n        count_lst = [0] * 26\n        s = s_lst[i]\n        for j in range(len(s)):\n            s_alp = s[j]\n            count_lst[alp.index(s_alp)] += 1\n\n        lst.append(count_lst)\n\n    minimum_lst = [0] * 26\n    for i in range(26):\n        minimum_count = lst[0][i]\n        for j in range(n):\n            minimum_count = min(minimum_count, lst[j][i])\n\n        minimum_lst[i] = minimum_count\n\n    answer = ''\n    for i in range(26):\n        alphabet = alp[i] * minimum_lst[i]\n        answer += alphabet\n    print(answer)\n\n\ndef __starting_point():\n    main()\n__starting_point()", "passed": true, "time": 0.14, "memory": 14348.0, "status": "done"}, {"code": "n = int(input())\nS = [input().strip() for _ in range(n)]\nC = {chr(i):0 for i in range(97,123)}\nfor i in range(len(S[0])):\n    C[S[0][i]] += 1\nfor j in range(1,n):\n    C1 = {chr(i):0 for i in range(97,123)}\n    for i in range(len(S[j])):\n        C1[S[j][i]] += 1\n    for i in range(97,123):\n        C[chr(i)] = min(C[chr(i)],C1[chr(i)])\n        \nA = []\nfor i in range(97,123):\n    A.append(chr(i)*C[chr(i)])\nprint(\"\".join(sorted(A)))", "passed": true, "time": 0.22, "memory": 14116.0, "status": "done"}, {"code": "n=int(input())\nS=list(input() for _ in range(n))\n\nT=\"abcdefghijklmnopqrstuvwxyz\"\nfor c in T:\n    x=50\n    for s in S:\n        x=min(x,s.count(c))\n    print(c*x,end='')\nprint()\n", "passed": true, "time": 0.14, "memory": 14192.0, "status": "done"}, {"code": "N = int(input())\ns = [[0 for i in range(N)] for j in range(26)]\nfor i in range(N):\n    t = input()\n    for j in range(len(t)):\n        s[ord(t[j])-ord('a')][i] += 1\nans = ''\nfor j in range(26):\n    ans += chr(j+ord('a')) * min(s[j])\nprint(ans)", "passed": true, "time": 0.14, "memory": 14096.0, "status": "done"}, {"code": "from collections import Counter\nN = int(input())\n\ns = Counter(input())\nfor i in range(N-1):\n    s &= Counter(input())\nprint((''.join(sorted(s.elements()))))\n", "passed": true, "time": 0.19, "memory": 14144.0, "status": "done"}, {"code": "n = int(input())\njisho = 'abcdefghijklmnopqrstuvwxyz'\nmoji = []\n#print(moji)\nfor i in range(n):\n    dic = {}\n    for i in range(len(jisho)):\n        dic.setdefault(jisho[i],0)\n    s = str(input())\n    for j in range(len(s)):\n        dic.setdefault(s[j],0)\n        dic[s[j]] += 1\n    moji.append(dic)\ndic = {}\nfor j in range(len(jisho)):\n    tmp = 50\n    for i in range(n):\n        tmp = min(tmp,moji[i][jisho[j]])\n    if tmp != 0:\n        dic.setdefault(jisho[j],tmp)\n#print(dic)\nans = ''\nfor item in dic.items():\n    while dic[item[0]]>0:\n        ans += item[0]\n        dic[item[0]] -= 1\nprint(ans)", "passed": true, "time": 0.14, "memory": 14324.0, "status": "done"}, {"code": "n = int(input())\ns = list(input() for _ in range(n))\n\nalphabet = [[0] * n for _ in range(26)]\n\nfor i in range(n):\n    for x in s[i]:\n        alphabet[ord(x) % 97][i] += 1\n\nans = ''\nfor i in range(26):\n    m = min(alphabet[i])\n    if m != 0:\n        for _ in range(m):\n            ans += chr(i + 97)\n\nprint(ans)\n", "passed": true, "time": 0.15, "memory": 14172.0, "status": "done"}, {"code": "from collections import Counter\n\nn=int(input())\n\nabc='abcdefghijklmnopqrstuvwxyz'\n\nfor i in range(n):\n  if i==0:\n    c=Counter(input())\n  else:\n    c2=Counter(input())\n    for k in abc:\n        c[k]=min(c[k],c2[k])\n\nans=''\nfor k,v in sorted(c.items()):\n  ans+=k*v\n\nprint(ans)", "passed": true, "time": 0.15, "memory": 14240.0, "status": "done"}, {"code": "from collections import Counter\n\nn=int(input())\nINF = 10**20\n\nd={}\nfor i in range(97,123):\n  d[chr(i)] = INF\n\nfor i in range(n):\n  s = input()\n  c = Counter(s)\n  for k in d.keys():\n    if c.get(k):\n      d[k] = min(c[k],d[k])\n    else:\n      d[k] = 0\n    \nkeys=list(d.keys())\nfor k in keys:\n  if d[k] == INF:\n    del d[k]\n    \nans = []\nfor k in d.keys():\n  ans.extend([k]*d[k])\n  \nif len(ans)==0:\n  print('')\n  return\n  \nans = sorted(ans)\nprint(''.join(ans))", "passed": true, "time": 0.14, "memory": 14316.0, "status": "done"}, {"code": "from collections import Counter\n\nn = int(input())\nS = [input() for _ in range(n)]\n\nans = Counter(S[0])\n\nfor s in S[1:]:\n  ans = ans & Counter(s)\n\nprint(\"\".join(sorted([k * v for k, v in ans.items()])))", "passed": true, "time": 0.14, "memory": 14048.0, "status": "done"}, {"code": "import copy\nn = int(input())\ns = list(input())\n\nif n == 1:\n    s.sort()\n    print(*s, sep='')\nelse:\n    for _ in range(n-1):\n        tmp = ''\n        si = list(input())\n        if len(si) >= len(s):\n            for i in range(len(si)):\n                if si[i] in s:\n                    tmp += si[i]\n                    s[s.index(si[i])], si[i] = '', ''\n        else:\n            for i in range(len(s)):\n                if s[i] in si:\n                    tmp += s[i]\n                    si[si.index(s[i])], s[i] = '', ''\n        s = list(copy.deepcopy(tmp))\n    s.sort()\n    print(*s, sep='')", "passed": true, "time": 0.14, "memory": 14360.0, "status": "done"}, {"code": "n=int(input())\nd = {}\nfor i in range(26):\n  d[chr(ord(\"a\")+i)]=10**9\nfor i in range(n):\n  s=input()\n  for j in range(26):\n    d[chr(ord(\"a\")+j)]=min(d[chr(ord(\"a\")+j)], s.count(chr(ord(\"a\")+j)))\n\nans = \"\"\nfor e in list(d.items()):\n  ans+=e[0]*e[1]\nprint(ans)\n  \n  \n", "passed": true, "time": 0.14, "memory": 14168.0, "status": "done"}, {"code": "N = int(input())\nChrL = [[] for T in range(0,26)]\nfor NT in range(0,N):\n    S = input()\n    for ST in range(0,26):\n        ChrL[ST].append(S.count(chr(97+ST)))\nDisp = ['']*26\nfor ST in range(0,26):\n    Disp[ST] = chr(97+ST)*min(ChrL[ST])\nprint(''.join(Disp))", "passed": true, "time": 0.14, "memory": 14136.0, "status": "done"}, {"code": "alf=[\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\",\"h\",\"i\",\"j\",\"k\",\"l\",\"m\",\"n\",\"o\",\"p\",\"q\",\"r\",\"s\",\"t\",\"u\",\"v\",\"w\",\"x\",\"y\",\"z\"]\nn=int(input())\nli=[]\nans=[]\nSTR=\"\"\nfor h in range(n):\n    li.append([0]*26)\n\nfor i in range(n):\n    S=input()\n    for j in range(len(S)):\n        li[i][alf.index(S[j])]+=1\n\n\nfor k in range(26):\n    temp=1000000000000000000000000000000000000000000\n    for l in range(n):\n        if temp>li[l][k]:\n            temp=li[l][k]\n        \n    if temp!=1000000000000000000000000000000000000000000:\n        ans.append(temp)\n\nfor m in range(26):\n    STR=STR+alf[m]*ans[m]\nprint(STR)\n", "passed": true, "time": 0.14, "memory": 14216.0, "status": "done"}, {"code": "m=10**9\nn=int(input())\na='abcdefghijklmnopqrstuvwxyz'\npue=[]\nfor i in range(len(a)):\n    pue.append([a[i],m])\nfor i in range(n):\n    s=input()\n    for j in range(26):\n        pue[j][1]=min(s.count(a[j]),pue[j][1])\n\nans=''\nfor i in range(26):\n    for j in range(pue[i][1]):\n        ans+=a[i]\nprint(ans)", "passed": true, "time": 0.14, "memory": 14080.0, "status": "done"}, {"code": "N = int(input())\nINF = 10**12\nans = [INF] * 26\n\nfor _ in range(N):\n    S = input()\n    tmp = [0] * 26\n    for s in S:\n        tmp[ord(s)-ord('a')] += 1\n    \n    for i in range(26):\n        ans[i] = min(ans[i],tmp[i])\n\nansS = ''\nfor i in range(26):\n    ansS += chr(i+97) * ans[i]\n\nprint(ansS)", "passed": true, "time": 0.15, "memory": 14328.0, "status": "done"}, {"code": "N = int(input())\nfrom collections import Counter\nS = [Counter(list(input())) for _ in range(N)]\n\ndef intersection(X):\n    Res = X[0]\n    if len(X) == 1:\n        return Res\n    for x in X[1:]:\n        Res = {k:min(Res[k],x[k]) for k in Res if k in x}\n    return Counter(Res)\n\nprint((''.join(sorted(intersection(S).elements()))))\n", "passed": true, "time": 0.16, "memory": 14204.0, "status": "done"}, {"code": "import collections\nn = int(input())\nss = sorted([input() for i in range(n)], key=lambda x:len(x))\ns = ss[0]\npoplist = []\ncc = collections.Counter(s)\n\nfor i in range(1, n):\n  for c in cc:\n    if c in ss[i]:\n      cc[c] = min(cc[c], ss[i].count(c))\n    else:\n      if c not in poplist:\n        poplist.append(c)\n\nfor p in poplist:\n  dd = cc.pop(p)\n\nans = [x[0]*x[1] for x in cc.items()]\nans = ''.join(sorted(ans))\nprint(ans)", "passed": true, "time": 0.15, "memory": 14216.0, "status": "done"}, {"code": "import collections\nn = int(input())\nS = list(input())\ncounterA = collections.Counter(S)\nfor i in range(1,n):\n    counterB = collections.Counter()\n    S = list(input())\n    counterS = collections.Counter(S)\n    for j in counterA.keys():\n        if j in counterS:\n            counterB[j] = min(counterA[j],counterS[j])\n        else:\n            counterB[j] = 0\n    counterA = counterB\nls = []\nfor i in counterA.keys():\n    for j in range(counterA[i]):\n        ls.append(i)\nls.sort()\nans = ''.join(ls)\nprint(ans)", "passed": true, "time": 0.19, "memory": 14056.0, "status": "done"}, {"code": "#!/usr/bin/env python\n\nn = int(input())\ns = [input() for _ in range(n)]\n\nd = {}\nfor i in range(len(s[0])):\n    if s[0][i] not in d:\n        d[s[0][i]] = 1 \n    else:\n        d[s[0][i]] += 1\n\nfor i in range(n):\n    for key in list(d.keys()):\n        tmp = 0 \n        for k in range(len(s[i])):\n            if s[i][k] == key:\n                tmp += 1\n        if tmp <= d[key]:\n            d[key] = tmp \n\n# print('d =', d)\nd = sorted(list(d.items()), key=lambda x:x[0])\nans = ''\nfor i in range(len(d)):\n    for _ in range(d[i][1]):\n        ans += d[i][0]\nprint(ans)\n", "passed": true, "time": 0.14, "memory": 14376.0, "status": "done"}, {"code": "n = int(input())\nlst = []\nfor i in range(n):\n  lst.append(input())\nabc = [chr(ord('a') + i) for i in range(26)]\n#print(abc)###\ncnt = []\nfor s in abc:\n  temp = 100\n  for i in range(n):\n    temp = min(temp, lst[i].count(s))\n  cnt.append(temp)\n#print(cnt)###\nres = []\nfor i in range(26):\n  for j in range(cnt[i]):\n    res.append(abc[i])\nprint(''.join(res))", "passed": true, "time": 0.14, "memory": 14188.0, "status": "done"}, {"code": "n = int(input())\nd = {}\nfor i in range(n):\n    s = input()\n    for w in d:\n        if s.count(w)==0:\n            d[w]=0\n    for c in s:\n        if i==0:\n            d[c] = d.get(c, 0) + 1\n        else:\n            d[c] = min(d.get(c, 0), s.count(c))\n\nli = []\nfor w in d:\n    for i in range(d[w]):\n        li.append(w)\nli.sort()\nprint(\"\".join(li))", "passed": true, "time": 0.14, "memory": 14212.0, "status": "done"}, {"code": "from collections import Counter\n\nN = int(input())\nC = [Counter(input()) for _ in range(N)]\n# print(f'{C=}')\n\nword_set = set(C[0].keys())\nfor c in C:\n    word_set &= set(list(c.keys()))\n# print(f'{word_set=}')\n\nW = {key: 10**8 for key in word_set}\nfor c in C:\n    for word in word_set:\n        W[word] = min(W.get(word, 0), c.get(word, 0))\n# print(f'{W=}')\n\nans = ''\nfor key, value in list(W.items()):\n    ans += key * value\n# print(f'{ans=}')\nprint((''.join(sorted(ans))))\n", "passed": true, "time": 0.17, "memory": 14060.0, "status": "done"}, {"code": "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Tue Sep 29 14:54:30 2020\n\n@author: liang\n\"\"\"\n\nn = int(input())\nS = [input() for _ in range(n)]\n\nans = [100]*26\n\nfor i in range(n):\n    tmp = [0]*26\n    for s in S[i]:\n        key = ord(s)-ord('a')\n        if tmp[key] < ans[key]:\n            tmp[key] += 1\n    ans = tmp.copy()\n\nres = \"\"\nfor i in range(26):\n    res += chr(ord('a') + i)*tmp[i]\nprint(res)", "passed": true, "time": 0.14, "memory": 14356.0, "status": "done"}, {"code": "n=int(input())\nd={}\nfor i in range(n):\n    s=input()\n    d[i]={}\n    for c in s:\n        if c in d[i]:\n            d[i][c]+=1\n        else:\n            d[i][c]=1\n# print(d)\nk={chr(i)for i in range(97,123)}\nfor e in d:\n    k&=set(d[e].keys())\n# print(k)\nfor t in sorted(k):\n    m=float('inf')\n    for e in d:\n        m=min(m,d[e][t])\n    print(t*m,end='')\nprint('')\n", "passed": true, "time": 0.19, "memory": 14120.0, "status": "done"}, {"code": "from collections import Counter\nn = int(input())\nX = input()\npreC = Counter(X)\npreS = set(X)\nfor _ in range(n - 1):\n    X = input()\n    C = Counter(X)\n    preS = set(X) & preS\n    d = {}\n    for s in preS:\n        d[s] = min(C[s], preC[s])\n    preC = d\nans = []\nfor s in preS:\n    for _ in range(preC[s]):\n        ans.append(s)\nprint(\"\".join(sorted(ans)))", "passed": true, "time": 0.15, "memory": 14092.0, "status": "done"}, {"code": "from collections import Counter\n\n\ndef __starting_point():\n    C = Counter()\n    N = int(input())\n    for c in [chr(n) for n in range(ord(\"a\"), ord(\"z\")+1)]:\n        C[c] = 10**8\n    for _ in range(N):\n        cs = Counter(input())\n        C &= cs\n    for k, v in C.items():\n        print(k*v, end=\"\")\n    print()\n\n__starting_point()", "passed": true, "time": 0.23, "memory": 14164.0, "status": "done"}, {"code": "from collections import Counter\nfrom string import ascii_lowercase\nn = int(input())\ns = {ai:float(\"INF\") for ai in ascii_lowercase}\n\nfor i in range(n):\n    si = input()\n    c = Counter(si)\n    for k in ascii_lowercase:\n        s[k] = min(s[k],c[k])\n\nans = \"\"\nfor key in ascii_lowercase:\n    ans += key*s[key]\nprint(ans)", "passed": true, "time": 0.19, "memory": 14064.0, "status": "done"}, {"code": "from collections import defaultdict\n\nN = int(input())\nS = [input() for _ in range(N)]\n\nd = defaultdict(lambda: 50+1)\n\nfor i in range(N):\n    for c in range(ord(\"a\"), ord(\"z\")+1):\n        d[chr(c)] = min(d[chr(c)], S[i].count(chr(c)))\n\nans = \"\"\nfor key, value in d.items():\n    ans += key * value\n\nprint(ans)", "passed": true, "time": 0.14, "memory": 14272.0, "status": "done"}, {"code": "#75 C - \u602a\u6587\u66f8\nimport collections\nn = int(input())\nS = [input() for _ in range(n)]\n\ncnt = collections.Counter(S[0])\nfor s in S[1:]:#O (50)\n    for a in cnt.keys():# O(26)\n        if a in s:# O(50)\n            cnt[a] = min(cnt[a],s.count(a))# O(50)\n        else:\n            cnt[a] = 0\n            \nans = [key*value for key,value in cnt.items() if value > 0]\nans = sorted(ans,reverse = False)\nprint(''.join(ans))", "passed": true, "time": 0.14, "memory": 14100.0, "status": "done"}, {"code": "n=int(input())\nwords=[]\nfor i in range(n):\n  words.append(input())\n  \ns=words.pop()\nfor i in words:\n  ns=\"\"\n  l=list(i)\n  for j in s:\n    if j in l:\n      ns+=j\n      l.remove(j)\n  s=ns\ns=sorted(list(s))\nout=\"\"\nfor i in s:\n  out+=i\nprint(out)", "passed": true, "time": 0.14, "memory": 14244.0, "status": "done"}, {"code": "from collections import Counter\n\nn = int(input())\nl = []\nfor i in range(n):\n    l.append(dict(Counter(input())))\n\nl.sort(key=len)\n\nans = []\nfor ki, vi in l[0].items():\n    tmp = vi\n    for j in range(1, n):\n        if ki in l[j]:\n            tmp = min(tmp, l[j][ki])\n        else:\n            break\n    else:\n        ans.append(ki * tmp)\nans.sort()\nprint(*ans, sep=\"\")", "passed": true, "time": 0.14, "memory": 14124.0, "status": "done"}, {"code": "n = int(input())\ns1 = input()\nd = {}\n\nfor i in range(len(s1)):\n    if s1[i] in d:\n        d[s1[i]] += 1\n    else:\n        d[s1[i]] = 1\n\nfor i in range(n-1):\n    di = {}\n    s = input()\n    for i in range(len(s)):\n        if s[i] in di:\n            di[s[i]] += 1\n        else:\n            di[s[i]] = 1\n\n    delete = []\n    for key, value in d.items():\n        if key in di:\n            d[key] = min(value, di[key])\n        else:\n            delete.append(key)\n\n    for key in delete:\n        del d[key]\n\nans = \"\"\n\nfor key, value in sorted(d.items()):\n    ans += key*value\n\nprint(ans)", "passed": true, "time": 0.14, "memory": 14264.0, "status": "done"}, {"code": "n = int(input())\ns_l = [ input() for _ in range(n) ]\n\nd = {}\nfor i in list(s_l[0]):\n    if i in d.keys():\n        d[i] += 1\n    else:\n        d[i] = 1\nc_l = set(list(s_l[0]))\n\n\nfor s in s_l[1:]:\n    for c in list(c_l):\n        count = list(s).count(c)\n        if d[c] > count:\n            d[c] = count\n\nans = []\nfor k in list(c_l):\n    for _ in range(d[k]):\n        ans.append(k)\nans = sorted(ans)\nans2 = ''\nfor a in ans:\n    ans2 += a\nprint(ans2)", "passed": true, "time": 0.14, "memory": 14100.0, "status": "done"}, {"code": "n = int(input())\nd = {}\ns = input()\nfor c in set(s):\n    d[c] = s.count(c)\nfor _ in range(n-1):\n    s = input()\n    for c in d.keys():\n        d[c] = min(d[c], s.count(c))\nd_sorted = sorted(d.items(), key=lambda x:x[0])\nans = ''\nfor item in d_sorted:\n    ans += item[0]*item[1]\nprint(ans)", "passed": true, "time": 0.14, "memory": 14316.0, "status": "done"}, {"code": "n=int(input())\n\n\nalphabet_count={}\n\nalphabet=\"abcdefghijklmnopqrstuvwxyz\"\n\nfor alpha in alphabet:\n    alphabet_count[alpha]= 1000000000\n\nmojis=[]\nfor i in range(n):\n    mojis.append(input())\n\ndef get_count(moji):\n    alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n    alphabet_count = {}\n    for alpha in alphabet:\n        alphabet_count[alpha] = 0\n    for m in moji:\n        alphabet_count[m]+=1\n    return alphabet_count\n\n\n\n\nfor moji in mojis:\n    each_count=get_count(moji)\n    for alpha in alphabet:\n        alphabet_count[alpha]=min(alphabet_count[alpha],each_count[alpha])\n\nans=\"\"\n\nfor alpha in alphabet:\n    for i in range(alphabet_count[alpha]):\n        ans=ans+alpha\nprint(ans)\n\n\n\n\n", "passed": true, "time": 0.14, "memory": 14304.0, "status": "done"}, {"code": "import operator\nfrom collections import defaultdict\nfrom functools import reduce\n\nn = int(input())\narr = [input() for _ in range(n)]\nl = list(reduce(operator.and_, [set(i) for i in arr]))\nd = defaultdict(lambda: 1<<60)\nl.sort()\n\nfor s in arr:\n    for c in l:\n        cnt = s.count(c)\n        d[c] = min(d[c], cnt)\n\nres = []\nfor k, v in d.items():\n    res.append(k*v)\nans = \"\".join(res)\nprint(ans)", "passed": true, "time": 0.14, "memory": 14068.0, "status": "done"}, {"code": "from collections import defaultdict\nfrom collections import deque\nfrom collections import Counter\nimport itertools\nimport math\n\ndef readInt():\n\treturn int(input())\ndef readInts():\n\treturn list(map(int, input().split()))\ndef readChar():\n\treturn input()\ndef readChars():\n\treturn input().split()\n\nn = readInt()\nsn = [list(input()) for i in range(n)]\nsnc = [Counter(sn[i]) for i in range(n)]\n\ns = set(sn[0])\nfor i in range(n):\n\ts = s & set(sn[i])\n\ns = sorted(list(s))\nans = \"\"\nfor c in s:\n\tm = float(\"inf\")\n\tfor i in range(n):\n\t\tm = min(m, snc[i][c])\n\tans+=c*m\n\nprint(ans)", "passed": true, "time": 0.23, "memory": 14216.0, "status": "done"}, {"code": "from collections import Counter\nn=int(input())\ns=Counter(input())\nfor i in range(n-1):\n    s&=Counter(input())\nprint(\"\".join(sorted(s.elements())))", "passed": true, "time": 0.14, "memory": 14192.0, "status": "done"}, {"code": "n=int(input())\ndata=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']\ndict={}\nfor i in range(n):\n  a=input()\n  for j in data:\n    if j not in dict:\n      dict[j]=a.count(j)\n    else:\n      dict[j]=min(dict[j],a.count(j))\nans=[]\nfor i in dict:\n  ans.append(i*dict[i])\nprint(*ans,sep='')", "passed": true, "time": 0.14, "memory": 14268.0, "status": "done"}, {"code": "def main():\n  n = int(input())\n  s = [input() for i in range(n)]\n  nums = [1000 for i in range(26)]\n  for i in range(26):\n      for j in range(n):\n          nums[i] = min(nums[i],s[j].count((chr)(97 + i)))\n\n  for i in range(26):\n    while nums[i] > 0:\n        print((chr)(97 + i),end = \"\")\n        nums[i] -= 1\n  print(\"\")\n\nmain()", "passed": true, "time": 0.14, "memory": 14332.0, "status": "done"}, {"code": "from collections import Counter\n\nalph = 'abcdefghijklmnopqrstuvwxyz'\nn = int(input())\nS = [input() for _ in range(n)]\ncntS = [None] * n\nfor i in range(n):\n    cntS[i] = Counter(S[i])\n\nans = []\nfor c in alph:\n    ans += [c * min(cntS[i][c] for i in range(n))]\n\nprint(''.join(ans))", "passed": true, "time": 0.14, "memory": 14204.0, "status": "done"}, {"code": "n = int(input())\n\nalphabet_cnt = [[0] * n for i in range(26)]\n# [listA, listB, listC, ..., listZ]\n# listA = [0, 1, 3, 2, 1, 4, ...] -> the number of A in Si (only min val is needed)\nalphabet = list(\"abcdefghijklmnopqrstuvwxyz\")\nalphabet_map = dict(zip(alphabet, list(range(26))))\n\nfor i in range(n):\n  si = input()\n  for j in range(len(si)):\n    alphabet_cnt[alphabet_map[si[j]]][i] += 1\n\nalphabet_intersect = [min(alp) for alp in alphabet_cnt]\nprint(\"\".join([alphabet[idx] * cnt for idx, cnt in enumerate(alphabet_intersect)]))", "passed": true, "time": 0.14, "memory": 14100.0, "status": "done"}, {"code": "from collections import Counter\nn = int(input())\n\nD = Counter(list(input()))\nfor i in range(n-1):\n    d = Counter(list(input()))\n    key = D.keys()\n    for k in key:\n        D[k] = min(D[k], d[k])\n\nans = []\nkey = D.keys()\nfor k in key:\n    for i in range(D[k]):\n        ans.append(k)\nans.sort()\nprint(\"\".join(ans))", "passed": true, "time": 0.14, "memory": 14252.0, "status": "done"}, {"code": "ma = lambda :map(int,input().split())\nlma = lambda :list(map(int,input().split()))\ntma = lambda :tuple(map(int,input().split()))\nni = lambda:int(input())\nyn = lambda fl:print(\"Yes\") if fl else print(\"No\")\nimport collections\nimport math\nimport itertools\nimport heapq as hq\nimport sys\n\nn = ni()\ncnts = []\nfor i in range(n):\n    cnts.append(collections.Counter(list(input())))\nans=\"\"\nalp = list(\"abcdefghijklmnopqrstuvwxyz\")\nfor w in alp:\n    tmp=10**10\n    for i in range(n):\n        tmp = min(tmp,cnts[i][w])\n    ans+= w*tmp\nprint(ans)\n", "passed": true, "time": 0.14, "memory": 14160.0, "status": "done"}, {"code": "# \u8981\u7d20\u304c\u5165\u3063\u3066\u306a\u3044\u5834\u5408\u306e list.index \u306e\u5b9a\u7fa9\ndef myindex(l:list, element, default=-1):\n    if element in set(l):\n        return l.index(element)\n    else:\n        return default\n\ndef main():\n    n = int(input())\n    S = []\n    ans = ''\n    for _ in range(n):\n        S.append(list(input()))\n    \n    S.sort()\n    t = S.pop()\n    for i, u in enumerate(t):\n        okflag = True\n        for s in S:\n            if myindex(s, u) == -1:\n                okflag = False\n                break\n        if okflag:\n            for s in S:\n                s.pop(s.index(u))\n            ans += u\n    ans = sorted(ans)\n    print((''.join(ans)))\n\ndef __starting_point():\n    main()\n\n__starting_point()", "passed": true, "time": 0.14, "memory": 14220.0, "status": "done"}, {"code": "from copy import deepcopy\nn = int(input())\ns = [input() for _ in range(n)]\ncnt = []\n\nfor si in s:\n    tmp = [0] * 26\n    for i in range(len(si)):\n        tmp[ord(si[i])-97] += 1\n    if cnt == []:\n        cnt = deepcopy(tmp)\n    else:\n        for j in range(26):\n            cnt[j] = min(cnt[j], tmp[j])\n\nans = ''\nfor i in range(26):\n    for j in range(cnt[i]):\n        ans += chr(i+97)\nprint(ans)\n", "passed": true, "time": 0.14, "memory": 14096.0, "status": "done"}, {"code": "from collections import Counter\n\nn = int(input())\ns = Counter(input())\n\nfor i in range(n-1):\n    s &= Counter(input())\n\nres = \"\"\nfor char, count in s.items():\n    res += char*count\nprint(*sorted(res), sep=\"\")\n", "passed": true, "time": 0.14, "memory": 14160.0, "status": "done"}, {"code": "import collections\nn=int(input())\na=collections.Counter(input())\nfor i in range(n-1):\n    s=collections.Counter(input())\n    a=a&s\nans=\"\"\nk=list(a.keys())\nv=list(a.values())\nfor i,j in zip(k,v):\n    ans+=i*j\nprint((\"\".join(sorted(ans))))\n", "passed": true, "time": 0.14, "memory": 14316.0, "status": "done"}, {"code": "n = int(input())\nres_map = dict()\ns = input()\ntmp_map = dict()\nfor j in s:\n    if j not in tmp_map:\n        tmp_map[j] = 1\n    else:\n        tmp_map[j] += 1\nfor j in list(tmp_map.keys()):\n    res_map[j] = tmp_map[j]\n\nfor i in range(n - 1):\n    s = input()\n    tmp_map = dict()\n    for j in s:\n        if j not in tmp_map:\n            tmp_map[j] = 1\n        else:\n            tmp_map[j] += 1\n    for j in list(res_map.keys()):\n        if j in tmp_map:\n            res_map[j] = min(res_map[j], tmp_map[j])\n        else:\n            res_map[j] = 0\n\nres = \"\"\nfor i in list(res_map.keys()):\n    res += i * res_map[i]\n\nres = sorted(res)\nprint((\"\".join(res)))\n", "passed": true, "time": 0.14, "memory": 14144.0, "status": "done"}, {"code": "n=int(input())\nabc='abcdefghijklmnopqrstuvwxyz'\ns=[]\nt=[51]*len(abc)\n#print(t)\nfor i in range(n):\n    u=input()\n    for j in range(len(abc)):\n        v=u.count(abc[j])\n        t[j]=min(t[j],v)\nans=''\nfor j in range(len(abc)):\n    ans+=t[j]*abc[j]\nprint(ans)", "passed": true, "time": 0.14, "memory": 14132.0, "status": "done"}, {"code": "n = int(input())\nans = list(input())\nfor i in range(n-1):\n    s = list(input())\n    t = []\n    for j in ans:\n        if j in s:\n            s.remove(j)\n            t.append(j)\n    ans = t\nans.sort()\nprint(\"\".join(ans))", "passed": true, "time": 0.14, "memory": 14056.0, "status": "done"}]