Harryxun/stf_run huggingface dataset:
n,m=map(int,input().split())
e=[]
tu=[[] for x in range(n+1)]
d=[0]*(n+1)
fa=[0]*(n+1)
for i in range(n-1+m):
    u,v=map(int,input().split())
    e.append((u,v))
    tu[u].append(v)
    d[v]+=1

def dfs(x):
    if x in vis:
        return
    vis.add(x)
    for t in tu[x]:
        dfs(t)
    tp.append(x)

vis=set()
tp=[]
for i in range(1,n+1):
    if d[i]==0:
      rt=i
      dfs(i)

d=[0]*(n+1);
tp.reverse()
for i in tp:
    for t in tu[i]:
        d[t]=max(d[t],d[i]+1)

for i in e:
    u,v=i
    if d[u]+1==d[v]:
        fa[v]=u

for i in range(1,n+1):
    print(fa[i])


### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000)

n,m=map(int,input().split())
e=[]
tu=[[] for x in range(n+1)]
d=[0]*(n+1)
fa=[0]*(n+1)
for i in range(n-1+m):
    u,v=map(int,input().split())
    e.append((u,v))
    tu[u].append(v)
    d[v]+=1

def dfs(x):
    if x in vis:
        return
    vis.add(x)
    for t in tu[x]:
        dfs(t)
    tp.append(x)

vis=set()
tp=[]
for i in range(1,n+1):
    if d[i]==0:
      dfs(i)

d=[0]*(n+1)
tp.reverse()
for i in tp:
    for t in tu[i]:
        d[t]=max(d[t],d[i]+1)

for i in e:
    u,v=i
    if d[u]+1==d[v]:
        fa[v]=u

for i in range(1,n+1):
    print(fa[i])
import random
N = int(input())

A = [i+1 for i in range(N)]

ind_max=0

for _ in range(300000):
  B = [i+1 for i in range(N)]
  random.shuffle(B)
  ind = 0
  for i in range(N):
    ind += (A[i] % B[i])
  if ind_max < ind:
    ind_max = ind
print(ind_max)

### FIXED CODE ###

S = input()
T = input()

N = 0
for i in range(3):
  if S[i] == T[i]:
    N += 1
print(N)
def main():
    import sys
    input=sys.stdin.readline
    n=int(input())
    edges=[[] for _ in range(n)]
    for i in range(n-1):
        a,b,c=map(int,input().split())
        a-=1
        b-=1
        edges[a].append([b,c])
        edges[b].append([a,c])
    q,k=map(int,input().split())
    k-=1
    
    dist=[10**9+1]*n
    dist[k]=0
    
    def dfs(s,before=-1):
       for edge in edges[s]:
           to=edge[0]
           c=edge[1]
           if to!=before:
               dist[to]=dist[s]+c
               dfs(to,s) 
              
    dfs(k)
    for i in range(q):
        x,y=map(int,input().split())
        x-=1
        y-=1
        print(dist[x]+dist[y])
if __name__=='__main__':
    main()

### FIXED CODE ###

import heapq
def dijkstra(V, edges, s):
    inf=float('inf')

    dist=[inf]*V
    dist[s]=0
    
    que=[[0,s]]
    heapq.heapify(que) #最小値を管理 [dist[i],i]となる要素

    while  que:
        p=heapq.heappop(que) #距離が最小のものを取り出す
        dis=p[0]
        v=p[1]
        if dist[v] <dis:
            continue
        for edge in edges[v]:
            to_v=edge[0]
            cost=edge[1]
        
            if dist[to_v] > dist[v] + cost:
                dist[to_v]=dist[v]+cost
                heapq.heappush(que,[dist[to_v], to_v])
    
    return dist

def main():
    n=int(input())
    edges=[[] for _ in range(n)]
    for i in range(n-1):
        a,b,c=map(int,input().split())
        a-=1
        b-=1
        edges[a].append([b,c])
        edges[b].append([a,c])
    q,k=map(int,input().split())
    k-=1
   
    dist=dijkstra(n,edges,k)
    for i in range(q):
        x,y=map(int,input().split())
        x-=1
        y-=1
        print(dist[x]+dist[y])
if __name__=='__main__':
    main()
N=int(input())
a=list(map(int, input().rstrip().split()))
work=int()
Multiple=int(1)
Output=int(0)
def gcd(x,y):
    while y>0:
        x, y=y, x%y
    return x
for i in range(N):
    Multiple=int((Multiple*a[i])/gcd(Multiple, a[i]))
for i in range(N):
    Output+=(Multiple-1)%a[i]
print(Output)


### FIXED CODE ###

N=int(input())
a=list(map(int, input().rstrip().split()))
work=int()
Multiple=int(1)
Output=int(0)
def gcd(x,y):
    while y>0:
        x, y=y, x%y
    return x
for i in range(N):
    Multiple=int((Multiple*a[i])//gcd(Multiple, a[i]))
for i in range(N):
    Output+=(Multiple-1)%a[i]
print(Output)
import sys
from collections import defaultdict
readline = sys.stdin.readline

N, M = map(int, readline().split())
G = defaultdict(set)
for v in range(M):
    a, b = map(int, readline().split())
    G[a].add(b)
    G[b].add(a)


def main():

    if M % 2 != 0:
        print(-1)
        return
    ks = []
    for i in G:
        if len(G[i])%2 != 0:
            ks.append(i)
    if len(ks) not in [0, 2]:
        print(-1)
        return
    if len(ks) == 0:
        s=t=0
    else:
        s,t=ks
    v=s
    tr = []
    es = set()
    while True:
        tr.append(v)
        if len(G[v]) == 0:
            break
        u = G[v].pop()
        G[u].remove(v)
        v = u
    tr = tr[::-1]
    tr2 = []
    cc = None
    for (i, t) in enumerate(tr):
        if len(G[t-1]) != 0:
            cc = i
            v = t-1
            while True:
                tr2.append(v+1)
                if len(G[v]) == 0:
                    break
                u = G[v].pop()
                G[u].remove(v)
                v = u
            break
    rs = []
    if cc != None:
        ind = 0
        for i in range(cc):
            if ind % 2 == 0:
                print(tr[i+1], tr[i])
            else:
                print(tr[i], tr[i+1])
            ind+=1
        for i in range(len(tr2)-1):
            if ind % 2 == 0:
                print(tr2[i+1], tr2[i])
            else:
                print(tr2[i], tr2[i+1])
            ind+=1
        owari = cc+len(tr2)-1
        nokori = M-owari
        for i in range(nokori):
            i = i + cc
            if ind % 2 == 0:
                print(tr[i+1], tr[i])
            else:
                print(tr[i], tr[i+1])
            ind+=1
    else:
        for i in range(M):
            if i %2 == 0:
                print(tr[i+1], tr[i])
            else:
                print(tr[i], tr[i+1])
    return

if __name__ == '__main__':
    main()



### FIXED CODE ###

import sys
from collections import defaultdict
sys.setrecursionlimit(10**7)
readline = sys.stdin.readline
def solve(p, v, rs):
    als = G[v]
    cs = g[v]
    c = 0
    for u in als:
        if u in cs:
            c += solve(v, u, rs)
        elif u != p:
            if v < u:
                c += 1
            rs.add((min(u,v), max(u,v)))
    if p == None:
        return
    elif c%2 != 0:
        rs.add((v, p))
        return 0
    else:
        rs.add((p,v))
        return 1

N, M = map(int, readline().split())
if M %2 != 0:
    print(-1)
else:
    G = defaultdict(set)
    for v in range(M):
        a, b = map(int, readline().split())
        G[a].add(b)
        G[b].add(a)

    stack=[1]
    vs = set([1])
    g = defaultdict(set)
    counter = 1
    while True:
        v = stack.pop()
        for u in G[v]:
            if u in vs:
                continue
            vs.add(u)
            g[v].add(u)
            stack.append(u)
            counter += 1
        if counter == N:
            break
    rs = set()
    solve(None,1, rs)
    for r in rs:
        print(r[0], r[1])
#解説方針#解法1
from collections import deque
#標準入力
N = int(input())
mod = 10 ** 9 + 7
L = [[] for i in range(N + 1)] #dfs用
AB = [0] * (N - 1)
for i in range(N - 1):
  a, b = map(int, input().split())
  L[a].append(b)
  L[b].append(a)
  AB[i] = [a, b]
#print(L)
#逆元計算
P = 10 ** 9 + 7
N2 = 2 * 100000 + 1
inv_t = [0]+[1]
for i in range(2,N2):
  inv_t += [inv_t[P % i] * (P - int(P / i)) % P]

#各辺がSに含まれる確率を求める
def dfs(c, d):#辺をつなぐ2頂点を変数にとる
  q = deque([c])
  visited = [0] * (N + 1)
  visited[c] = 1
  visited[d] = 1
  ans = 1
  while q:
    e = q.pop()
    for i in L[e]:
      if visited[i] == 0:
        visited[i] = 1
        ans += 1
        q.append(i)
  #print(ans , N - ans)
  pro = (1-((1/2) ** ans)) * (1-((1/2) ** (N - ans)))
  return pro      

#頂点の個数の期待値にする。
#基本的に辺の数+1だが、黒の頂点が一つもない1パターン(確率 1 / 2**N)だけ別に考慮
x = 0
for i in range(N - 1):
  x += dfs(AB[i][0], AB[i][1])
x = x + 1 - (N / 2) - (1/2) ** N
#print(x)#期待値があっていることを確認
  
y = int(2 ** N * x)
z = 2 ** N
T = True
while T:
  if (y % 2 == 0) and (z % 2 == 0):
    y /= 2
    z /= 2
  else:
    T = False
    
#ここで x = y / (2 ** N)の形にする
y, z = y % mod, int(z % mod)
y = y % z
#print(y, z)
ans = inv_t[z] * 1
print(int(ans))



### FIXED CODE ###

#解説方針#解法1
#https://qiita.com/ZhangChaoran/items/71fab0e4b8647a93d3a0
from collections import deque
from heapq import heappop, heappush
#標準入力
N = int(input())
MOD = 10 ** 9 + 7
L = [[] for i in range(N + 1)] #dfs用
for i in range(N - 1):
  a, b = map(int, input().split())
  L[a].append(b)
  L[b].append(a)

#木の探索
parent = [0] * (N + 1)
order = []
stack = [1]
while stack:
    x = stack.pop()
    order.append(x)  # 行きがけ順探索リスト
    for y in L[x]:
        if y == parent[x]:
            continue
        parent[y] = x  # 親ノードを記録
        stack.append(y)
#print(order, parent)

half = pow(2, MOD - 2, MOD)
power_inv = [1] * (N + 1)#2 ** N の逆元の集合
size = [1] * (N + 1)
for i, v in enumerate(order[::-1], 1):#iが1から
    p = parent[v]
    x = size[v]  # vの子孫ノード数（自分も含む）をとる
    size[p] += x  # 親にノード数を加算
    power_inv[i] = power_inv[i - 1] * half % MOD  # [1, 1/2, 1/4, ...]
#print(size)
# 辺iがSに含まれるための必要十分条件による辺の個数の期待値 
# (1 - (1/2) ** i)(1 - (1/2) ** (N - i))を展開して計算
# 根である1の頂点以外は、ある頂点とその親を結ぶ辺を考えた際
# i と N - i個の頂点に別れるので,size[2:]でOK
ans = sum((1 - power_inv[i] - power_inv[N - i] + power_inv[N]) %
          MOD for i in size[2:])  
#ans = sum((1 - (1/2) ** i- (1/2) ** (N - i) + (1/2) ** N) for i in size[2:])  
#print(ans)
ans += 1  # 木の頂点の個数は辺の個数+1
# -「すべての辺が含まれない、つまり空グラフの場合の誤加算」-N/2
ans -= power_inv[N] + N * power_inv[1]  
#ans -= N * power_inv[1]  
ans %= MOD

print(ans)
A = int(input())
B = int(input())
C = int(input())

print("YES" if A+B+C == 17 else "NO")

### FIXED CODE ###

ans = 0
A = list(map(int, input().split()))

for x in A:
    ans += x

print("YES" if ans == 17 else "NO")
a , b, c = map(int, input().split())
d =  b // a 
if d > c:
  return c
else:
  return d

### FIXED CODE ###

a , b, c = map(int, input().split())
d =  b // a 
if d > c:
  print(c)
else:
  print(d)
# -*- coding:utf-8 -*-
input_str = input()
target_lst = ['k','e','y','e','n','c','e']

i = 0
del_list = []
for elm in input_str:
  if elm in target_lst:
    target_lst.remove(elm)
    del_list.append(i)
  i+=1

if len(target_lst) !=  0:
  print('NO')
else:
  for i in del_list:
    if i == 0:
      continue
    else:
      if del_list[i] < del_list[i-1]:
        print('NO')
        exit()

  print('YES')   

### FIXED CODE ###

s = input()
n = len(s)

for i in range(n):
  for j in range(i,n):
    tmp = s[:i]+s[j:]
    if tmp == 'keyence':
      print('YES')
      exit()
print('NO')
a,b=input().split()
print(int(a)*round((float(b)*100)//100)

### FIXED CODE ###

a,b=input().split()
print(int(a)*round(float(b)*100)//100)
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(2)])
for i in range(N):
    M[0][A[i]] += 1
    M[1][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[1][-1]-cum_M[1][b])
        
print(int(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)
A,B,K = map(int,input().split())

a = 0
b = 0

if A <= 10**12 and B <=10**12 and K <= 10**12:
    if A >= K :
        a = A-K
    elif  (A + B) >=K:
        a = 0
        b = B-(K-A)
    elif  (A + B)  < K:
        a = 0
        b = 0
else :
    a = 0
    b = 0

print(a,b,end='')

### FIXED CODE ###

S,T=map(str,input().split())

print(T,S,sep='')
x, y, a, b, c = map(int, input().split())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
R = list(map(int, input().split()))
Pl = 0
Ql = 0
Rb = 0

P.sort(reverse = True)
Q.sort(reverse = True)
R.sort(reverse = True)

P = P[0:x]
Q = Q[0:y]

while P[-1 - Pl] < R[0 + Rb] or Q[-1 - Ql] < R[0 + Rb]:
    if Pl == len(P):
        if Q[-1 - Ql] < R[0 + Rb]:
            Q[-1 - Ql] = R[0 + Rb]
            Ql = Ql + 1
        else:
            break
    elif Ql == len(Q):
        if P[-1 - Pl] < R[0 + Rb]:
            P[-1 - Pl] = R[0 + Rb]
            Pl = Pl + 1
        else:
            break

    elif Q[-1 - Ql] >= P[-1 - Pl]:
        P[-1 - Pl] = R[0 + Rb]
        Pl = Pl + 1
    else:
        Q[-1 - Ql] = R[0 + Rb]
        Ql = Ql + 1

    Rb = Rb + 1
    if Rb == len(R):
        break

print(sum(P) + sum(Q))

### FIXED CODE ###

x, y, a, b, c = map(int, input().split())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
R = list(map(int, input().split()))
Pl = 0
Ql = 0
Rb = 0

P.sort(reverse = True)
Q.sort(reverse = True)
R.sort(reverse = True)

P = P[0:x]
Q = Q[0:y]

#while (P[-1 - Pl] < R[0 + Rb] or Q[-1 - Ql] < R[0 + Rb]):
#while (P[-1 - Pl] < R[0 + Rb] or Q[-1 - Ql] < R[0 + Rb]) and (Pl != len(P) or Ql != len(Q)):
while Pl != len(P) or Ql != len(Q):
    if Pl == len(P):
        if Q[-1 - Ql] < R[0 + Rb]:
            Q[-1 - Ql] = R[0 + Rb]
            Ql = Ql + 1
        else:
            break
    elif Ql == len(Q):
        if P[-1 - Pl] < R[0 + Rb]:
            P[-1 - Pl] = R[0 + Rb]
            Pl = Pl + 1
        else:
            break

    elif Q[-1 - Ql] >= P[-1 - Pl] and P[-1 - Pl] < R[0 + Rb]:
        P[-1 - Pl] = R[0 + Rb]
        Pl = Pl + 1
    elif P[-1 - Pl] > Q[-1 - Ql] and Q[-1 - Ql] < R[0 + Rb]:
        Q[-1 - Ql] = R[0 + Rb]
        Ql = Ql + 1

    else:
        break

    Rb = Rb + 1
    if Rb == len(R):
        break

print(sum(P) + sum(Q))
# TPBC201C - Stones
n = int(input())
s = list(input())
ans = 0
if len(set(s)) == 1:
    print(ans)
else:
    while s[0] == ".":
        s.pop(0)
    while s[-1] == "#":
        s.pop()
    lst = "".join(s).split(".#")
    for i in range(len(lst)):
        if i == 0:
            ans += min(lst[i].count("#"), lst[i].count(".") + 1)
        elif i == len(lst) - 1:
            ans += min(lst[i].count("#") + 1, lst[i].count("."))
        else:
            ans += min(lst[i].count("#") + 1, lst[i].count(".") + 1)
    print(ans)

### FIXED CODE ###

# TPBC201C - Stones
n = int(input())
s = input()
ans = 0
blk = 0
for i in s:
    if i == "#":
        blk += 1
    else:
        if blk > 0:
            ans += 1
            blk -= 1
print(ans)
s=input()
i=0
c=0
if s[i]=='R':
  c=1
  if s[i+1]=='R':
    c=2
    if s[i+2]=='R':
      c=3
if s[i]=='S':
  c=0
  if s[i+1]=='R':
    c=1
   	if s[i+2]=='R':
      c=2
print(c)
      

### FIXED CODE ###

s=input()
if 'RRR' in s:
  c=3
elif 'RR' in s:
  c=2
elif 'R' in s:
  c=1
else:
  c=0
print(c)
S = input()
if S[2]==S[3] and S[4]=S[5]:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

S = input()
if S[2]==S[3] and S[4]==S[5]:
    print('Yes')
else:
    print('No')
A = int(input())
B = int(input())
C = int(input())
D = int(input())


print(min(A+B)+min(C+D))


### FIXED CODE ###

A = int(input())
B = int(input())
C = int(input())
D = int(input())


print(min(A,B)+min(C,D))
from math import ceil
ts = [int(input()) for _ in range(5)]
m = 10 - min([t % 10 for t in ts if not t % 10 == 0])
tss = [ceil(t / 10) * 10 for t in ts]
print(sum(tss) - m)



### FIXED CODE ###

from math import ceil
ts = [int(input()) for _ in range(5)]
m = 10 - min([t % 10 for t in ts if not t % 10 == 0] + [10])
tss = [ceil(t / 10) * 10 for t in ts]
print(sum(tss) - m)
N,M = map(int,input().split())

from collections import Counter
def factorize(n):
    d = Counter()
    m = 2
    while m*m <= n:
        while n%m == 0:
            n //= m
            d[m] += 1
        m += 1
    if n > 1:
        d[n] += 1
    return d

MOD = 10**9+7

fac = [1,1] + [0]*(N*2)
finv = [1,1] + [0]*(N*2)
inv = [0,1] + [0]*(N*2)
for i in range(2,(N*2)+2):
    fac[i] = fac[i-1] * i % MOD
    inv[i] = -inv[MOD%i] * (MOD // i) % MOD
    finv[i] = finv[i-1] * inv[i] % MOD

def ncr(n,r):
    if n < r: return 0
    if n < 0 or r < 0: return 0
    return fac[n] * (finv[r] * finv[n-r] % MOD) % MOD
def nhr(n,r):
    return ncr(n+r-1, r)


factors = factorize(M)
ans = 1
for v in factors.values():
    ans *= nhr(N,v)
    ans %= MOD
print(ans)

### FIXED CODE ###

N,M = map(int,input().split())
MOD = 10**9+7

from collections import Counter
def factorize(n):
    d = Counter()
    m = 2
    while m*m <= n:
        while n%m == 0:
            n //= m
            d[m] += 1
        m += 1
    if n > 1:
        d[n] += 1
    return d

fac = [1,1] + [0]*(N+100)
finv = [1,1] + [0]*(N+100)
inv = [0,1] + [0]*(N+100)
for i in range(2,N+102):
    fac[i] = fac[i-1] * i % MOD
    inv[i] = -inv[MOD%i] * (MOD // i) % MOD
    finv[i] = finv[i-1] * inv[i] % MOD

def ncr(n,r):
    if n < r: return 0
    if n < 0 or r < 0: return 0
    return fac[n] * (finv[r] * finv[n-r] % MOD) % MOD

ans = 1
facs = factorize(M)
for v in facs.values():
    ans *= ncr(N+v-1,v)
    ans %= MOD
print(ans)
K = int(input())
X = int(input())
k = K * 500
if k > X:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

K, X = map(int, input().split())
k = K * 500
if k >= X:
  print('Yes')
else:
  print('No')
list = map(int(), input().split())
area = list[0] * list[1]
perimeter = list[0] * 2 + list[1] * 2
print('%d %d' (area, perimeter))



### FIXED CODE ###

l = list(map(int, input().split()))
area = l[0] * l[1]
perimeter = l[0] * 2 + l[1] * 2
print('{0} {1}'.format(area, perimeter))
#C
N, K = map(int, input().split())
A = list(map(int, input().split()))
p=[]
import numpy as np
for i in range(N-K+1):
    if i==0:
        ans=np.prod(A[i:i+K])
    else:
        ans=ans*A[i+K-1]/A[i-1]
    p.append(ans)

for j in range(len(p)-1):
    if p[j]<p[j+1]:
        print('Yes')
    else:
        print('No')

### FIXED CODE ###

#C
N, K = map(int, input().split())
A = list(map(int, input().split()))
p=[]
for i in range(N-K):
    if A[i+K]>A[i]:
        p.append(1)
    else:
        p.append(0)

for j in range(len(p)):
    if p[j]==1:
        print('Yes')
    else:
        print('No')
N, T = map(int, input().split())
l = []
for i in range(N):
    c, t = map(int, input().split())
    if T >= t:
        l.append(c)
print(min(l))


### FIXED CODE ###

N, T = map(int, input().split())
l = []
for i in range(N):
    c, t = map(int, input().split())
    if T >= t:
        l.append(c)
if len(l) == 0:
    print('TLE')
else:
    print(min(l))
print(int(not(bool(x))))

### FIXED CODE ###

if input() == "1":
  print(0)
else:
  print(1)
n = int(input)
lst = list(map(int, input().split()))
print(" ".join(lst[::-1]))


### FIXED CODE ###

input()
print(" ".join(input().split()[::-1]))
import numpy as np

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

table = np.zeros(10**5+1, dtype=np.int)
ch = [[] for _ in range(c+1)]

for _ in range(n):
    s,t,c = map(int,input().split())
    ch[c].append([s,t])

times = []
for arr in ch:
    if not arr: continue
    for i in range(len(arr)):
        if i == 0: continue
        if arr[i-1][1] == arr[i][0]:
            arr[i] = [arr[i-1][0], arr[i][1]]
            arr[i-1] = []
    for ele in arr:
        if not ele: continue
        times.append(ele)

# いもす法
for ele in times:
    table[ele[0]] += 1
    table[ele[1]+1] -= 1

# 累積和の最大値
ans = table.cumsum().max()

print(ans)



### FIXED CODE ###

import numpy as np

n,c = map(int,input().split())
table = np.zeros(10**5+2, dtype=np.int32)
chs = [[] for _ in range(c+1)]

for _ in range(n):
    s,t,c = map(int,input().split())
    chs[c].append([s,t])

# 同チャンネル内の連続番組を合体
times = []
for ch in chs:
    if not ch: continue
    ch.sort()
    for i in range(len(ch)):
        if i == 0: continue
        if ch[i-1][1] == ch[i][0]:
            ch[i] = [ch[i-1][0], ch[i][1]]
            ch[i-1] = []
    for arr in ch:
        if not arr: continue
        times.append(arr)

# いもす法
for arr in times:
    table[arr[0]] += 1
    table[arr[1]+1] -= 1

# 累積和の最大値
ans = table.cumsum().max()

print(ans)
while True:
    a,b=int(input().split())
    c=a+b
    ans=0
    if c>=0 and c<=9:
        ans=1
    if c>=10 and c<=99:
        ans=2
    if c>=100 and c<=999:
        ans=3
    if c>=1000 and c<=9999:
        ans=4
    if c>=10000 and c<=99999:
        ans=5
    if c>=100000 and c<=999999:
        ans =6
    if c>=1000000 and c<=9999999:
        ans=7
    print(ans)


### FIXED CODE ###

while True:
    try:a,b=map(int,input().split())
    except:break
    c=a+b
    ans=0

    while c>9:
        c=c//10
        ans+=1
    ans+=1
    print(ans)
# D TLE
import bisect

N = map(int, input().split())
L = list(map(int, input().split()))

L.sort()
value = 0


for i in range(0, len(L)-2):
    for j in range(i, len(L)-1):
    index = bisect.bisect_left(L[j+1:], L[i]+L[j])
    value+=max(0, index)

print(value)


### FIXED CODE ###

n = int(input())
l = list(map(int, input().split()))
l.sort()
 
from bisect import bisect_left
ans = 0
for i in range(n):
  for j in range(i+1, n):
    t = l[i]+l[j]
    idx = bisect_left(l, t)
    ans += max(0, idx-j-1)
print(ans)
n = input()
s = input()

if n < 3200:
  print("red")
else:
  print(s)

### FIXED CODE ###


n = int(input())
s = input()

if n < 3200:
  print("red")
else:
  print(s)
data = [
    "{0} {1}".format(s, r)
    for s in ('S', 'H', 'C', 'D')
    for r in range(1, 13 + 1)
       ]
 
count = int(input())
for c in range(count):
    card = input()
    data.remove(card)
 
for c in data:
    print(c)

### FIXED CODE ###

input()
a = input().split()
a.reverse()
print(" ".join(a))
N M = map(int, imput().split())

for a in range(N):
  for b in range(N):
    c = N - a - b
    X = 10000*a + 5000*b + 1000*c
    
    if X == M:
      m10000 = a
      m5000 = b
      m1000 = c
      
 Nt = m10000 + m5000 + m1000
  
 if N >= Nt:
    print(m10000, " ", m5000, " ", m1000)
 else:
  print(print(-1, " ", -1, " ", -1)

### FIXED CODE ###


N, M = map(int, input().split())

m10000 = -1
m5000 = -1
m1000 = -1
  
for a in range(N+1):
  for b in range(N+1-a):
    c = abs(N - a - b)
    X = 10000*a + 5000*b + 1000*c
    
    if X == M:
      m10000 = a
      m5000 = b
      m1000 = c

print(m10000, " ", m5000, " ", m1000)
import re

def f(s):
    for i in range(0,10):
        t = s.replace("X", str(i))
        a, b, c = map(int, re.split(r'\+|\=', t))
        if a + b == c and str(a) + "+" + str(b) + "=" + str(c) == t:
            return i
    return "NA"

while (1):
    print f(raw_input())

### FIXED CODE ###

import re

def f(s):
    for i in range(0,10):
        t = s.replace("X", str(i))
        a, b, c = map(int, re.split(r'\+|\=', t))
        if a + b == c and str(a) + "+" + str(b) + "=" + str(c) == t:
            return i
    return "NA"

while True:
    try:
        print f(raw_input())
    except:
        break
import sys
 
H,W,M = list(map(int, input().split()))
U = 3 * 10**5
hw = [[0] * (U) for _ in range(U)]
 
w = [0] * (U)
h = [0] * (U)
mxw = []
mxw_v = 0
mxh = []
mxh_v = 0
 
 
for i in range(M):
    h_i, w_j = list(map(int, input().split()))
    hw[h_i][w_j] = 1
    h[h_i] += 1
    w[w_j] += 1
    if mxw_v < w[w_j]:
        mxw_v = w[w_j]
        mxw = [w_j]
    elif mxw_v == w[w_j]:
        mxw.append(w_j)
 
    if mxh_v < h[h_i]:
        mxh_v = h[h_i]
        mxh = [h_i]
    elif mxh_v == h[h_i]:
        mxh.append(h_i)
a = 0
for i in mxh:
    for j in mxw:
        d = hw[i][j]
        a = max(a, mxh_v + mxw_v - d)
print(a)

### FIXED CODE ###

H,W,M = list(map(int, input().split()))

hw = set()
w = [0] * 3*10**5
h = [0] * 3*10**5

for i in range(M):
    h_i, w_j = map(int, input().split())
    hw.add((h_i-1) + (w_j-1)*3*10**6)
    h[h_i-1] += 1
    w[w_j-1] += 1

a = 0
d = 1
mxh_v = max(h)
mxw_v = max(w)

x = [i for i,j in enumerate(h) if j == mxh_v]
y = [i for i,j in enumerate(w) if j == mxw_v]

for i in x:
    for j in y:
        if not(i + j*3*10**6 in hw):
            print(mxh_v+mxw_v)
            exit()
print(mxh_v+mxw_v-d)
h, w = map(int, input().split())
a=int(h/2)+1
b=h/2
c=0


for j in range(w):
        if j%2==1:
            c=c+a
        else:
            c=c+b
    





print(c)

### FIXED CODE ###

k=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
s=int(input())
s=s-1
print(k[s])