peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
N = int(input())
inputSet = set()

for i in range(N):
    a = input()
    try:
        inputSet.remove(a)
    except KeyError:
        inputSet.add(a)

print (len(inputSet))
# Judge status: Accepted
n = int(input())
spi = []
for i in range(n):
    s,p = input().split()
    p = 100-int(p)
    spi.append([s,p,i+1])
spi.sort()
for x in spi:print(x[-1])
# Judge status: Wrong Answer
n,k = [int(x) for x in input().split()]
x = [int(x) for x in input().split()]

if len(x) == 1:
    print(abs(x[0]))
else:
    ans = 10 ** 10
    for i in range(n-k):
        tmp = min(abs(x[i]), abs(x[i+k-1]))
        ans = min(ans,tmp+abs(x[i+k-1]-x[i]))
    print(ans)
# Judge status: Accepted
import math
L,R,d=map(int,input().split())
ans=0

for i in range(L,R+1):
    if i%d==0:
        ans+=1

print(ans)
# Judge status: Accepted
l, r, d = map(int, input().split())

a = (l-1) // d
b = r // d
print(b-a)
# Judge status: Accepted
import re
sin = input()
match = re.match(r"^(dream|dreamer|erase|eraser)+$",sin)
print("YES" if match else "NO")
# Judge status: Wrong Answer
import math
n, d = map(int, input().split())
x = []
ans = [i**2 for i in range(1, 40)]
for i in range(n):
    tmp = list(map(int, input().split()))
    x.append(tmp)
cnt = 0
sum_t = 0
for i in range(n):
    for j in range(i+1, n):
        sum_t = 0
        for k in range(d):
            sum_t += (x[i][k]-x[j][k])**2
        if sum_t in ans:
            cnt += 1


print(cnt)
# Judge status: Accepted
import queue

n, m = map(int, input().split())
link = [[] for i in range(n)]

for i in range(m):
  a, b = map(int, input().split())
  link[a - 1].append(b - 1)
  link[b - 1].append(a - 1)

mark = [-1 for i in range(n)]

q = queue.Queue()
q.put(0)

while not q.empty():
  i = q.get()
  for j in link[i]:
    if j != 0 and mark[j] == -1:
      mark[j] = i
      q.put(j)

flag = True
for i in range(1, n):
  if mark[i] == -1:
    flag = False

if flag:
  print("Yes")
  for i in range(1, n):
    print(mark[i] + 1)
else:
  print("No")
# Judge status: Wrong Answer
from math import factorial


x,y = map(int,input().split())
n = (x+y)/3
sa = abs(x-y)
c = (n-sa)//2


try:
    a = factorial(n) / factorial(r) / factorial(n - r)
    print(a%(10**9+7))
except:
    print(0)
# Judge status: Accepted
a,b,x=map(int,input().split())
cnt=0
#for i in range(a,b+1):
#  if i%x==0: cnt+=1
#print(cnt)

cnt1=b//x
cnt2=(a-1)//x
print(cnt1-cnt2)
# Judge status: Accepted
N, C, K = map(int, input().split())
T = [int(input()) for _ in range(N)]
T.sort()

# print(T)

bus = 1
org = T[0]
_count = 0

for t in T:

    if t - org <= K and _count < C:
        _count += 1
        # print('1- t:{}, org:{}, _count:{}, bus:{}'.format(t, org, _count, bus))
    else:
        bus += 1
        org = t
        _count = 1
        # print('2- t:{}, org:{}, _count:{}, bus:{}'.format(t, org, _count, bus))

print(bus)
# Judge status: Wrong Answer
#26 A - Prefix and Suffix
N = int(input())
s = list(input())
t = list(input())
s_rev = list(reversed(s))

cnt = N
for i in range(1,N+1):
    # s の部分文字列を後ろから取り出す
    tgt = list(reversed(s_rev[:i]))
    if tgt == t[:i]:
        cnt -= 1
    
if s == t:
    print(N)
else:
    ans = s[:cnt] + t
    print(len(ans))
# Judge status: Wrong Answer
import collections

S = input()
T = input()

print("Yes" if collections.Counter(S) == collections.Counter(T) else "No")
# Judge status: Wrong Answer
import collections

s = list(input())
counter_s = collections.Counter(s)
len_keys = len(counter_s.keys())
list_values = counter_s.values()
total = sum(list_values)
print(total - len_keys)
# Judge status: Accepted
def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

n = int(input())
print(len(list(filter(lambda x: len(make_divisors(x)) == 8, range(1, n + 1,2)))))
# Judge status: Accepted
K, N = map(int, input().split())
A = list(map(int, input().split()))
m = K + A[0] - A[N-1]
for i in range(N-1):
  d = A[i+1] - A[i]
  m = max([d, m])
print(K-m)
# Judge status: Wrong Answer
l = sorted(map(int,input().split()))[::-1]
a = l[0]
b = l[1]
c = l[2]
s = 0
s += a-b
c += (a-b)
if (a-c)%2==0:
  s += (a-c)//2
else:
  s += (a-c-1)//2+1
print(s)
# Judge status: Wrong Answer
n, k = [int(i) for i in input().split()]
s = list(input())
c, cnt = 0, 0
cnt = 0
if s[0] == 'L':
  cnt += 1
if s[-1] == 'R':
  cnt += 1
for i in range(n-1):
  if s[i] == 'R' and s[i+1] == 'L':
    c += 1
if c > 0:
  if c - k >= 0:
    c -= k
  else:
    c = 0
    cnt = 1
print(n - 2*c - cnt)
# Judge status: Accepted

x=int(input())

s=100

from itertools import count

for c in count(0):
    if s >= x:
        print(c)
        exit()
    s = int(s * 1.01)
# Judge status: Wrong Answer
N = int(input())
S = input()

W = [0]
E = [0]

for i in range(N): 
  s = S[i]
  if s == "W":
    W.append(W[-1] + 1)
    E.append(E[-1])
  else:
    W.append(W[-1])
    E.append(E[-1] + 1)

ans = float("inf")
for i in range(1, N):
  ans = min(ans, W[i-1] + (E[-1] - E[i-1]))
print(ans)
# Judge status: Accepted
n, m = map(int, input().split())
a = {int(input()) for _ in range(m)}

s = [1]*(n+1)

if 1 in a:
    s[1] = 0

for i in range(n-1):
    if i+2 in a:
        s[i+2] = 0
        continue
    s[i+2] = (s[i+1] + s[i]) % (10**9+7)
    
print(s[-1])
# Judge status: Accepted
h, a = map(int, input().split())
cnt = 0
while h > 0:
    cnt += 1
    h = h - a
print(cnt)
# Judge status: Accepted
n, m, x = map(int, input().split())
lst = [list(map(int, input().split())) for i in range(n)]
ans = float('inf')

for i in range(2**n):
  count = [0]*(m+1)
  for j in range(n):
      if (i >> j) & 1:
        for k in range(m+1):
          count[k] += lst[j][k]
  judge = True
  for j in range(1, m+1):
    if count[j] < x:
      judge = False
      break
  if judge:
    ans = min(ans, count[0])
if ans == float('inf'):
  print(-1)
else:
  print(ans)
# Judge status: Wrong Answer
#67 A - Multiple Array
N = int(input())
A, B = [],[]
for _ in range(N):
    a,b= map(int,input().split())
    A.append(a); B.append(b)
A = list(reversed(A))
B = list(reversed(B))

c = 0
for a,b in zip(A,B):
    if b == 1:
        continue
    # 前に押されたボタンの回数分足される
    a += c
    # c 回ボタンを押せば Ai は Bi の倍数になる
    c += b-(a%b)
print(c)
# Judge status: Accepted
import fractions

def prime_divs(n):
    divs = {}
    for i in range(2, int(n**.5)+1):
        while n % i == 0:
            if i not in divs:
                divs[i] = 0
            divs[i] += 1
            n //= i
    if n != 1:
      if n not in divs:
      	divs[n] = 0
      divs[n] += 1
    return divs

  
A, B = map(int, input().split())
print(len(prime_divs(fractions.gcd(A, B))) + 1)
# Judge status: Accepted
A = input()
B = input()
print(6-int(A)-int(B))
# Judge status: Wrong Answer
import bisect
n = int(input())
a = [int(input()) for _ in range(n)]

b = [a[-1]]
for i in range(n - 2, -1, -1):
    if b[-1] <= a[i]:
        b.append(a[i])
    else:
        b[bisect.bisect_left(b, a[i])] = a[i]

print(len(b))
# Judge status: Accepted
import math

a,b = map(int,input().split())

print(math.ceil((a+b)/2))
# Judge status: Accepted
n = int(input())
s = str(input())
left = s[0]
ans = 10**6
left = {}
left.setdefault('W',0)
left.setdefault('E',0)
right = {}
right.setdefault('E',0)
right.setdefault('W',0)
for i in range(n):
    right[s[i]] += 1
ans = 10**6
for i in range(n):
    right[s[i]] -= 1
    ans = min(ans,left['W']+right['E'])
    #print(left,right)
    left[s[i]] += 1
print(ans)
# Judge status: Accepted
N = int(input())
W = [i for i in map(int,input().split())]
res = 10**9
for i in range(N):
    L1 = W[0:i]
    L2 = W[i:N]
    if res > abs(sum(L1)-sum(L2)):
        res = abs(sum(L1)-sum(L2))
print(res)
# Judge status: Accepted
k = int(input())
a, b = (int(x) for x in input().split())
if b % k <= b - a:
    print("OK")
else:
    print("NG")
# Judge status: Accepted
N=int(input())
A=list(map(int,input().split()))

ans=[0]*N
for i in range(N):
    ans[A[i]-1]=i+1
print(*ans)
# Judge status: Accepted
import math
N = int(input())
x = int(math.sqrt(N))
for i in range(x,0,-1):
    if N % i == 0:
        y = N // i
        #print(y,i)
        ans = (i-1) + (y-1)
        break
print(ans)
# Judge status: Accepted
a, b, c = map(int, input().split())
d = a+b
e = a+c
f = b+c
print(min(d,e,f))
# Judge status: Accepted
import numpy as np
N = int(input())
MOD = 10**9 + 7
tmp = 1
for i in range(1, N+1):
    tmp *= i
    if tmp>=MOD:
        tmp %= MOD
print(tmp)
# Judge status: Accepted
n = int(input())
w = list(map(int, input().split()))
ans = float('inf')

for t in range(1, n):
    s1 = sum(w[:t])
    s2 = sum(w[t:])
    ans = min(abs(s1-s2), ans)

print(ans)
# Judge status: Accepted
l1 = [1,3,5,7,8,10,12]
l2 = [4,6,9,11]
l3 = [2]

x, y = map(int, input().split())

if x in l1 and y in l1:
    print('Yes')
elif x in l2 and y in l2:
    print('Yes')
elif x in l3 and y in l3:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
C = list(input())
C_ = sorted(C)

wr = rw = 0
for i in range(len(C_)):
    if C[i] != C_[i]:
        if C[i] == 'R' and C_[i] == 'W':
            rw += 1
        else:
            wr += 1

print(max(wr, rw))
# Judge status: Wrong Answer
# import math
# import statistics
#a=input()
#b,c=int(input()),int(input())
# c=[]
# for i in a:
#    c.append(i)
e1,e2,e3 ,e4= map(int,input().split())
#K = input()
# f = list(map(int,input().split()))
#g = [input() for _ in range(a)]

if e4%2==0:
    print(-(e1-e4))
elif e4%2==1:
    print(e1-e2)
elif abs(e1-e2)>=10**18:
    print("Unfair")
# Judge status: Accepted
S = input()
ans = []
for c in S:
    if c == "B":
        if ans:
            ans.pop()
    else:
        ans.append(c)
print("".join(ans))
# Judge status: Accepted
a,b,c = map(int, input().split())
print((a-c) // (b+c))
# Judge status: Wrong Answer
n = int(input())
a = int(input())
print(n)
mod = n % 500
if mod < a:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
import sys
sys.setrecursionlimit(200010)
def input():
    return sys.stdin.readline()[:-1]

def main():
    N, M = list(map(int,input().split()))
    G = [set([]) for k in range(N)]
    for i in range(M):
        A, B = set(map(int,input().split()))
        G[A-1].add(B-1)
        G[B-1].add(A-1)
    for e in G[0]:
        if e in G[N-1]:
            print("POSSIBLE")
            exit(0)
    print("IMPOSSIBLE")
if __name__ == '__main__':
    main()
# Judge status: Accepted
o = list(input())
e = list(input()) + [" "]
for x, y in zip(o, e): print(x + y, end="")
# Judge status: Accepted
line = ''
for _ in input():
    line += 'x'
print(line)
# Judge status: Accepted
x = int(input())
a = 100
for i in range(1, 3770):
    a *= 1.01
    a = int(a)
    if a >= x:
        print(i)
        exit()
# Judge status: Wrong Answer
def main():
    s_shaped_piece, c_shaped_piece = map(int, input().split())
    print((2 * s_shaped_piece + c_shaped_piece) // 4)


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
# coding:utf-8
s = input()
t = input()
ans = len(t)

for i in range(len(s) - len(t)):
    count = 0
    for j in range(0, len(t)):
        if s[i + j] != t[j]:
            count += 1
    ans = min(ans, count)

print(ans)
# Judge status: Accepted
n = int(input())
s = input()

ans = s.count('R')*s.count('G')*s.count('B')

c = 0
for i in range(n):
    for j in range(n):
        k = 2*j - i
        if 0 <= k <= n-1:
            if i < j and j < k:
                if s[i] != s[j] and s[j] != s[k] and s[i] != s[k]:
                    c += 1
print(ans-c)
# Judge status: Wrong Answer
import math
N = int(input())
n = N
amari = 0
for i in range (len(str(N))):
  amari += n % 10
  n = math.floor(n / 10)
if amari < 10:
  print(10+amari)
else:
  print(amari)
# Judge status: Accepted
N,K=map(int,input().split())
A=[int(i)-1 for i in input().split()]
def times(X,Y):
    return [X[Y[i]] for i in range(N)]
def exponen(X,n):
    if n==0:
        return [i for i in range(N)]
    if n==1:
        return X
    if n%2==0:
        Y=exponen(X,n//2)
        return times(Y,Y)
    if n%2==1:
        Y=exponen(X,n//2)
        return times(times(Y,Y),X)
B=exponen(A,K)
print(B[0]+1)
# Judge status: Accepted
#import numpy as np
#import functools
#import operator
#from itertools import combinations as comb
#from itertools import combinations_with_replacement as comb_with
#from itertools import permutations as perm
#import collections as C #most_common
#import math
#import sympy

N = int(input())
#N,K,d= map(int,input().split())
A = list(map(int,input().split()))
#S = str(input())
#T = str(input())
c=0

for i in range(1,N+1):
    if i%2!=0 and A[i-1]%2!=0:
        c+=1
print(c)
# Judge status: Accepted
a = list(map(int, input().split()))
a.sort()
print(a[0] * a[1] // 2)
# Judge status: Accepted
import math
N,D = map(int,input().split())
c = 0
for i in range (N):
  x, y = map(int,input().split())
  dis = x**2 + y**2
  if D >= math.sqrt(dis):
    c = c + 1
print(c)
# Judge status: Wrong Answer
import sys
stdin = sys.stdin
 
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))
 
p=[0]*3
p[0]=ns()
p[1]=ns()
p[2]=ns()
turn='A'
d={'A':0,'B':1,'C':2}
 
while(len(p[d[turn]])==0):
	tmp=p[d[turn]][0]
	p[d[turn]][0]=[]	
	turn=tmp
 
 
print(turn)
# Judge status: Accepted
N,M=[int(s) for s in input().split(" ")]
Ans1=M*(M-1)/2
Ans2=N*(N-1)/2
print(int(Ans1+Ans2))
# Judge status: Accepted
f = lambda:list(map(int,input().split()))
la = f()+f()+f()
sb = set()
n = int(input())
for i in range(n):
  b = int(input())
  if b in la:
    sb.add(la.index(b))
ls = [{0,1,2},{0,3,6},{0,4,8},{1,4,7},{2,4,6},{2,5,8},{3,4,5},{6,7,8}]
for s in ls:
  if s<=sb:
    print('Yes')
    break
else:
  print('No')
# Judge status: Accepted
n = int(input())
v = list(map(int,input().split()))
v.sort()
p = v[0]

for i in range(1,n):
    p = (p + v[i]) / 2

print(p)
# Judge status: Accepted
MOD=10**9+7
def gcd(x,y):
  if(x<y) :
    z=y
    y=x
    x=z
  if(y==0):
    return x
  return gcd(x%y,y)

def lcm(x,y):
  return x//gcd(x,y)*y

n=int(input())
a=list(map(int,input().split()))
l=1
for x in a:
  l=lcm(l,x)

ans=0
for x in a:
  ans += l//x
print(ans%MOD)
# Judge status: Accepted
a, b = map(int, input().split())

sum = 0
for i in range(b-a):
    sum += i

print(sum - a)
# Judge status: Wrong Answer
N=int(input())
s=0
for i in range(1,N+1):
    cnt=0
    for j in range(1,int(N**0.5)+1):
        if i%j==0:
            cnt+=1
    if (i**0.5).is_integer():
        s+=i*((cnt-1)*2+1)
    else:s+=i*cnt*2
print(s)
# Judge status: Accepted
s = input()
t = input()
print('Yes' if sorted(s) < sorted(t, reverse=True) else 'No')
# Judge status: Wrong Answer
a,b=map(int,input().split())
if a>9 or b>9:
  print(":(")
else:
  print("Yay!")
# Judge status: Accepted
s = input()

n = len(s)
a = (n - 1) // 2
b = (n + 3) // 2

s_reverse = s[::-1]

s_first = s[:a]
s_first_reverse = s_first[::-1]

s_second = s[b-1:]
s_second_reverse = s_second[::-1]

if s == s_reverse and s_first == s_first_reverse and s_second == s_second_reverse:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
#python3
import numpy as np
n=int(input())
a=np.array([int(i) for i in input().split()])
mod=int(1e9+7)
ans=0
for k in range(60):
  b = (a>>k)&1
  m = b.sum()
  ans += m*(n-m)*2**k
print(ans%mod)
# Judge status: Accepted
import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())

N, P = map(int, input().split())
A = list(map(int, input().split()))

dp = [0] * 5005
dp[0] = 1

for a in A:
    for i in range(5000, 0, -1):
        if i - a >= 0:
            dp[i] += dp[i - a]

print(sum(dp[i] for i in range(len(dp)) if i % 2 == P))
# Judge status: Accepted
A,B,N= map(int,input().split())


floor_num=[]

if N >=B:
    floor_num.append(int(A*(B-1)/B))
else:  

        floor_num.append(int(A*N/B))


print(max(floor_num))
# Judge status: Accepted
mod=10**9+7
N,K=list(map(int,input().split()))
if (N+K)%3==0 and N*2>=K and K*2>=N:
   A=max(N,K)-min(N,K)
   low=(min(N,K)-A)//3
   all_pt=low*2+A
else:
   print(0)
   exit()
up,down=1,1
for i in range(low):
   up=up*(all_pt-i)%mod
   down=down*(i+1)%mod
base=pow(down,mod-2,mod)
print(up*base%mod)
# Judge status: Wrong Answer
import sys
import bisect

readline = sys.stdin.readline
readlines = sys.stdin.readlines
ns = lambda: readline().rstrip() # input string
ni = lambda: int(readline().rstrip()) # input int
nm = lambda: map(int, readline().split()) # input multiple int 
nl = lambda: list(map(int, readline().split())) # input multiple int to list

n = ni()
l = sorted(nm())

print(l)
ans = 0
for i in range(n-2):
    for j in range(i+1, n-1):
        a = l[i]
        b = l[j]
        idx = bisect.bisect_left(l, a + b)
        if idx > j: ans += idx - j - 1
print(ans)
# Judge status: Wrong Answer
import math
x = int(input())
ans = round(x/1.08)
if x == math.floor(ans * 1.08):
    print(ans)
else:
    print(":(")
# Judge status: Wrong Answer
import bisect
n = int(input())
A = list(map(int, input().split()))
B= list(map(int, input().split()))
C= list(map(int, input().split()))
print(sum(bisect.bisect_left(A,b)*(n-bisect.bisect_right(C,b)) for b in B))
# Judge status: Accepted

def main():
    N, D = map(int, input().split())
    P =  [list(map(int, input().split())) for _ in range(N)]
    
    D2 = D**2
    count = 0
    for p in P:
        if p[0]**2 + p[1]**2 <= D2:
            count += 1

    print(count)

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
N = int(input())
cnts = [[0] * 10 for _ in range(10)]
ans = 0
for i in range(N):
    if i % 10 == 0:
        continue
    s = str(i)
    cnts[int(s[0])][int(s[-1])] += 1

for i in range(N):
    if i % 10 == 0:
        continue
    s = str(i)
    ans += cnts[int(s[-1])][int(s[0])]

print(ans)
# Judge status: Accepted
import sys
input = sys.stdin.readline

def main():
    N = int(input())
    S = input().strip()

    t = len(S) // 2
    if S[:t] == S[t:]:
        print('Yes')
    else:
        print('No')


if __name__ == "__main__":
    main()
# Judge status: Accepted
N = int(input())
AB = [tuple(map(int, input().split())) for i in range(N)]


AB.sort(key=lambda x: x[1])
t = 0
for a, b in AB:
    t += a
    if t <= b:
        continue
    else:
        print("No")
        exit(0)
print("Yes")
# Judge status: Accepted

def resolve():

    N,M=map(int,input().split())
    A=sorted(list(map(int,input().split())),reverse=True)

    val=sum(A)/(4*M)
    cnt=0
    for i in A:
        if i >=val:
            cnt+=1

    if cnt>=M:
        print('Yes')
    else:
        print('No')




resolve()
# Judge status: Accepted
N = int(input())
count = 0

for i in range(1, N+1):
    if len(str(i)) % 2 != 0:
        count = count + 1
print(count)
# Judge status: Accepted
l , r , d = map(int, input().split())
print(r//d-(l-1)//d)
# Judge status: Wrong Answer
import sys


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

a, b, c = inintm()

if a == b == c:
    print(-1)
    exit()

ans = 0

while a % 2 == b % 2 == c % 2 == 0:
    d = a
    e = b
    f = c
    a = e/2 + f/2
    b = d/2 + f/2
    c = d/2 + e/2
    ans += 1

print(ans)
# Judge status: Wrong Answer
n=int(input())
i=0
while n-2**i>0:
  i+=1
print(2**(i-1))
# Judge status: Accepted
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)

N = int(input())
A = list(map(lambda x: int(x)-1, input().split()))
dic = {}
for a in A:
    dic[a] = dic.get(a, 0)+1
for i in range(N):
    print(dic.get(i, 0))
# Judge status: Wrong Answer
from collections import deque
x,y=map(int,input().split())
citylist=deque([[] for x in range(x)])
inputlist=deque()
arucity=set()
for a in range(y):
    s,t=map(int,input().split())
    citylist[s-1].append(t)
    inputlist.append(s)
    inputlist.append(t)
    arucity.add(s)
for a in arucity:
    citylist[a-1].sort()
for b in range(y):
    e=inputlist.popleft()
    print("{:08}{:08}".format(e,(citylist[e-1].index(inputlist.popleft())+1)))
# Judge status: Accepted
a, b, k = map(int, input().split())
print(f"{max(a-k,0)} {max(b-max(k-a,0),0)}")
# Judge status: Accepted
import string
import collections
n = int(input())
res = ''
dic_lst = []
for i in range(n):
  w = collections.Counter(input())
  dic_lst.append(w)
for ch in string.ascii_lowercase:
  cc = 100
  for w in dic_lst:
    cc = min(cc, w[ch])
  res += ch * cc
print(res)
# Judge status: Accepted
w, h, n = map(int, input().split())
x1 = 0
y1 = 0
x2 = w
y2 = h
f = 0
for i in range(n):
    x, y, a = map(int, input().split())
    if a == 1:
        x1 = max(x, x1)
    elif a == 2:
        x2 = min(x, x2)
    elif a == 3:
        y1 = max(y, y1)
    elif a == 4:
        y2 = min(y, y2)
    
    if x1 >= x2 or y1 >= y2 or x2 <= 0 or y2 <= 0:
        f = 1
if f:
    print("0")
else:
    print((x2-x1)*(y2-y1))
# Judge status: Accepted
# C - Rectangle Cutting
W,H,x,y = map(int,input().split())
S = W*H

# H,W の中心と x,y の距離
distx = abs(W/2 - x)
disty = abs(H/2 - y)

if distx == disty == 0:
    ans = (S/2,1)
else:
    ans = (S/2,0)
print(*ans)
# Judge status: Accepted
# -*- coding: utf-8 -*-

def get_diff(T, A, x):
    temp = T - x * 0.006
    return abs(temp - A)


N = int(input())
T,A = map(int, input().split())
H_list = list(map(int, input().split()))

for i, h in enumerate(H_list):
    if i==0:
        diff_min = get_diff(T, A, h)
        diff_min_idx = i + 1
    else:
        diff = get_diff(T, A, h)
        if diff_min > diff:
            diff_min = diff
            diff_min_idx = i + 1 

print(diff_min_idx)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

money = 1000
for i in range(n - 1):
    if a[i+1] > a[i]:
        money = money % a[i] + money // a[i] * a[i+1]

print(money)
# Judge status: Wrong Answer
A,B,C = map(int,input().split())
print("Yes" if A<=C and C<=B else "No")
# Judge status: Accepted
from math import gcd

X = int(input())

def lcm(a, b):
	return a * b // gcd(a, b)

print(360 // gcd(X, 360))
# Judge status: Wrong Answer
y = [int(z) for z in input().split()]
l = [int(z) for z in input().split()]
d = [0]*(y[0]+1)
for i in range(1,y[0]+1):
      d[i] = d[i-1]+l[i-1]
      if (d[i]>y[1]):
            if (i==y[0]):
                  i+=1
            break
print(i)
# Judge status: Accepted
S = input()

compareStr = 'R' * len(S)

while len(compareStr) > 0:
    if compareStr in S:
        break
    compareStr = compareStr[:-1]

print(len(compareStr))
# Judge status: Accepted
dic = ["0","1","2","3","4","5","6","7","8","9"]

A,B = map(int,input().split())
S = list(input())

ok = True
for i in range(A):
    if not(S[i] in dic):
        ok=False

if S[A]!="-":
    ok=False

for i in range(A+1,A+B+1,1):
    if not(S[i] in dic):
        ok =False

print("Yes" if ok else"No")
# Judge status: Wrong Answer
from collections import defaultdict
N = int(input())
A = list(map(int,(input().split())))
c = defaultdict(lambda:0)
for i in A:
    c[i] += 1
p = []
for i in range(1,10**5-1):
    p.append(c[i]+c[i+1]+c[i+2])

print(max(p))
# Judge status: Accepted
num_l = [1, 2, 3]
num_l.remove(int(input()))
num_l.remove(int(input()))
print(num_l.pop())
# Judge status: Accepted
N = map(int, input()[::-1])
a, b = 0, 9
for n in N:
    a, b = min(n+a, n+b), min(11-n+a, 9-n+b)
print(min(a, b))
# Judge status: Accepted
S = input()

num_0 = S.count('0')
num_1 = S.count('1')

print(min(num_0, num_1)*2)
# Judge status: Accepted
a, b=map(int, input().split())
if(a >=6):
    print(b if a>=13 else b//2)
else:
    print(0)
# Judge status: Wrong Answer
x, a, b = map(int, input().split())
if abs(x - a) > abs(x - b):
    print("A")
else:
    print("B")