Harryxun/stf_run huggingface dataset:
import sys
input = sys.stdin.readline


def readstr():
    return input().strip()


def readint():
    return int(input())


def readnums():
    return map(int, input().split())


def readstrs():
    return input().split()


def main():
    abcd = list(map(int, list(readstr())))
    l = [['+', '+', '+'], ['+', '+', '-'], ['+', '-', '+'], ['+', '-', '-'], ['-', '+', '+'], ['-', '+', '-'], ['-', '-', '+'], ['-', '-', '-']]
    for ll in l:
        ans = abcd[0]
        for i, x in enumerate(ll):
            if x == '+':
                ans += abcd[i + 1]
            else:
                ans -= abcd[i + 1]
        if ans == 7:
            print(f'{abcd[0]}{ll[0]}{abcd[1]}{ll[1]}{abcd[2]}{ll[2]}{abcd[3]}=7')
            break


if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys
input = sys.stdin.readline


def readstr():
    return input().strip()


def readint():
    return int(input())


def readnums():
    return map(int, input().split())


def readstrs():
    return input().split()


def main():
    abcd = list(map(int, list(readstr())))
    l = [['+', '+', '+'], ['+', '+', '-'], ['+', '-', '+'], ['+', '-', '-'], ['-', '+', '+'], ['-', '+', '-'], ['-', '-', '+'], ['-', '-', '-']]
    for ll in l:
        ans = abcd[0]
        for i, x in enumerate(ll):
            if x == '+':
                ans += abcd[i + 1]
            else:
                ans -= abcd[i + 1]
        if ans == 7:
            s = ''
            for i in range(3):
                s += str(abcd[i]) + ll[i]
            s += str(abcd[3])
            print(s + '=7')
            break


if __name__ == "__main__":
    main()
from collections import defaultdict, deque
import sys, heapq, bisect, math, itertools, string, queue, copy, time
from fractions import gcd
import numpy as np
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7
EPS = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

n, k = map(int, input().split())
p_array = np.array(list(map(int, input().split())))
expc = lambda x: (x+1.0)/2.0
p_array = expc(p_array)

p_cum = np.cumsum(p_array)
p_cum_diff = p_cum[k:] - p_cum[0:n-k]
print(max(p_cum_diff))

### FIXED CODE ###

from collections import defaultdict, deque
import sys, heapq, bisect, math, itertools, string, queue, copy, time
from fractions import gcd
import numpy as np
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7
EPS = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

n, k = map(int, input().split())
p_array = np.array(list(map(int, input().split())))
expc = lambda x: (x+1.0)/2.0
p_array = expc(p_array)

p_cum = np.cumsum(p_array)
p_cum_diff = p_cum[k:] - p_cum[0:n-k]
if len(p_cum_diff) > 0:
    print(max(p_cum_diff))
else:
    print(p_cum[-1])
N = int(input())
T = list(str(N))

Sn = 0

for i in T:
    Sn += int(i)

if Sn % M == 0:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

N = int(input())
T = list(str(N))

Sn = 0

for i in T:
    Sn += int(i)

if N % Sn == 0:
    print("Yes")
else:
    print("No")
N, M = map(int, input().split())
L, R = 1, N

import math

def merge_list(target):
    L = target[-1][0]
    R = sorted(target, key=lambda x: x[1])[-1][1]
    return (L, R)

data = []
for i in range(0, M):
    l, r = input().split()
    data.append((int(l), int(r)))
data = sorted(data, key=lambda x: x[0])

import numpy as np
def saiki(totyuu):
    D = 2 # ぶんかつすう
    if len(totyuu) < 100:
        return merge_list(list(totyuu))
    else:
        return merge_list(np.array_split(totyuu, D))

data = saiki(data)

print(max(0, data[1]-data[0]+1))

### FIXED CODE ###

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

Ls = []
Rs = []
for i in range(0, M):
    l, r = input().split()
    Ls.append(int(l))
    Rs.append(int(r))

maxL = max(Ls)
minR = min(Rs)
result = max(0, minR-maxL+1)

print(result)
K=int(input())
S=input()
B=0
D=0
B=len(S)
B=int(B)
B=B+1
D=S+...
if B>=K:
    print(S)
else:
    print(D)


### FIXED CODE ###

K=int(input())
S=input()
if len(S)<=K:print(S)
else:print(S[0:K]+'...')
import sys
N, X = map(int,input().split())
x = 0
L.append(list(map(int,input().split())))
count = 1
for i in range(N):
    if x + L[i] <= X:
        count = count + 1
        x = x + L[i]
    else:
        print(count)
        sys.exit()
print(count)


### FIXED CODE ###

import sys
N, X = map(int,input().split())
x = 0
L = list(map(int,input().split()))
count = 1
for i in range(N):
    if x + L[i] <= X:
        count = count + 1
        x = x + L[i]
    else:
        print(count)
        sys.exit()
print(count)
import math
import sys

lines = input()
print(lines.reverse())

### FIXED CODE ###

import math
import sys

lines = input()
print(lines[::-1])
l = map(int, raw_input().split())

a = l[0]
b = l[1]
c = l[2]

if a < b && b < c :
    print('Yes')
else:
   print('No')



### FIXED CODE ###

l = map(int, raw_input().split())

a = l[0]
b = l[1]
c = l[2]

if a < b and b < c :
    print('Yes')
else:
   print('No')
while True:
    x = list(input())
    if x == "0":
        break
    sum = 0
    for i in range(len(x)):
        sum += int(x[i])
    print(sum)

### FIXED CODE ###

while True:
    x = list(input())
    if x[0] == "0":
        break
    sum = 0
    for i in range(len(x)):
        sum += int(x[i])
    print(sum)
    #print(x)
s=input()
if s[0::2]=='L' or s[1::2]=='R':
  print('No')
else('Yes')

### FIXED CODE ###

s=input()
if 'L' in s[0::2] or 'R' in s[1::2]:
  print('No')
else:
  print('Yes')
import math
import numpy as np
from decimal import *
L,A,B,M=map(int, input().split())

def matpow(X,n,mod):
  E = np.eye(N=X.shape[0],dtype=int)
  Y = X%mod
  if n == 1:
    return Y
  else:
    return np.dot(matpow(np.dot(Y,Y)%mod,n//2,mod), (Y if n % 2 else E))%mod
  
a = 0
for d in range(1,19):
  left = math.ceil(Decimal(10**(d-1)-A)/Decimal(B))
  right = math.ceil(Decimal(10**d-A)/Decimal(B))-1
  if right < 0:
    continue
  if left > L-1:
    break
  if left > right:
    continue
  if left < 0:
    left = 0
  if right > L-1:
    right = L-1
  mat = np.matrix([[10**d,0,0],[1,1,0],[0,1,1]])
  result = np.dot(np.array([a,A+B*left,B])%M, matpow(mat,right-left+1,M))
  a = result[0,0]%M
  
print(a)

### FIXED CODE ###

p,q,r=map(int, input().split()) 
x = max(p,q,r)
print(p+q+r-x)
s = input()
k = int(input())
cnt = 0
flag = 0
for i in range(len(s)-1):
  if s[i] == s[i+1]:
    cnt += 1
    if i-1 >=0 and s[i-1] == s[i] and flag == 0:
      cnt -= 1
      flag = 1
    else:
      flag = 0
  else:
    flag = 0
tmp = 0
if len(s)%2 and s.count(s[0]) == len(s):
  tmp = k//2

if s[0] == s[-1] and s[0] != s[1] and s[0] != s[-2]:
  tmp += k
print(cnt*k + tmp)


### FIXED CODE ###

from itertools import groupby

s = input()
k = int(input())
a = [sum(1 for _ in g) for _, g in groupby(s)]
if len(a) == 1:
  print(len(s) * k // 2)
else:
  ans = sum(x // 2 for x in a) * k
  if s[0] == s[-1] and a[0] & a[-1] & 1:
    ans += k - 1
  print(ans)
def main():
    def gcd(a, b):
        if b == 0:
            return a
        else:
            return gcd(b, a%b)

    def lcm(a, b):
        return int(a / gcd(a, b)) * b
    
    n, m = map(int, input().split())
    A = set([int(x) for x in input().split()])
    a_ = A[0]
    for a in A[1:]:
        a_lcm = lcm(a_, a)
        a_ = a_lcm
    if a_lcm / 2 > m:
        print(0)
    else:
        ans = int((m - (a_lcm / 2))) // a_lcm + 1
        print(ans)

if __name__ == '__main__':
    main()

### FIXED CODE ###

import copy
# from math import gcd


def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)

def lcm(a, b):
    return (a // gcd(a, b)) * b
def main():
    n, m = map(int, input().split())
    A = set([int(x) for x in input().split()])
    a_lcm = 1
    for a in A:
        a_lcm = lcm(a_lcm, a)
        # mがlcmの半分よりも小さかったら0
        if (a_lcm / 2) > m:
            print(0)
            exit()
    for a in A:
        if (a_lcm / 2) % a == 0:
            print(0)
            exit()
    # # あとは定数倍の数調べて終わり
    ans = int((m - (a_lcm / 2)) // a_lcm) + 1
    print(ans)

if __name__ == '__main__':
    main()
N = int(input())
S = []
for i in range(N):
    S.append(int(input()))

B=copy.copy(S)
B.sort()
if N>2:
	C=int(B[N-1])
	D=int(B[N-2])
	for i in S:
		if int(i)>=C:
			print(D)
		else:
			print(C)

else:
	print(S[1])
	print(S[0])

### FIXED CODE ###

import copy
N = int(input())
S = []
for i in range(N):
    S.append(int(input()))

B=copy.copy(S)
B.sort()
if N>2:
	C=int(B[N-1])
	D=int(B[N-2])
	for i in S:
		if int(i)>=C:
			print(D)
		else:
			print(C)

else:
	print(S[1])
	print(S[0])
X = int(input())

FIVES = [x ** 5 for x in range(200)]

for ki,vi in enumerate(FIVES):
    for kj,vj in enumerate(FIVES):
        if and vi - vj == X:
            print(ki,kj)
            exit()
        if vj - vi == X:
            print(kj,ki)
            exit()
        if vi + vj == X:
            print(ki,-kj)
            exit()



### FIXED CODE ###

X = int(input())

FIVES = [x ** 5 for x in range(200)]

for ki,vi in enumerate(FIVES):
    for kj,vj in enumerate(FIVES):
        if vi - vj == X:
            print(ki,kj)
            exit()
        if vj - vi == X:
            print(kj,ki)
            exit()
        if vi + vj == X:
            print(ki,-kj)
            exit()
from fractions import gcd
N = int(input())
Alist = list(map(int, input().split()))
Rlist = [0]*(N+2)
Llist = [0]*(N+1)
for i in range(N):
    Llist[i+1] = gcd(Llist[i], Alist[i])
    Rlist[N-i] = gcd(Rlist[N-i+1], Alist[N-i+1])
print(max([gcd(Rlist[i], Llist[i]) for i in range(N)])

### FIXED CODE ###

from fractions import gcd
N = int(input())
Alist = [0]+list(map(int, input().split()))+[0]
Rlist = [0]*(N+2)
Llist = [0]*(N+1)
for i in range(N):
    Llist[i+1] = gcd(Llist[i], Alist[i])
    Rlist[N-i] = gcd(Rlist[N-i+1], Alist[N-i+1])
print(max([gcd(Rlist[i], Llist[i]) for i in range(1,N+1)]))
def main():
    from collections import Counter

    n = int(input())
    *a, = map(int, input().split())

    if n % 3 == 0:
        ctr = Counter(a)
        if (len(ctr) == 1) and (0 in Counter):
            print('Yes')
            return
        elif len(ctr) == 3:
            it = iter(ctr.keys())
            x = next(it)
            y = next(it)
            z = next(it)
            print('Yes' if x ^ y == z else 'No')
            return
    else:
        print('Yes' if all(map(lambda x: x == 0, a)) else 'No')
        return


if __name__ == '__main__':
    main()


### FIXED CODE ###

from collections import defaultdict

n = int(input())
a = tuple(map(int, input().split()))

if n == 3:
    if a[0] ^ a[2] == a[1] and a[1] ^ a[2] == a[0] and a[0] ^ a[1] == a[2]:
        print('Yes')
    else:
        print('No')
elif n % 3 == 0:
    d = defaultdict(int)
    for aa in a:
        d[aa] += 1
    m = n // 3
    bl = True
    t = []
    for k, v in d.items():
        if v % m != 0:
            bl = False
            break
        else:
            q = v // m
            t.append((k, q))

    if len(t) == 3:
        if t[0][0] ^ t[1][0] == t[2][0] and t[1][0] ^ t[2][0] == t[0][0] and t[2][0] ^ t[0][0] == t[1][0]:
            pass
        else:
            bl = False
    elif len(t) == 2:
        if t[0][1] > t[1][1]:
            if t[0][0] ^ t[0][0] == t[1][0] and t[0][0] ^ t[1][0] == t[0][0]:
                pass
            else:
                bl = False
        else:
            if t[1][0] ^ t[1][0] == t[0][0] and t[0][0] ^ t[1][0] == t[1][0]:
                pass
            else:
                bl = False


    elif len(t) == 1:
        if t[0][0] != 0:
            bl = False

    print('Yes' if bl else 'No')

else:
    if all(aa == 0 for aa in a):
        print('Yes')
    else:
        print('No')
import sys
sys.setrecursionlimit(200000000)
n = int(input())

if n == 1:
    print(t[0])
    exit()
# 最大公約数
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a%b)
# 最小公倍数
def lcm(a, b):
    return a * b / gcd(a, b)
res = 1
for i in range(n):
    t = int(input())
    res = int(lcm(res, t))
print(res)

### FIXED CODE ###

n = int(input())
t = [int(input()) for _ in range(n)]

# 最大公約数
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a%b)
# 最小公倍数
def lcm(a, b):
    return a * b // gcd(a, b)
res = 1
for i in range(n):
    res = lcm(res, t[i])
print(res)
a= int(input())
b= int(input())
print(max(a+b,a-b,a*b))

### FIXED CODE ###

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

c = a+b
d = a-b
e = a*b
print(max(c,d,e))
#asfddddddd
n, m  = map(int, input().split())
print(m + m - n)

### FIXED CODE ###

#asfddddddd
n = int(input())
m = int(input())
print(m + m - n)
n,k=map(int,input().split())
s=input()
if s[k-1]=='A':
  s[k-1]='a'
elif s[k-1]=='B':
  s[k-1]='b'
else:
  s[k-1]='c'
print(s)

### FIXED CODE ###

n,k=map(int,input().split())
s=input()
if s[k-1]=='A':
  s = s[:k-1] + "a" + s[k:]
elif s[k-1]=='B':
  s=s[:k-1] + "b" + s[k:]
else:
  s=s[:k-1] + "c" + s[k:]
print(s)
import math
X=int(input())
n=math.sqrt(X)
if X==2:
  print(X)
else:
  for i in range(2,n):
    if X%i==0:
      X+=1
  print(X)


### FIXED CODE ###

import math
X=int(input())
while True:
    for i in range(2,int(math.sqrt(X))+1):
      if X%i==0:
        X+=1
        break
    else:
      print(X)
      break
n, d = [ int(_) for _ in input().split() ]
x  = n / (2*d+1)
if x.is_integer()
    print( x )
else:
    print( x + 1 )





### FIXED CODE ###

n, d = [ int(_) for _ in input().split() ]
x  = n / (2*d+1)

if x.is_integer():
    print( int(x//1) )
else:
    print( int( (x//1) + 1) )
n = int(input())
arr = [int(x) for x in input().split()]

def countTwoInFactor(n):
   def countTwoInFactori(n, acc):
      return countTwoInFactori(n / 2, acc + 1) if n % 2 == 0 else acc
   return countTwoInFactori(n, 0)

arr2 = [countTwoInFactor(x) for x in arr]
arr2.sort()
print(arr2[0])


### FIXED CODE ###

def count(lst, x):
   ctr = 0
   for i in lst:
      if i == x:
         ctr += 1
   return ctr

s = [x for x in input()]
print(count(s, "1"))
K = int(raw_input())

res = range(51)

k = K/50
mod = K%50

for i in res:
    res[i] = i+k

res.pop(51-mod)

print 50
for i in range(len(res)):print res[i],

### FIXED CODE ###

K = int(raw_input())

res = range(51)

k = K/50
mod = K%50

for i in res:
    res[i] = i+k

res.pop(-1-mod)


print 50
for i in range(len(res)):print res[i],
from collections import deque

S=deque(str((input())))
Q=int(input())
t=0
for _ in range(Q):
    T=list(map(str,input().split()))
    if T[0]=="1":
        t+=1
    else:
        if (T[1]=="1" and t%2 == 0) or (T[1]=="2" and t%2 != 0):
            S.insert(0,T[2])
        else:
            S.append(T[2])


if t%2 != 0:
    S.reverse()

print("".join(S))

### FIXED CODE ###

from collections import deque

S=deque(str((input())))
Q=int(input())
t=0
for _ in range(Q):
    T=list(map(str,input().split()))
    if T[0]=="1":
        t+=1
    else:
        if (T[1]=="1" and t%2 == 0) or (T[1]=="2" and t%2 != 0):
            S.appendleft(T[2])
        else:
            S.append(T[2])


if t%2 != 0:
    S.reverse()

print("".join(S))
S=input()
if S="SUN":
  print("7")
elif S="MON":
  print("6")
elif S="TUE":
  print("5")
elif S="WED":
  print("4")
elif S="THU":
  print("3")
elif S="FRI":
  print("2")
elif S="SAT":
  print("1")

### FIXED CODE ###

S=input()
if S=="SUN":
  print("7")
elif S=="MON":
  print("6")
elif S=="TUE":
  print("5")
elif S=="WED":
  print("4")
elif S=="THU":
  print("3")
elif S=="FRI":
  print("2")
elif S=="SAT":
  print("1")
n = int(input())
p = list(map(int, input().split()))
ans = 0
for i in range(n):
  if p[i] == i+1:
    p[i], p[i+1] = p[i+1], p[i]
    ans += 1
print(ans)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
ans = 0
i = 0
while i < n:
  if i+1 == a[i]:
    ans += 1
    i += 1
  i += 1
    
print(ans)
n = int(input())
d = list(map(int,input().split()))
d.sort()
m = int(input())
t = list(map(int,input().split()))
t.sort()
for x in d:
    if x == t[0]:
        t.pop(0)
if len(t)==0:
    print("YES")
else:
    print("NO")


### FIXED CODE ###

from itertools import accumulate
from math import*
from collections import deque
from collections import defaultdict
from itertools import permutations
from heapq import*
from collections import Counter
from itertools import*
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf = 10**18
mod = 10**9+7
from functools import reduce
import sys
sys.setrecursionlimit(10**7)

input()
d = Counter(map(int,input().split()))
input()
t = Counter(map(int,input().split()))
d.subtract(t)
if -d:
    print("NO")
else:
    print("YES")
# -*- coding: utf-8 -*-
class weightRtree:
    def __init__(self, num):
        self.num = num
        self.weight = [0] * (num+1) 
      
    def add(self, v, w):
        if v == 0:
            return 0
        while v <= self.num:
            self.weight[v] += w
            v += (-v) & v    

    def getSum(self, u):
        temp = 0
        while u > 0:
            temp += self.weight[u]
            u -= (-u) & u
        return temp

N = int(input())
left = [0] * N
right = [0] * N
Tree = [set(map(int, input().split()[1:])) for i in range(N)]

def DFS(count, source):
    count += 1
    left[source] = count
    for item in Tree[source]:
        count = DFS(count, item)
    count += 1
    right[source] = count
    return count

Object = weightRtree(DFS(1, 0))

Q = int(input())
for i in range(Q):
    alist = list(map(int, input().split()))
    if not alist[0]:
        Object.add(left[alist[1]], alist[2])
        Object.add(right[alist[1]], -alist[2])
    else:
        print(Object.getSum(right[alist[1]] - 1))




### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(1000000)

class weightRtree:
    def __init__(self, num):
        self.num = num
        self.weight = [0] * (num+1) 
      
    def add(self, v, w):
        if v == 0:
            return 0
        while v <= self.num:
            self.weight[v] += w
            v += (-v) & v    

    def getSum(self, u):
        temp = 0
        while u > 0:
            temp += self.weight[u]
            u -= (-u) & u
        return temp

N = int(input())
left = [0] * N
right = [0] * N
Tree = [set(map(int, input().split()[1:])) for i in range(N)]

def DFS(count, source):
    count += 1
    left[source] = count
    for item in Tree[source]:
        count = DFS(count, item)
    count += 1
    right[source] = count
    return count

Object = weightRtree(DFS(1, 0))

Q = int(input())
for i in range(Q):
    alist = list(map(int, input().split()))
    if not alist[0]:
        Object.add(left[alist[1]], alist[2])
        Object.add(right[alist[1]], -alist[2])
    else:
        print(Object.getSum(right[alist[1]] - 1))
N =int(input())
H = list(map(int, input().split()))
#総数Nで、N番目の添字はN-1
flog = 0

#メモ化再帰
memo = [-1]*N
memo[0] = 0
memo[1] = abs(H[1]-H[0])
def func(n,memo):
  if memo[n] != -1:
    return memo[n]
  else:
    min_c = min(func(n-1,memo)+abs(H[n]-H[n-1]),func(n-2,memo)+abs(H[n]-H[n-2]))
    memo[n] = min_c
  return min_c

print(func(N-1,memo))

### FIXED CODE ###

N =int(input())
H = list(map(int, input().split()))
#総数Nで、N番目の添字はN-1
flog = 0

#足場iにたどり着くための最小コストをリスト化
mincost= []
for i in range(N):
  if i == 0:
    c = 0
  elif i == 1:
    c = abs(H[1]-H[0])
  else:
    c = min(abs(H[i]-H[i-1])+mincost[i-1],abs(H[i]-H[i-2])+mincost[i-2])
  mincost.append(c)

print(mincost[N-1])
from fractions import gcd
from functools import reduce

n=int(input());Alist=list(map(int,input().split()))

def gcd_L(numbers):
    return reduce(gcd, numbers)

M_list = []
for i in range(n):
    alist = Alist[:i] + Alist[i+1:]
    M_list.append(gcd_L(alist))

print(max(M_list))

### FIXED CODE ###

a,b,t = map(int,input().split())
print(0 if a>t else (t//a)*b)
def dfs(r, c):
    global c, color, G
    S = [r]
    color[r] = c
    while (0 < len(S)):
        u = S.pop()
        for u in G[u]:
            v = color[u]
            if (v == None):
                color[u] = c
                S.append(u)
 
def assignColor():
    global c, color, G, n
    c = 1
    for i in range(n):
        if (color[i] == None):
            dfs(i, c)
            c += 1
 
n, m = list(map(int, input().split()))
 
G = [None for i in range(n)]
for i in range(m):
    s, t = list(map(int, input().split()))
    G[s].append(t)
    G[t].append(s)
 
color = [False for i in range(n)]
 
assignColor()
 
q = int(input())

for i in range(q):
    s, t = list(map(int, input().split()))
    if (color[s] == color[t]):
        print("yes")
    else:
        print("no")

### FIXED CODE ###

def dfs(r, c):
    global color, G
    S = [r]
    color[r] = c
    while (0 < len(S)):
        u = S.pop()
        for u in G[u]:
            v = color[u]
            if (v == None):
                color[u] = c
                S.append(u)
 
def assignColor():
    global color, G, n
    c = 1
    for i in range(n):
        if (color[i] == None):
            dfs(i, c)
            c += 1
 
n, m = list(map(int, input().split()))
 
G = [[] for i in range(n)]
for i in range(m):
    s, t = list(map(int, input().split()))
    G[s].append(t)
    G[t].append(s)
 
color = [None for i in range(n)]
 
assignColor()
 
q = int(input())

for i in range(q):
    s, t = list(map(int, input().split()))
    if (color[s] == color[t]):
        print("yes")
    else:
        print("no")
import math
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r)*math.factorial(r))

n,m=map(int(i) ,input().split())
a1=[int(input()) for i in range(m)]
a1.append(n+1)
c1=1
a2=0
for i in a1:
    a3=i-1-a2
    c2=0
    for j in range(a3//2+1):
        c2+=combinations_count(a3-j,j)
    c1=(c1*c2)%(1000000007)
    a2=i+1
    if c1==0:
        break



print(c1)


### FIXED CODE ###

#フィボナッチ数列か…
#c問題も解けないのか…
#典型問題なんだろうな
#踏めない段の分は除いて考えれば良い
n,m=input().split()
n,m=int(n),int(m)
ax=[1]*(n+1)
for i in range(m):
    ax[int(input())]=0
bx=[1,1]
for i in range(2,n+1):
    if ax[i-1]==1:
        f1=bx[i-1]
    else:
        f1=0
    if ax[i-2]==1:
        f2=bx[i-2]
    else:
        f2=0
    bx.append((f1+f2)%(10**9+7))

print(bx[n])
N = input()
S = input()
temp = ""
for cnt in S
	if temp != cnt:
    	temp = cnt
        lst += cnt
n = len(lst)
print("n")

### FIXED CODE ###

N = input()
S = input()
temp = ""
lst = ""
for cnt in S:
    if temp != cnt:
        temp = cnt
        lst += cnt
print(len(lst))
a = [list(map(int,input().split())) for i in range(3)]
n = int(input())
b = [int(input()) for i in range(n)]
for number in b:
    for i in range(3):
        if number in a[i]:
            a[i][a[i].index(number)] = 0
if a[0][0] == a[1][1] == a[2][2] == 0　and a[2][0] == a[1][1] == a[0][2]:
    print('Yes')
else:
    for i in range(3):
        if a[i][0] == a[i][1] == a[i][2] == 0:
            print('Yes')
            break
        elif a[0][i] == a[1][i] == a[2][i] == 0:
            print('Yes')
            break
    else:
        print('No')

### FIXED CODE ###

a = [list(map(int,input().split())) for i in range(3)]
n = int(input())
b = [int(input()) for i in range(n)]
for number in b:
    for i in range(3):
        if number in a[i]:
            a[i][a[i].index(number)] = 0
if a[0][0] == a[1][1] == a[2][2] == 0 or a[2][0] == a[1][1] == a[0][2] == 0:
    print('Yes')
else:
    for i in range(3):
        if a[i][0] == a[i][1] == a[i][2] == 0:
            print('Yes')
            break
        elif a[0][i] == a[1][i] == a[2][i] == 0:
            print('Yes')
            break
    else:
        print('No')
seki = 0
for m in range(1, M + 1):
    for d in range(1, D + 1):
        d10, d1 = divmod(d, 10)
        if d10 >= 2 and d1 >= 2 and d10 * d1 == m:
            seki += 1
print(seki)

### FIXED CODE ###

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

seki=0
for m in range(1,M+1):
    for d in range(1,D+1):
        str_d = str(d)
        if len(str_d)==2:
            d10 = int(str_d[0])
            d1  = int(str_d[1])
            if d10 >= 2 and d1 >= 2 and d10*d1 == m:
                seki+=1
print(seki)