Harryxun/stf_run huggingface dataset:
class WeightedUnionFind:
    def __init__(self, n):
        self.parent = [i for i in range(n + 1)]
        self.rank = [0 for _ in range(n + 1)]
        self.weight = [0 for _ in range(n + 1)]

    def find(self, x):
        if self.parent[x] == x:
            return x
        else:
            y = self.find(self.parent[x])
            self.weight[x] += self.weight[self.parent[x]]
            self.parent[x] = y
            return y

    def union(self, x, y, w):
        rx = self.find(x)
        ry = self.find(y)
        if rx == ry:
            if w != self.diff(x, y):
                print("No")
                exit()

        if self.rank[rx] < self.rank[ry]:
            self.parent[rx] = ry
            self.weight = w - self.weight[x] + self.weight[y]
        else:
            self.parent[ry] = rx
            self.weight[ry] = -w - self.weight[y] + self.weight[x]
            if self.rank[rx] == self.rank[ry]:
                self.rank[rx] += 1

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def diff(self, x, y):
        return self.weight[x] - self.weight[y]


N, M = map(int, input().split())
w_union_find = WeightedUnionFind(N)
lrd = []
for i in range(M):
    l, r, d = map(int, input().split())
    w_union_find.union(l, r, d)
print("Yes")


### FIXED CODE ###

class WeightedUnionFind:
    def __init__(self, n):
        self.par = [i for i in range(n + 1)]
        self.rank = [0] * (n + 1)
        # 根への距離を管理
        self.weight = [0] * (n + 1)

    # 検索
    def find(self, x):  # xの親を返す
        if self.par[x] == x:
            return x
        else:
            y = self.find(self.par[x])
            # 親への重みを追加しながら根まで走査
            self.weight[x] += self.weight[self.par[x]]
            # 親の値を更新(アルゴリズムの高速化)
            self.par[x] = y
            return y  # 親

    # 併合
    # (xからyへの重みがw) = (y - x = W)
    def union(self, x, y, w):
        rx = self.find(x)
        ry = self.find(y)
        # 既に同集合の場合
        if rx == ry:
            if self.diff(x, y) != w:
                print("No")
                exit()
        # 木の高さで処理を変えるのは高速化(木を低くする)のため
        # xの木の高さ < yの木の高さ
        if self.rank[rx] < self.rank[ry]:
            self.par[rx] = ry
            self.weight[rx] = w - self.weight[x] + self.weight[y]
        # xの木の高さ ≧ yの木の高さ
        else:
            self.par[ry] = rx
            self.weight[ry] = -w + self.weight[x] - self.weight[y]
            # 木の高さが同じだった場合の処理
            if self.rank[rx] == self.rank[ry]:
                self.rank[rx] += 1

    # 同じ集合に属するか
    def same(self, x, y):
        return self.find(x) == self.find(y)

    # xからyへのコスト
    def diff(self, x, y):
        return self.weight[x] - self.weight[y]


import sys
sys.setrecursionlimit(10**8)
N, M = map(int, input().split())
lrd = []
for i in range(M):
    l, r, d = map(int, input().split())
    lrd.append([l, r, d])
w_union_find = WeightedUnionFind(N)
for i in range(M):
    l, r, d = lrd[i]
    w_union_find.union(l, r, d)
print("Yes")
from collections import defaultdict

N, M = map(int, input().split())
P, Y = [], []
ylist = defaultdict(list)
pset = set()
for i in range(M):
    p, y = map(int, input().split())
    P.append(p)
    Y.append(y)
    ylist[p].append(y)
    pset.add(p)

cdict = defaultdict(dict)
for p in pset:
    syear = sorted(ylist[p])
    for i, y in enumerate(syear):
        cdict[p][y] = i + 1

for i in range(M):
    p = P[i]
    y = Y[i]
    rank = cdict[p][y]
    print(f'{p:06}{rank:06}')


### FIXED CODE ###

from collections import defaultdict

N, M = map(int, input().split())
P, Y = [], []
ylist = defaultdict(list)
pset = set()
for i in range(M):
    p, y = map(int, input().split())
    P.append(p)
    Y.append(y)
    ylist[p].append(y)
    pset.add(p)

cdict = defaultdict(dict)
for p in pset:
    syear = sorted(ylist[p])
    for i, y in enumerate(syear):
        cdict[p][y] = i + 1

for i in range(M):
    p = P[i]
    y = Y[i]
    rank = cdict[p][y]
    print('{:06}{:06}'.format(p, rank))
n,k = map(int,input().split())
s = list(input())
if s[0] == "1":
    cnt_list = []
else:
    cnt_list = [0]
cnt = 1
for i in range(n-1):
    if s[i] == s[i+1]:
        cnt += 1
    else:
        cnt_list.append(cnt)
        cnt = 1
cnt_list.append(cnt)

sum_list = []
for i in range(0,len(cnt_list)-2*k):
    sum_list.append(sum(cnt_list[i:i+2*k+1]))
print(max(sum_list))

### FIXED CODE ###

n,k = map(int,input().split())
s = list(input())
if s[0] == "1":
    cnt_list = []
else:
    cnt_list = [0]
cnt = 1
for i in range(n-1):
    if s[i] == s[i+1]:
        cnt += 1
    else:
        cnt_list.append(cnt)
        cnt = 1
cnt_list.append(cnt)
if s[-1] == '0':
    cnt_list.append(0)
#print(cnt_list)
sum_list = [0]
for i in range(len(cnt_list)):
    sum_list.append(sum_list[i] + cnt_list[i])
ans = 0
for i in range(0,len(sum_list),2):
    right = min(i+2*k+1,len(sum_list)-1)
    ans = max(ans,sum_list[right]-sum_list[i])
print(ans)
x = str(input())
lx = len(x)
num = lx - 2
head = int(x[:num])
body = int(x[num:])
up = head * 5
ans = int(0)
if body <= up:
    ans = 1
else:
    ans = 0
if x > 615 * 1000000:
    ans = 0
print(ans)

### FIXED CODE ###

x = str(input())
lx = len(x)
num = lx - 2
if int(x) >= 100:
    head = int(x[:num])
    body = int(x[num:])
    up = head * 5
    ans = int(0)
    if body <= up:
        ans = 1
    else:
        ans = 0
else:
    ans = 0
print(ans)
N, K = input().split()
N=int()
K=int()
if N % K == 0:
    print(0)
else :
    print(1)

### FIXED CODE ###

N, K = input().split()
N=int(N)
K=int(K)
if K==0:
    print("ZeroDivisionError!!")
elif N % K ==0:
    print(0)
else :
    print(1)
h,w = map(int,input().split())
S = [input() for _ in range(h*w)]
for i in range(h*w):
  if S[i] == 'snuke':
    print(i+1)


### FIXED CODE ###

H, W = map(int, input().split())
S = [list(input().split()) for i in range(H)]

h = w = 0
for i in range(H):
    if 'snuke' in S[i]:
        h = i
        w = S[i].index('snuke')
        break
print(chr(ord('A') + w) + str(h + 1))
import sys

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

dif = math.inf

for i in range(1,N):
    tmp = abs(sum(W[:i]) - sum(W[i:]))
    if dif > tmp:
        dif = tmp
print(dif)


### FIXED CODE ###

import sys

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

dif = 9999999999

for i in range(1,N):
    tmp = abs(sum(W[:i]) - sum(W[i:]))
    if dif > tmp:
        dif = tmp
print(dif)
n, x = map(int, input().split())
l = list(map(int, input().split()))

count = 0
sum = 0

while sum <= x:
  sum += l[count]
  count+=1
print(count)

### FIXED CODE ###

n, x = map(int, input().split())
l = list(map(int, input().split()))

count = 0
sum = 0

for i in range(len(l)):
  sum += l[i]
  if sum <= x:
    count+=1
print(count + 1)
import sys
from scipy.special import comb

def main():
    n = input().rstrip()
    k = int(input())
    if k == 1:
        print((int(n[0]) - 1) + 9 * (len(n) -  1) + 1)
    elif k == 2:
        a = (int(n[0]) - 1) * 9 * (len(n) - 1) + int(comb(len(n) - 1, 2) * 9*9)
        b = int(n[1]) + 9 * (len(n)-2)
        print(a + b)
    elif k == 3:
        a = (int(n[1]) - 1) * 9 * (len(n) - 2) + int(comb(len(n)-2, 2) * 9*9) + (int(n[2]) + 9*(len(n) - 3))
        b = (int(n[0]) - 1) * int(comb(len(n)-1, 2) * 9*9)
        c = int(comb(len(n)-1, 3) * 9*9*9)
        print(a+b+c)

if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)

def combinations(n, r):
    if n <= 0 or n < r:
        return 0
    if n == r or r == 0:
        return 1
    if r == 1:
        return n
    return combinations(n-1,r-1) + combinations(n-1,r)

def main():
    n = input().rstrip()
    k = int(input())
    if k == 1:
        print((int(n[0]) - 1) + 9 * (len(n) -  1) + 1)
    elif k == 2:
        a = (int(n[0]) - 1) * 9 * (len(n) - 1)
        b = int(combinations(len(n) - 1, 2) * 9*9)
        c = 0
        for i in range(1, len(n)):
            if n[i] != '0':
                c = int(n[i]) + 9 * (max(len(n) - i - 1, 0))
                break
        print(a + b + c)
    elif k == 3:
        a_a = 0
        a_b = 0
        a_c = 0
        for i in range(1, len(n)):
            if n[i] != '0':
                for j in range(i+1, len(n)):
                    if n[j] != '0':
                        a_a = int(n[j]) + 9 * (max(len(n) - j - 1, 0))
                        break
                a_b = (int(n[i]) - 1) * 9 * (max(len(n) - i - 1, 0))
                a_c = combinations(len(n) - i - 1, 2) * 9 * 9
                break
        b = (int(n[0]) - 1) * combinations(len(n) - 1, 2) * 9 * 9
        c = combinations(len(n) - 1, 3) * 9 * 9 * 9
        print((a_a + a_b + a_c) + b + c)

if __name__ == '__main__':
    main()
S=input()
if S.count(hi)>=1:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

S=input()
if S.count("hi")*2==len(S):
  print("Yes")
else:
  print("No")
s, t = [input() for i in range(2)]
for _ in range(len(s)):
  s = s[1:] + s[0]
  if s = t:
    print("Yes") 
    break
else:
  print("No")

### FIXED CODE ###

s, t = [input() for i in range(2)]
for _ in range(len(s)):
  s = s[-1] + s[:-1]
  if s == t:
    print("Yes") 
    break
else:
  print("No")
N=input()
n=sum(map(int,str(N)))
if N%n==0:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

N=int(input())
n=sum(map(int,str(N)))
print("Yes" if N%n==0 else "No")
s = input()
t = input()
    exit()
s = list(s)
t = list(t)
s_ = sorted(s)
t_ = sorted(t)
t_.reverse()
if ''.join(s_)<''.join(t_):
    print('Yes')
else:
    print('No')

### FIXED CODE ###

s = input()
t = input()
s = list(s)
t = list(t)
s_ = sorted(s)
t_ = sorted(t)
t_.reverse()
if ''.join(s_)<''.join(t_):
    print('Yes')
else:
    print('No')
N, K, X, Y, = map(int, input().split())

# 高橋くんの宿泊数 N
# 宿泊費が変わる　 K
# 初期宿泊費      X
# K+1以降の宿泊費 Y

# subは宿泊数の超過分
sub = N - K

# もしNよりKが大きい場合、そのまま計算する
if N < K:
    answer = N * X
    print(answer)
# KよりNが大きい場合 K * X + (N - K) * Y
elif K < N:
    answer = K * X + sub * Y
    print(answer)

### FIXED CODE ###

N = int(input())    # 宿泊数
K = int(input())    # 単価が切り替わる泊数
X = int(input())    # 単価a
Y = int(input())    # 単価b


if N <= K:
    a = N * X
else:
    a = K * X + Y * (N - K)

print(a)
s = int(input())
n = int(1)
string_list = [input().split() for i in range(n)]
int_list = [int(s) for s in string_list]
m = max(int_list)
if sum(int_list) - int(m) > int(m):
    print("Yes")
else:
    print("NO")

### FIXED CODE ###

s = int(input())
A = list(map(int, input().split())) 
m = max(A)
if sum(A) - int(m) > int(m):
    print("Yes")
elif sum(A) - int(m) <= int(m):
    print("No")
from subprocess import *
call(('pypy3','-c'."""
import sys
def input(): return sys.stdin.readline().rstrip()
from collections import deque
def main():
    n,q=map(int,input().split())
    P=[[] for _ in range(n)]
    for i in range(n-1):
        a,b=map(int,input().split())
        P[a-1].append(b-1)
        P[b-1].append(a-1)
    X=[0]*n
    for i in range(q):
        p,x=map(int,input().split())
        X[p-1]+=x
    deq=deque([0])
    visited=[False]*n 
    while deq:
        node=deq.popleft()
        if not(visited[node]):
            visited[node]=True
            for p in P[node]:
                if not(visited[p]):
                    X[p]+=X[node]
                    deq.append(p)
    print(*X)

if __name__=='__main__':
    main()
"""))

### FIXED CODE ###

import sys
def input(): return sys.stdin.readline().rstrip()
from collections import deque
def main():
    n,q=map(int,input().split())
    P=[[] for _ in range(n)]
    for i in range(n-1):
        a,b=map(int,input().split())
        P[a-1].append(b-1)
        P[b-1].append(a-1)
    X=[0]*n
    for i in range(q):
        p,x=map(int,input().split())
        X[p-1]+=x
    deq=deque([0])
    visited=[False]*n 
    while deq:
        node=deq.popleft()
        if not(visited[node]):
            visited[node]=True
            for p in P[node]:
                if not(visited[p]):
                    X[p]+=X[node]
                    deq.append(p)
    print(*X)

if __name__=='__main__':
    main()
import numpy as np
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

A = a % 10
B = b % 10
C = c % 10
D = d % 10
E = e % 10

S = []
sum = 0
if A != 0:
  S.append(A)
if B != 0:
  S.append(B)
if C != 0:
  S.append(C)
if D != 0:
  S.append(D)
if E != 0:
  S.append(E)
if len(S) == 0:
  sum = a + b + c + d + e
else:
  sum = (a //10 + b //10 + c //10 + d //10 + e //10)*10 + 10*(len(A) - 1) +min(S)
print(sum)


### FIXED CODE ###

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

if abs(a - b) <= k and abs(a - c) <= k and abs(a - d) <= k and abs(a - e) <= k and abs(b - c) <= k and abs(b - d) <= k and abs(b - e) <= k and abs(c - d) <= k and abs(c - e) <= k and abs(d - e) <= k:
  print("Yay!")
else:
  print(":(")
n = int(input())
# 約数は、常にペアになる。


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


org = make_divisors(n)
div = sorted(org)

divNum = len(div)


if (divNum % 2 == 0):
    indA = int(divNum / 2) - 1
    indB = int(divNum / 2)
else:
    indA = int((divNum - 1) / 2)
    indB = indA

# print(div[indA])

A = len(str(div[indA]))
B = len(str(div[indB]))

ans = max(A, B)
print(ans)a


### FIXED CODE ###

n = int(input())
# 約数は、常にペアになる。


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


org = make_divisors(n)
div = sorted(org)

divNum = len(div)


if (divNum % 2 == 0):
    indA = int(divNum / 2) - 1
    indB = int(divNum / 2)
else:
    indA = int((divNum - 1) / 2)
    indB = indA

# print(div[indA])

A = len(str(div[indA]))
B = len(str(div[indB]))

ans = max(A, B)
print(ans)
if [input(),input()].count("H") == 1:
	print("D")
else:
	print("H")

### FIXED CODE ###

if [ v for v in input().split() ].count("H") == 1:
	print("D")
else:
	print("H")
N = int(input())
S = list(input()) 
result_list = [] 
for i in range(N): 
    X = S[:i] 
    Y = S[i:] 
    counter = 0 
    old_list = [] 
    for j in X: 
        if j in Y and not(j in old_list): 
            counter += 1 
            old_list.append(j) 
            result_list.append(counter) 
print (max(result_list))

### FIXED CODE ###

N = int(input())
S = list(input()) 
result_list = [] 
for i in range(N): 
    X = S[:i] 
    Y = S[i:] 
    counter = 0 
    old_list = [] 
    for j in X: 
        if j in Y and not(j in old_list): 
            counter += 1 
            old_list.append(j) 
            result_list.append(counter) 
if result_list == []:
    print(0)
else:
    print (max(result_list))
Flag =  0 
after = ""
S = input().split()
A = list("A","A","A")
B = list("B","B","B")
if(set(S) == set(A) or set(S) ==set(B)):
    print("No")
else:
    print(print("Yes")

### FIXED CODE ###

Flag =  0 
S = input()
SA = [str(c) for c in S]
#A = list(['A','A','A'])
#B = list(['B','B','B'])
S1 = SA[0]
S2 = SA[1]
S3 = SA[2]
if(S1 == S2 == S3):
    print("No")
else:
    print("Yes")
s=input()
x=s.count('a')
y=s.count('b')
z=s.count('c')
if a==1 and a==1 and a==1:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

s=input()
x=s.count('a')
y=s.count('b')
z=s.count('c')
if x==1 and y==1 and z==1:
  print('Yes')
else:
  print('No')
# import bisect
# import heapq
# from copy import deepcopy
# from collections import deque
# from collections import Counter
# from itertools import accumulate
# from itertools import permutations
# import numpy as np
# import math
# mod = 10**9 + 7

# n = int(input())
h, n = map(int, input().split())
# a = list(map(int, input().split()))
a, b = [0] * n, [0] * n

for i in range(n):
    a[i], b[i] = map(int,input().split())

dp = [float('inf')] * (h+1)
dp[0] = 0

for i in range(n):

    for j in range(h):

        dp[min(j+a[i], h)] = min(dp[min(j+a[i],h)], dp[j]+b[i])


print(dp[h])

### FIXED CODE ###

# import math
# import bisect
# import heapq
# from collections import deque
# import numpy as np

h,a = map(int, input().split())
# n = int(input())
# a = list(map(int,input().split()))
if h % a ==0: ans = h // a
else: ans = h // a + 1

print(ans)
a,s=0,input()
while(True):
  t = input().split()
  if t[0] == "END_OF_TEXT":
    print(a)
    quit()
  for i in t:
    if i.lower() in lis:
      a += 1


### FIXED CODE ###

a,s=0,input().lower()
while(True):
  t = input().split()
  if t[0] == "END_OF_TEXT":
    print(a)
    quit()
  for i in t:
    if i.lower() == s:
      a += 1
t,s=map(input().split())
print(s+t)


### FIXED CODE ###

t,s=map(str,input().split())
print(s+t)
n = int(input().strip())
a = list(map(int, input().strip().split()))

box=[0]*n
ans=[]
for i in range(n,0,-1):
    sum_=0
    for j in range(1,n+1):
        if j*i>n:
            break
        sum_+=box[j*i-1]
    if sum_%2!=a[i-1]:
        box[i-1]=1
        ans.append(i)

print(len(ans))
print(' '.join(list(map(str,ans))))


### FIXED CODE ###

s = input()
n = len(s)
mod = 10**9+7
dp = [[0]*13 for i in range(n+5)]#dp[i][j] :=先頭i文字を見たとき、その数字を13で割ったあまりがｊであるような場合の数
dp[0][0] = 1#先頭０文字は”０”　で、１３で割ったあまりは０だから　dp[0][0] = 1
for i in range(n):
    for j in range(13):
        if s[i] == "?":
            for d in range(10):
                dp[i+1][(j*10+d)%13] += dp[i][j]
                dp[i+1][(j*10+d)%13] %= mod
                
        else:
            dp[i+1][(j*10+int(s[i]))%13] += dp[i][j]
            dp[i+1][(j*10+int(s[i]))%13] %= mod
ans = dp[n][5]
print(ans)
,b,c=map(int,input().split())

if a <=c <=b:
    print('Yes')
elif a >= c >= b
    print('Yes')
else:
    print('No')

### FIXED CODE ###



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

if a <=c <=b:
    print('Yes')
elif a >= c >= b:
    print('Yes')
else:
    print('No')
def dfs(n):
    global t
    S[n] = t
    DP[n]=1
    for i in A[n][2:]:
        if not DP[i]:
            t += 1
            dfs(i)
    t += 1
    F[n] = t
n = int(input())
d = deque()
A = [0]*(n+1)
S = [0]*(n+1)
F = [0]*(n+1)
DP = [0]*(n+1)
for i in range(n):
    A[i+1] = [int(i) for i in input().split()]
t = 1
dfs(1)
for i in range(1,n+1):
    tmp = "{} {} {}".format(i,S[i],F[i])
    print(tmp)


### FIXED CODE ###

def dfs(n):
    global t
    S[n] = t
    DP[n]=1
    for i in A[n][2:]:
        if not DP[i]:
            t += 1
            dfs(i)
    t += 1
    F[n] = t
n = int(input())
A = [0]*(n+1)
S = [0]*(n+1)
F = [0]*(n+1)
DP = [0]*(n+1)
for i in range(n):
    A[i+1] = [int(i) for i in input().split()]
t = 0
for i in range(1,n+1):
    if not DP[i]:
        t+=1
        dfs(i)
for i in range(1,n+1):
    tmp = "{} {} {}".format(i,S[i],F[i])
    print(tmp)
w = input()
a = "abcdefghijklmnopqrstuvwxyz"
co = 0
ch = True
for i in a:
    for j in w:
        if i == j:
            co += 1:
    if co % 2:
        ch = False
        break
    co = 0
    
    
if ch:
    print("yes")
else:
    print("No")

### FIXED CODE ###

w = input()
a = "abcdefghijklmnopqrstuvwxyz"
co = 0
ch = True
for i in a:
    for j in w:
        if i == j:
            co += 1
    if co % 2:
        ch = False
        break
    co = 0
    
    
if ch:
    print("Yes")
else:
    print("No")
import math

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

lcm = c*d//math.gcd(c,d)

b_num = b - b//c - b//d + b//lcm
a_num = a - a//c - a//d + a//lcm

ans = b_num - a_num + 1

print(int(ans))

### FIXED CODE ###

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

def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a

lcm = c*d//gcd(c,d)

b_num = b - b//c - b//d + b//lcm
a_num = (a-1) - (a-1)//c - (a-1)//d + (a-1)//lcm


ans = b_num - a_num

print(ans)
a, b, c = map(int, input().split())

print((int)a*b/2)

### FIXED CODE ###

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

print((int)(a*b/2))
x = list(int(input()))

num = 0

for i in x:
	num += i
    if x[i]==0:
    	break
print(num)



### FIXED CODE ###

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

num = 0

for i in range(5):
	num += 1
	if x[i] == 0:
		break
        
print(num)
import math

A,B,C,D=map(int, input().split())

def andiv(M,N):  #N以下でMで割り切れないものの数
    return((N//M) * (M-1) + N%M)

def lcm(a,b):  #最小公倍数
    return(a*b // math.gcd(a,b))

E = andiv(C,B) + andiv(D,B) - andiv(lcm(C,D),B)
F = andiv(C,A-1) + andiv(D,A-1) - andiv(lcm(C,D),A-1)

print(E-F)

### FIXED CODE ###

A,B,C,D=map(int, input().split())

def andiv(M,N):
    return((N//M) * (M-1) + N%M)

def gcd(a,b):
    while b!=0:
        a,b = b,a%b
    return a

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

E = andiv(C,B) + andiv(D,B) - andiv(lcm(C,D),B)
F = andiv(C,A-1) + andiv(D,A-1) - andiv(lcm(C,D),A-1)

print(int(E-F))
n = int(input())
a = []
for i in range(n):
    s, p = input().split()
# pを数値に
    p = int(p)
# i,s,pの並びで入れる
    a.append([i+1, s, p])

# 点数の高い順に並べる
a.sort(key=lambda x:x[2], reverse=True)
# レストラン名の辞書順に並べる
a.sort(key=lambda x:x[1])
# それぞれの市について、辞書順に点数の高い順に並べる
for i in range(n):
    print(book[i][0])

### FIXED CODE ###

n = int(input())
a = []
for i in range(n):
    s, p = input().split()
# pを数値に
    p = int(p)
# i,s,pの並びでlistを入れる
    a.append([i+1, s, p])

# 点数の高い順に並べる
a.sort(key=lambda x:x[2], reverse=True)
# レストラン名の辞書順に並べる
a.sort(key=lambda x:x[1])
# それぞれの市について、辞書順に点数の高い順に並べる
for i in range(n):
    print(a[i][0])
n: int = input()
number: int = []
count: int = 0
flag: bool = False

number = list(map(int, input().split()))
while flag != True:
    tmp: int = []
    for n in number:
        if n % 2 == 0:
            tmp.append(n / 2)

        else:
            flag = True
            break

    if flag:
        print(count)
        break

    number = tmp
    count += 1

### FIXED CODE ###

n = input()
number = []
count = 0
flag = False

number = list(map(int, input().split()))
while flag != True:
    tmp = []
    for n in number:
        if n % 2 == 0:
            tmp.append(n / 2)

        else:
            flag = True
            break

    if flag:
        print(count)
        break

    number = tmp
    count += 1
def main():
    a = [list(map(int, input().split())) for _ in range(3)]
    n = int(input())
    b = [int(input()) for _ in range(n)]
    card = [[0]*3]*3
    for i in range(n):
        for j in range(n):
            card[i][j]  == False
            for k in range(n):
                if a[i][j] == b[k]:
                    card[i][j] = True
    ans = "No"
    for i in range(3): #横に見てる
        if card[i][0] and card[i][1] and card[i][2]:
            ans = "Yes"
    for i in range(3): # 縦に見てる
        if card[0][i] and card[1][i] and card[2][i]:
            ans = "Yes"
    if card[0][0] and card[1][1] and card[2][2]:
        ans = "Yes"
    if card[0][2] and card[1][1] and card[2][0]:
        ans = "Yes"
    print(ans)

    
if __name__ == "__main__":
    main()

### FIXED CODE ###

def main():
    a = [list(map(int, input().split())) for _ in range(3)]
    n = int(input())
    b = [int(input()) for _ in range(n)]
    card = [[False]*3 for _ in range(3)]
    for i in range(3):
        for j in range(3):
            if a[i][j] in b:
                card[i][j] = True

    ans = "No"
    for i in range(3): #横に見てる
        if card[i][0] and card[i][1] and card[i][2]:
            ans = "Yes"
    for i in range(3): # 縦に見てる
        if card[0][i] and card[1][i] and card[2][i]:
            ans = "Yes"
    if card[0][0] and card[1][1] and card[2][2]:
        ans = "Yes"
    if card[0][2] and card[1][1] and card[2][0]:
        ans = "Yes"
    print(ans)

    
if __name__ == "__main__":
    main()