Harryxun/stf_run huggingface dataset:
h_list = list(map(int, input().split())) #元リスト（変えない）
newlist = list(h_list) #変換用リスト
for i in range(m):
    a, b = map(int, input().split())
    if h_list[a-1] < h_list[b-1]:
        newlist[a-1] = 0
    elif h_list[a-1] > h_list[b-1]:
        newlistlist[b-1] = 0
    else:
        newlist[a-1] = 0
        newlist[b-1] = 0
print(len(h_list) - newlist.count(0))

### FIXED CODE ###

n,m = map(int, input().split())
h_list = list(map(int, input().split()))
newlist = list(h_list)
for i in range(m):
    a, b = map(int, input().split())
    if h_list[a-1] < h_list[b-1]:
        newlist[a-1] = 0
    elif h_list[a-1] > h_list[b-1]:
        newlist[b-1] = 0
    else:
        newlist[a-1] = 0
        newlist[b-1] = 0
print(len(h_list) - newlist.count(0))
N = int(input())
ac = 0
wa = 0
tle = 0
re = 0
for i in range(N):
    S = input()
    if S == AC:
        ac+=1
    elif S == "WA":
        wa += 1
    elif S== "TLE"
        tle += 1
    elif S == "RE"
        re += 1
print(f'AC x {ac}'' )
print(f'WA x {wa}'' )
print(f'TLE x {tle}'' )
print(f'RE x {re}'' )

### FIXED CODE ###

N = int(input())
ac = 0
wa = 0
tle = 0
re = 0
for i in range(N):
    S = input()
    if S == "AC":
        ac+=1
    elif S == "WA":
        wa += 1
    elif S== "TLE":
        tle += 1
    elif S == "RE":
        re += 1
print(f'AC x {ac}')
print(f'WA x {wa}')
print(f'TLE x {tle}' )
print(f'RE x {re}')
a, b = input().split()
print("H" if a == b else "D")aa

### FIXED CODE ###

a, b = input().split()
print("H" if a == b else "D")
def main():
    n = int(input())
    ab = [list(map(int, input().split())) for _ in [0]*(n-1)]
    g = [[] for _ in [0]*n]
    [g[a-1].append(b-1) for a, b in ab]
    [g[b-1].append(a-1) for a, b in ab]
    for root in range(n):
        if len(g[root]) > 2:
            break
    else:
        if n % 2:
            print("First")
        else:
            print("Second")
        return

    d = [-1]*n  # 根からの距離
    d[root] = 0
    q = [root]
    cnt = 0
    while q:  # BFS
        cnt += 1
        qq = []
        while q:
            i = q.pop()
            for j in g[i]:
                if d[j] == -1:
                    d[j] = cnt
                    qq.append(j)
        q = qq
    d2 = sorted([(j, i) for i, j in enumerate(d)])[::-1]
    dp = [[] for _ in [0]*n]
    for _, i in d2:
        if len(g[i]) > 2:
            continue
        elif len(g[i]) == 1:
            dp[g[i][0]].append(1)
        else:
            dist = dp[i][0]
            for j in g[i]:
                if d[j] < d[i]:
                    dp[j].append(dist+1)
    dp = [[j % 2 for j in i] for i in dp]
    for i in dp:
        if i.count(1) > 1:
            print("First")
            return
    print("Second")


main()


### FIXED CODE ###

def main():
    n = int(input())
    ab = [list(map(int, input().split())) for _ in [0]*(n-1)]
    g = [set() for _ in [0]*n]
    [g[a-1].add(b-1) for a, b in ab]
    [g[b-1].add(a-1) for a, b in ab]
    only = []
    sign = [False]*n
    for i in range(n):
        if len(g[i]) == 1:
            only.append(i)
    while only:
        i = only.pop()
        if not g[i]:
            print("Second")
            return
        j = g[i].pop()
        g[j].remove(i)
        if sign[i] and not g[j]:
            print("First")
            return
        if not sign[i] and sign[j]:
            print("First")
            return
        if not sign[j] and not sign[i]:
            sign[j] = True
        if len(g[j]) == 1:
            only.append(j)


main()
from math import gcd
from collections import defaultdict
def isPrimeMR(n):
    d = n - 1
    d = d // (d & -d)
    L = [2, 7, 61] if n < 1<<32 else [2, 3, 5, 7, 11, 13, 17] if n < 1<<48 else [2, 3, 5, 7, 11, 13, 17, 19, 23, 29]
    for a in L:
        t = d
        y = pow(a, t, n)
        if y == 1: continue
        while y != n - 1:
            y = (y * y) % n
            if y == 1 or t == n - 1: return False
            t <<= 1
    return True
def findFactorRho(n):
    m = 1 << n.bit_length() // 8 + 1
    for c in range(1, 99):
        f = lambda x: (x * x + c) % n
        y, r, q, g = 2, 1, 1, 1
        while g == 1:
            x = y
            for i in range(r):
                y = f(y)
            k = 0
            while k < r and g == 1:
                ys = y
                for i in range(min(m, r-k)):
                    y = f(y)
                    q = q * abs(x - y) % n
                g = gcd(q, n)
                k += m
            r <<= 1
        if g == n:
            while g == 1:
                ys = f(ys)
                g = gcd(abs(x-ys), n)
        if g < n:
            if isPrimeMR(g): return g
            elif isPrimeMR(n//g): return n//g
def primeFactor(N):
    i = 2
    ret = defaultdict(int)
    n = N
    mrFlg = 0
    while i*i <= n:
        k = 0
        while n % i == 0:
            n //= i
            k += 1
        if k: ret[i] = k
        i += 1 + i%2
        if i == 101 and n >= 2**20:
            while n > 1:
                if isPrimeMR(n):
                    ret[n], n = 1, 1
                else:
                    mrFlg = 1
                    j = findFactorRho(n)
                    k = 0
                    while n % j == 0:
                        n //= j
                        k += 1
                    ret[j] = k

    if n > 1: ret[n] = 1
    if mrFlg > 0: ret = {x: ret[x] for x in sorted(ret)}
    return ret
def main():
    c = [[0]*50 for _ in range(50)]
    r = 0
    for a in [*open(0)][1:]:
        p = primeFactor(round(float(a)*10**9))
        a, b = p[2], p[5]
        r += sum(sum(d[max(0,18-b):]) for d in c[max(0,18-a):])
        c[a][b] += 1
    print(r)
main()

### FIXED CODE ###

c=[[0]*50for _ in range(50)]
r=0
for a in[*open(0)][1:]:
  a=round(float(a)*10**9)
  x=y=0
  while a%2<1:
    a//=2
    x+=1
  while a%5<1:
    a//=5
    y+=1
  r+=sum(sum(d[max(0,18-y):])for d in c[max(0,18-x):])
  c[x][y]+=1
print(r)
N = int(input())
list = list(map(int, input().split()))
print("Yes" if max(list)*2 < sum(list) else "No"))

### FIXED CODE ###

N = int(input())
list = list(map(int, input().split()))
print("Yes" if 2*max(list) < sum(list) else "No")
n,k = map(int, input().split())
 
str = input()
happy = 0
unhappy = 0
 
for i in range(n-1):
  if(str[i] == str[i+1]):
    happy += 1
  else:
    unhappy += 1
if(str[0] != str[1] and str[n-1] != str[n-2] and k >= 2):
  print(happy + 2 * k - 2)
elif(str[n-1] != str[n-2] or str[0] != str[1]):
  print(happy + 2 * k - 1)
else:
  print(happy + 2 * k )

### FIXED CODE ###

n,k = map(int, input().split())
 
str = input()
happy = 0
unhappy = 0
 
for i in range(n-1):
  if(str[i] == str[i+1]):
    happy += 1
  else:
    unhappy += 1
print( min(n-1,(happy + 2 * k )))

# 10 1
# LLLLLRRRRRの時、happy + 2 * kだけやったら10になるけど、幸福になる人数は最高でも9人(n-1人)
# coding: utf-8

a=list(map(int,input().split()))
#読み込み
N = a[0]
M = a[1]
b=list(map(int,input().split()))
#総得票数
Sum_vote = sum(b)
list.sort(b, reverse=True)

if b[M] < (Sum_vote / 4 * M):
    print("No")
else :
    print("Yes")

### FIXED CODE ###

# coding: utf-8
 
a=list(map(int,input().split()))
#読み込み
N = a[0]
M = a[1]
 
b=list(map(int,input().split()))
#総得票数
Sum_vote = sum(b)
list.sort(b, reverse=True)

if b[M-1] < (Sum_vote /( 4 * M)):
    print("No")
else :
    print("Yes")
## coding: UTF-8
import math
s = input().split()
t = [int(p) for p in s]
#print(t)

A = t[0]
B = t[1]
C = t[2]

Gcd = math.gcd(A, B)
if(C % Gcd == 0):
    print("YES")
else:
    print("NO")

### FIXED CODE ###

## coding: UTF-8
from fractions import gcd
s = input().split()
t = [int(p) for p in s]
#print(t)

A = t[0]
B = t[1]
C = t[2]

#print(A)
#print(B)
Gcd = gcd(A, B)
#print(Gcd)

#print(C)

if(C % Gcd == 0):
    print("YES")
else:
    print("NO")
N=int(raw_input())
A=int(raw_input())
prom N*N-A

### FIXED CODE ###

N=int (raw_input())
A=int(raw_input())
print N*N-A
X = int(input())
dist = [0]
prev_dist = [0]
time = 0
while not X in dist:
    time += 1
    for i in prev_dist:
        if not i+time in dist: dist.append(i+time)
        if not i-time in dist: dist.append(i-time)
    prev_dist = dist[:]
print(time)

### FIXED CODE ###

key = tuple(input().split())
table = {("H", "H"): "H", ("H", "D"): "D",
         ("D", "H"): "D", ("D", "D"): "H"}
print(table[key])
from math import gcd
import math
a,b = map(int,input().split())

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

aa = make_divisors(a)
bb = make_divisors(b)

aaa = list(set(aa) & set(bb))

al = len(aaa)
count = 0



def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True


for i in range(al):
  if is_prime(aaa[i]):
    count += 1

print(count+1)




### FIXED CODE ###

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

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

aa = make_divisors(a)
bb = make_divisors(b)

aaa = list(set(aa) & set(bb))

al = len(aaa)
count = 0



def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True


for i in range(al):
  if is_prime(aaa[i]):
    count += 1

print(count+1)
import math

A,B=map(int,input().split())
gcd=math.gcd(A,B)
ans=1

if gcd > 1:
  for i in range(2,math.sqrt(gcd)//1 + 1):
    if gcd % i == 0:
      ans += 1
      while(gcd % i == 0):
        gcd /= i
print(ans)

### FIXED CODE ###

import fractions

A,B=map(int,input().split())
gcd=fractions.gcd(A,B)
ans=1

if gcd > 1:
  fact = 2
  tmp = gcd
  while(fact * fact <= gcd):
    if tmp % fact == 0:
      ans += 1
      while(tmp % fact == 0):
        tmp //= fact
    fact += 1
  if tmp > 1:
    ans += 1
print(ans)
import sys
from itertools import combinations, permutations, product, combinations_with_replacement, accumulate
from heapq import heapify, heappop, heappush, heappushpop
from bisect import bisect_left, bisect_right
#from collections import Counter, defaultdict, deque
from math import sqrt, log, floor, ceil, factorial, cos, sin, pi, gcd
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
INF = float('inf')
LINF = 2**63-1
NIL = -LINF
MOD = 10**9+7
MGN = 4
def II(): return int(input())
def IF(): return float(input())
def IS(): return str(input())
def ILCI(n: int): return [II() for _ in range(n)]
def ILCF(n: int): return [IF() for _ in range(n)]
def ILI(): return list(map(int, input().split()))
def ILLI(n: int): return [[int(j) for j in input().split()] for i in range(n)]
def ILF(): return list(map(float, input().split()))
def ILLF(n: int): return [[float(j) for j in input().split()] for i in range(n)]
def LTOS(lst: list, sep: str = ' '): return sep.join(map(str, lst))
def DEC(lst: list): return list(map(lambda x: x-1, lst))
def INC(lst: list): return list(map(lambda x: x+1, lst))


def main():
    S = IS()

    ans = "Yes"
    if S[0] == S[1] and S[1] == S[2]:
        ans = "No"
    
    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
INF = float('inf')
LINF = 2**63-1
NIL = -LINF
MOD = 10**9+7
MGN = 4
def II(): return int(input())
def IF(): return float(input())
def IS(): return str(input())
def ILCI(n: int): return [II() for _ in range(n)]
def ILCF(n: int): return [IF() for _ in range(n)]
def ILI(): return list(map(int, input().split()))
def ILLI(n: int): return [[int(j) for j in input().split()] for i in range(n)]
def ILF(): return list(map(float, input().split()))
def ILLF(n: int): return [[float(j) for j in input().split()] for i in range(n)]
def LTOS(lst: list, sep: str = ' '): return sep.join(map(str, lst))
def DEC(lst: list): return list(map(lambda x: x-1, lst))
def INC(lst: list): return list(map(lambda x: x+1, lst))


def main():
    S = IS()

    ans = "Yes"
    if S[0] == S[1] and S[1] == S[2]:
        ans = "No"
    
    print(ans)


if __name__ == '__main__':
    main()
isExist = [0]*2001 
n = int( input() )
q = int( input() )
for i in range( 0, q ):
	print( "yes" )

### FIXED CODE ###

def solve( p, t ):
	global isExist, n, A
	isExist[ t ] = True
	if p < n:
		solve( p+1, t-A[p] )
		solve( p+1, t )
	else:
		return

isExist = [False]*2001 
n = int( input() )
A = [ int( val ) for val in input().rstrip().split( ' ' ) ]
q = int( input() )
M = [ int( val ) for val in input().rstrip().split( ' ' ) ]
s = sum( A )
solve( 0, s )
for i in range( 0, q ):
	if isExist[ M[i] ]:
		print( "yes" )
	else:
		print( "no" )
n=int(input())
a=list(map(int, input().split()))
a_set=set(a)
a_uni=list(a_set)

kazu=[0]*(10*6+1)
for i in a_uni:
  for j in range(1,len(a_uni), i):
    kazu[j] += 1

count = 0
for i in a_uni:
  if kazu[i] == 1:
    count += 1
print(count)

### FIXED CODE ###

n=int(input())
a=list(map(int, input().split()))
kazu=[0]*(10**6+1)
for i in a:
  for j in range(i,10**6+1, i):
    if j > 10**6+1:
      break
    if kazu[i] >= 2:
      break
    kazu[j] += 1

count = 0
for i in a:
  if kazu[i] == 1:
    count += 1
print(count)
import sys
input = sys.stdin.readline

N, M = map(int,input().split())
work_list = [[] for j in range(M+1)]
for i in range(N):
    temp = list(map(int,input().split()))
    if temp[0] > M:
        continue
    work_list[temp[0]].append(temp[1])

sum = 0
works = []

for i in work_list:
    for j in i:
        heappush(works, -1*j)
    if len(works) == 0:
        continue
    sum -= (heappop(works))

print(sum)


### FIXED CODE ###

import sys
input = sys.stdin.readline
from heapq import heappop, heappush

N, M = map(int,input().split())
work_list = [[] for j in range(M+1)]
for i in range(N):
    temp = list(map(int,input().split()))
    if temp[0] > M:
        continue
    work_list[temp[0]].append(temp[1])

sum = 0
works = []

for i in work_list:
    for j in i:
        heappush(works, -1*j)
    if len(works) == 0:
        continue
    sum -= (heappop(works))

print(sum)
x, a = [int(n) for n in input().split()]
return 0 if x < a else 10

### FIXED CODE ###

x, a = [int(n) for n in input().split()]
print(0 if x < a else 10)
S = input()
T = input()
cnt = 0
for i in range(len(s)):
    if S[i]==T[i]:
        cnt += 1
print(cnt) 


### FIXED CODE ###

S = input()
T = input()
cnt = 0
for i in range(len(S)):
    if S[i]==T[i]:
        cnt += 1
print(cnt)
import math as m
a, b, h, m = map(int, input().split())
hd = h*30
md = m*6
hd += md//12
d = abs(hd - md)
cd = m.cos(d* m.pi//180)
print(round(m.sqrt(a*a + b*b - 2*a*b*cd)), 20)

### FIXED CODE ###

import math as mt
a, b, h, m = map(int, input().split())
hd = h*30
md = m*6
hd += md/12
d = abs(hd - md)
cd = mt.cos(d* mt.pi/180)
print(round(mt.sqrt(a*a + b*b - 2*a*b*cd), 20))
import math
from functools import reduce

n = int(input())

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

t = set()
for _ in range(n):
    t.add(int(input()))

print(lcm_list(t))

### FIXED CODE ###

from fractions import gcd
from functools import reduce

n = int(input())

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

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

t = set()
for _ in range(n):
    t.add(int(input()))

print(lcm_list(t))
n = int(input())

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

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

c = list(map(int, input().split()))

m = n-1
sumc = sum(c)
tmp = a[m]
if m > 1:
    sumc -= c[tmp-1]
ans = sum(b)
ans += sumc

print(ans)


### FIXED CODE ###


n = int(input())

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

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

c = list(map(int, input().split()))

m = n-1
ans = 0
for i in range(n):
    ans += b[a[i]-1]
    if (i>0)and(a[i] == a[i-1]+1):
        ans += c[a[i-1]-1]

print(ans)
n, k = map(int, input())

if k != 1:
    print(n-k)
else:
    print('0')

### FIXED CODE ###

n, k = map(int, input().split(' '))

if k != 1:
    print(n-k)
else:
    print('0')
s=int(input())
a=(s-s%1000)-(s%1000-s%100)
b=s%100
if a<=1200 and b<=12:
  print('AMBIGUOUS')
elif a<=1200 and b>12:
  print('MMYY')
elif a>12 and b<=12:
  print('YYMM')
elif a>12 and B>12:
  print('NA')

### FIXED CODE ###

s=int(input())
a=(s-s%1000)+(s%1000-s%100)
b=s%100
if 100<=a<=1200 and 1<=b<=12:
  print('AMBIGUOUS')
elif 100<=a<=1200 and b>12:
  print('MMYY')
elif a>1200 and 1<=b<=12:
  print('YYMM')
elif a==100 and b==0:
  print('MMYY')
elif a==0 and b==1:
  print('YYMM')
else:
  print('NA')
import numpy as np
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
B.sort()
C.sort()
M = np.array([[0 for _ in range(0, max(C)+1)] for _ in range(3)])
for i in range(N):
    M[0][A[i]] += 1
    M[1][B[i]] += 1
    M[2][C[i]] += 1
cum_M = np.cumsum(M, axis=1)
counter = 0
min_a = A[0]
max_c = C[-1]
for b in B:
    if min_a < b < max_c:
        counter += cum_M[0][b-1]*(cum_M[2][-1]-cum_M[2][b])
        
print(counter)


### FIXED CODE ###

import bisect
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
C.sort()
counter = 0
for b in B:
    counter += bisect.bisect_left(A, b)*(N-bisect.bisect_right(C, b))

print(counter)
print("vowel" if c in "aeiou" else "consonant")

### FIXED CODE ###

print("vowel" if input() in "aeiou" else "consonant")
def calc():
    ans = r + g + b
    
    if ans%4 == 0:
        return "YES"
    
    else:
        return "NO"
 
r, g, b = list(map(int, input()))
print(calc)


### FIXED CODE ###

def calc():
    ans = (r*100 + g*10 + b)
    
    if ans%4 == 0:
        return "YES"
    
    else:
        return "NO"
 
r, g, b = map(int, input().split())
print(calc())
x, a, b = map(int, input().split())
if a <= b:
    print('delicious')
else:
    if b - a <= x:
    print('safe')
    else:
        print('dangerous')

### FIXED CODE ###

x, a, b = map(int, input().split())
if b <= a:
    print('delicious')
elif b - a <= x:
    print('safe')
else:
    print('dangerous')
a = int(input())
b = input()
print(a.count('ABC'))


### FIXED CODE ###

a = int(input())
b = input()
print(b.count('ABC'))
def pred(W, H, x, y, r)
    if x - r < 0 or y - r < 0 or x + r > W or y + r > H:
        return False
    else:
        return True

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

print("Yes" if pred(*a) else "No")

### FIXED CODE ###

def pred(w, h, x, y, r):
    if x - r < 0 or y - r < 0 or x + r > w or y + r > h:
        return False
    else:
        return True

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

print("Yes" if pred(*a) else "No")
C=[0]*100002
for i in map(int,input().split()):
  C[i-1],C[i],C[i+1]+=1
print(max(C))

### FIXED CODE ###

input()
C=[0]*100002
for i in map(int,input().split()):
  C[i-1]+=1
  C[i]+=1
  C[i+1]+=1
print(max(C))
n = int(input())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]

total = sum(b)
last_dish = a[0]
for d in a[1:]:
	if d-last_dish == 1:
    	total += c[last_dish-1]
	last_dish = d
print(total)

### FIXED CODE ###

n = int(input())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]
total = sum(b)
last_dish = a[0]
for d in a[1:]:
  if d-last_dish == 1:
    total += c[last_dish-1]
  last_dish = d
print(total)
# -*- Coding: utf-8 -*-

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

if k == 0:
    print('{0} {1}'.format(a,b))
    exit(1)

if k >= a:
    k = k-a
    a = 0
else:
    a = a - k

if k == 0:
    print('{0} {1}'.format(a,b))
    exit(1)
else:
    if k >= b:
        b = 0
        print('{0} {1}'.format(a,b))
        exit(1)
    else:
        b = b - k
        print('{0} {1}'.format(a,b))

### FIXED CODE ###

# -*- Coding: utf-8 -*-

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

if k >= (a+b):
    print('{0} {1}'.format(0,0))
elif k < a:
    print('{0} {1}'.format(a-k, b))
elif k >= a:
    print('{0} {1}'.format(0, b-(k-a)))
s=int(input())
flag=True
if s<=10**9:
  a=1;b=s;c=0
else:
  a=b=int(s**(1/2))
  c = s-a**2
  d = 1
  if c>10**9:
    sc=int(c**(1/2))
    for i in range(sc,c):
      if c%i==0:
        d=i;c=c//i
        break
li = [0,0,a,d,c,b]
for num in li:
  print(num,end=" ")

### FIXED CODE ###

s = int(input())
if s==10**18:
  print(0,0,10**9,0,0,10**9)
else:
  print(0,0,s//10**9+1,1,10**9-s%10**9,10**9)
w=str(input())
s=''
while True:
	s=w[0]
	if w.count(s)%2==1:
		print('No')
		break
	w.replane(s,'')
	if w:
		print('Yes')
		break

### FIXED CODE ###

w=input()
a='Yes'
s='qwertyuiopasdfghjklzxcvbnm'
for i in range(26):
	if w.count(s[i])%2!=0:
		a='No'
		break
print(a)
# 怪文書 / Dubious Document
n = int(input())
s=[]
for i in range(n):
    s.append(input())
ans = ""
ls = sorted(s[0])
for l in ls:
    if ( sum([l in s[i+1] for i in range(n-1)])//(n-1) ) :
        ans += l
        ls = ls[1:]
print(ans)        

### FIXED CODE ###

# 怪文書 / Dubious Document
n = int(input())
s=[]
for i in range(n):
    s.append(input())
ls = sorted(list(set(s[0])))
ans = ""
for l in ls:
    cnt = min ([s[i].count(l) for i in range(n)] )
    ans += l*cnt
print(ans)
n, q = map(int, inp().split())
s = inp()
a = []

for i in range(n - 1):
    if s[i:i+2] == 'AC':
        a.append(1)
    else:
        a.append(0)

for _ in range(q):
    l, r = map(int, inp().split())
    print(sum(a[l-1:r-1]))

### FIXED CODE ###

b = input()
d = {'A': 'T', 'T': 'A', 'G': 'C', 'C': 'G'}
print(d[b])
# coding=utf-8
from math import floor, ceil, sqrt, factorial, log, gcd, log10
from itertools import accumulate, permutations, combinations, product, combinations_with_replacement, chain
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heappushpop, heapify
from copy import copy, deepcopy
import sys
INF = float('inf')
mod = 10**9+7
sys.setrecursionlimit(10 ** 6)


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

# 1 2 3
# a, b, c = LI()


def LI(): return list(map(int, sys.stdin.buffer.readline().split()))

# a = I()


def I(): return int(sys.stdin.buffer.readline())

# abc def
# a, b = LS()


def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()

# a = S()


def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')

# 2
# 1
# 2
# [1, 2]


def IR(n): return [I() for i in range(n)]

# 2
# 1 2 3
# 4 5 6
# [[1,2,3], [4,5,6]]


def LIR(n): return [LI() for i in range(n)]

# 2
# abc
# def
# [abc, def]


def SR(n): return [S() for i in range(n)]

# 2
# abc def
# ghi jkl
# [[abc,def], [ghi,jkl]]


def LSR(n): return [LS() for i in range(n)]

# 2
# abcd
# efgh
# [[a,b,c,d], [e,f,g,h]]


def SRL(n): return [list(S()) for i in range(n)]


# https://qiita.com/greenteabiscuit/items/31c46ab3ceac07e749d2


n, m = LI()
graph = [[] for _ in range(m)]
v = [False for _ in range(n)]


for i in range(m):
    a, b = LI()
    graph[a - 1].append(b)
    graph[b - 1].append(a)

def dfs(now, depth):
    if v[n - 1]:
        return 0
    if depth == m-1:
        return 1
    ans = 0
    v[now - 1] = True
    for node in graph[now - 1]:
        ans += dfs(node, depth+1)

    v[now - 1] = False
    # ここが大事.上で探索の一つが終わるからリセットしている.

    return ans

print(dfs(1, 0))


### FIXED CODE ###

#Nはノード数、Mはエッジ数
N, M = map(int, input().split())

path_matrix = []

#無向行列の初期化
for n in range(N):
    path_matrix.append([False] * N)

#まず無向グラフを表す行列を作る
for m in range(M):
    line = map(int, input().split())
    paths = [x - 1 for x in line]
    path_matrix[paths[0]][paths[1]] = True
    path_matrix[paths[1]][paths[0]] = True

#最初はvisited、つまり訪問したことのあるノードはひとつもないので、Falseにする
visited = [False] * N


#再帰関数、ここが難しいかもしれない。
def dfs(now, depth):
    if visited[now]:
        return 0
    if depth == N - 1:
        return 1

    visited[now] = True
    total_paths = 0
    for i in range(0, N):
        if path_matrix[now][i]:
            total_paths += dfs(i, depth + 1)

    visited[now] = False

    return total_paths

print(dfs(0, 0))