Harryxun/stf_run huggingface dataset:
import math
import os
import sys

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")

N, X = list(map(int, sys.stdin.readline().split()))
S = list(map(int, sys.stdin.readline().split()))
MOD = 10 ** 9 + 7

S.sort()


# @lru_cache(maxsize=None)
# def test2(x, si):
#     # S[si] を最初にとったとき、最終的な数値の期待値
#     if si == 0:
#         return x % S[si]
#
#     ret = 0
#     for j in range(si):
#         ret += test2(x % S[si], si=j)
#     return ret / si


# dp = np.zeros((N, X + 1))
# dp[0] = np.arange(X + 1) % S[0]
# for i in range(1, N):
#     for x in range(X + 1):
#         dp[i][x] = np.mean(dp[:i, x % S[i]])
# print(dp[:, X].sum() * math.factorial(N) / N % MOD)


dp = np.arange(X + 1) % S[0]
for i in range(1, N):
    dp += dp[np.arange(X + 1) % S[i]] / i
print(int(dp[X] * math.factorial(N) / N % MOD))


### FIXED CODE ###

import math
import os
import sys

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")

N, X = list(map(int, sys.stdin.readline().split()))
S = list(map(int, sys.stdin.readline().split()))
MOD = 10 ** 9 + 7


def mod_invs(max, mod):
    """
    逆元のリスト 0 から max まで
    :param max:
    :param mod:
    :return:
    """
    invs = [1] * (max + 1)
    for x in range(2, max + 1):
        invs[x] = (-(mod // x) * invs[mod % x]) % mod
    return invs


S.sort()

invs = mod_invs(N, MOD)
dp = np.arange(X + 1) % S[0]
for i in range(1, N):
    dp += dp[np.arange(X + 1) % S[i]] * invs[i]
    dp %= MOD
print(int(dp[X] * math.factorial(N) % MOD * invs[N] % MOD))
from collections import deque
n=int(input())
a=deque([int(i) for i in input().split()])
b=deque()
for i in range(n):
    if i % 2 == 0:
        b.append(a.popleft())
    else:
        b.appendleft(a.popleft())
    
if n%2==0:
    print(*b)
else:
    print(*b[::-1])

### FIXED CODE ###

from collections import deque
n=int(input())
a=deque([int(i) for i in input().split()])
b=deque()

if n%2==0:
    for i in range(n):
        if i % 2 == 0:
            b.append(a.popleft())
        else:
            b.appendleft(a.popleft())
else:
    for i in range(n):
        if i % 2 == 0:
            b.appendleft(a.popleft())
        else:
            b.append(a.popleft())
print(*b)
import sys

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

sys.setrecursionlimit(M+N)

v_neighbor = [[] for _ in range(N)]
for _ in range(M):
    a, b = map(int, input().split())
    v_neighbor[a-1].append(b-1)
    v_neighbor[b-1].append(a-1)


v_visit = [False for _ in range(N)]

def search(n):
    count = 0
    for n_ in set(v_neighbor[n]):
        if not v_visit[n_]:
            v_visit[n_] = True
            count += 1
            count += search(n_)
    return count

res = 1
for i in range(N):
    if v_visit[i]:
        continue
    search_res = search(i)
    res = max(res, search_res)


print(res)


### FIXED CODE ###

import sys

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

sys.setrecursionlimit(10**7)

v_neighbor = [[] for _ in range(N)]
for _ in range(M):
    a, b = map(int, input().split())
    v_neighbor[a-1].append(b-1)
    v_neighbor[b-1].append(a-1)


v_visit = [False for _ in range(N)]

def search(n):
    count = 0
    for n_ in set(v_neighbor[n]):
        if not v_visit[n_]:
            v_visit[n_] = True
            count += 1
            count += search(n_)
    return count

res = 1
for i in range(N):
    if v_visit[i]:
        continue
    search_res = search(i)
    res = max(res, search_res)


print(res)
import numpy as np

def resolve():
    input()
    x = list(map(int, input().split()))
    m = int(round(np.median(x)))
    sum = 0
    for val in x:
        sum += (val - m) ** 2
    print(sum)

if __name__ == '__main__':
    resolve()

### FIXED CODE ###

import numpy as np

def resolve():
    input()
    x = list(map(int, input().split()))
    m = int(round(np.mean(x)))
    sum = 0
    for val in x:
        sum += (val - m) ** 2
    print(sum)

if __name__ == '__main__':
    resolve()
a,b,c=map(int,input().split())
if abs(a-c)<=d:
  print('Yes')
elif abs(a-b)<=d and abs(b-c)<=d:
  print('Yes')
else:
  print('No')


### FIXED CODE ###

a,b,c,d=map(int,input().split())
if abs(a-c)<=d:
  print('Yes')
elif abs(a-b)<=d and abs(b-c)<=d:
  print('Yes')
else:
  print('No')
import math
N = int(input())
print(int(2 * N / math.gcd(2, N)))

### FIXED CODE ###

N = int(input())
if N % 2 == 0:
	print(N)
else:
	print(2 * N)
def check(x, A, B):
    if int(x * 0.08) == A and int(x * 0.1) == B:
        return True
    else:
        return False

def solve(A, B):
    left = 0
    right = 1250
    ans = []
    for i in range(0, 1251):
        if check(i, A, B):
            print(i)
            exit()
	print(-1)


def main():
    A, B = map(int, input().split())

    solve(A, B)

if __name__ == "__main__":
    main()

### FIXED CODE ###

def check(x, A, B):
    if int(x * 0.08) == A and int(x * 0.1) == B:
        return True
    else:
        return False

def solve(A, B):
    left = 0
    right = 1250
    ans = []
    for i in range(0, 1251):
        if check(i, A, B):
            print(i)
            exit()
    print(-1)

def main():
    A, B = map(int, input().split())

    solve(A, B)

if __name__ == "__main__":
    main()
x = raw_input().split()
m = map(int,x)
m.sort()
a = m[0]
b = m[1]
c = m[2]

print a,b,c

### FIXED CODE ###

a = list(map(int,input().split()))
for i in range(len(a)):
    for j in range(i,len(a)):
        if a[i] > a[j]:
            ret = a[i]
            a[i] = a[j]
            a[j] = ret
print(" ".join(list(map(str,a))))
a,b,k = map(int,input().split())
m = min(a,b)
count = 0
for i in range(m,0,-1):
  if i == 0 :
    break:
  if a%i == 0 and b%i == 0:
    count += 1
  if count == k:
    break:
print(i)

### FIXED CODE ###

a,b,k = map(int,input().split())
m = min(a,b)
count = 0
for i in range(m,0,-1):
  if i == 0:
    break
  if a%i == 0 and b%i == 0:
    count += 1
  if count == k:
    break
print(i)
# 初期入力
#import numpy as np
import sys
input = sys.stdin.readline
N,M = (int(i) for i in input().split())
A = list(map(int, input().split()))
take =[[-1] for i in range(M)]
for x in range(M):
    B,C = (int(i) for i in input().split())
    take[x] =B,C

#
A.sort()
take.sort(key=lambda x: x[1], reverse=True)
take =[(0,0)] +take
ind =[0]*(M+1)
for i in range(1,M+1): #初項に「０」足したから「M]まで
    ind[i] =ind[i-1] +take[i][0]
    if ind[i-1] >N:
        break
    elif A[ind[i-1]] >take[i][1]:
        break
    elif ind[i] <N and A[ind[i]] <take[i][1]: #全て一括で置き換える
        A[ind[i-1] :ind[i]] =[take[i][1] ] *(take[i][0]) 
    else:
        for j in range(ind[i-1],ind[i]): #最後は1つずつ確認しながら置き換える
            if N <= j:
                break
            if A[j] <take[i][1]:
                A[j] =take[i][1]
            else:
                break
print(sum(A))

### FIXED CODE ###

# 初期入力
#import numpy as np
import sys
input = sys.stdin.readline
N,M = (int(i) for i in input().split())
A = list(map(int, input().split()))
take =[[-1] for i in range(M)]
for x in range(M):
    B,C = (int(i) for i in input().split())
    take[x] =B,C

#
A.sort()
take.sort(key=lambda x: x[1], reverse=True)
take =[(0,0)] +take
ind =[0]*(M+1)
for i in range(1,M+1): #初項に「０」足したから「M]まで
    ind[i] =ind[i-1] +take[i][0]
    if ind[i-1] >=N:
        break
    elif A[ind[i-1]] >=take[i][1]:
        break
    elif ind[i] <N and A[ind[i]] <take[i][1]: #全て一括で置き換える
        A[ind[i-1] :ind[i]] =[take[i][1] ] *(take[i][0]) 
    else:
        for j in range(ind[i-1],ind[i]): #最後は1つずつ確認しながら置き換える
            if N <= j:
                break
            if A[j] <take[i][1]:
                A[j] =take[i][1]
            else:
                break
print(sum(A))
N = int(input())
H = list(map(int,input().split()))
ans = []
temp = 0

for i in range(N-1):
    if H[i] >= H[i+1]:
        temp += 1
    else:
        temp = 0
    ans.append(temp)
        
print(max(ans))

### FIXED CODE ###

N = int(input())
H = list(map(int,input().split()))
temp = 0
ans = []

for i in range(N-1):
    if H[i] >= H[i+1]:
        temp += 1
    else:
        ans.append(temp)
        temp = 0
ans.append(temp)

print(max(ans))
d,t,s = map(int,input().split())

if t*s >= D:
    prrint("Yes")

else:
    print("No")

### FIXED CODE ###

d,t,s = map(int,input().split())

if t*s >= d:
    print("Yes")

else:
    print("No")
import sys

class TreeNode:
    def __init__(self, val):
        self.val = val
        self.left = self.right = None

class BST:
    def __init__(self):
        self.root = None
    
    def insert(self, node):
        def helper(root):
            if root is None:
                root = node
            elif node.val < root.val:
                lr = helper(root.left)
                root.left = lr
            else:
                rr = helper(root.right)
                root.right = rr
            return root
            
        self.root = helper(self.root)
    
    def inorder(self):
        def helper(root):
            if root is None:
                return []
            else:
                return helper(root.left) + [root.val] + helper(root.right)
        return helper(self.root)

if __name__ == '__main__':
    q = sys.stdin.readline()
    q = int(q)
    bst = BST()
    for i in range(q):
        tmp = sys.stdin.readline()
        if tmp.startswith('print'):
            print ' '.join(map(lambda x: str(x), bst.inorder()))
        else:
            _, val = tmp.split()
            node = TreeNode(int(val))
            sys.stdout.write(' '.join(map(lambda x: str(x), bst.insert(node)) + '\n'))

### FIXED CODE ###

import sys

class TreeNode:
    def __init__(self, val):
        self.val = val
        self.left = self.right = None

class BST:
    def __init__(self):
        self.root = None
    
    def insert(self, node):
        def helper(root):
            y, x = None, root
            while isinstance(x, TreeNode):
                y = x
                if node.val < x.val:
                    x = x.left
                else:
                    x = x.right
            if y is None:
                root = node
            elif node.val < y.val:
                y.left = node
            else:
                y.right = node
            return root
            
        self.root = helper(self.root)
    
    def inorder(self):
        def helper(root):
            return [] if root is None else helper(root.left) + [root.val] + helper(root.right)
        return helper(self.root)

    def preorder(self):
        def helper(root):
            return [] if root is None else [root.val] + helper(root.left) + helper(root.right)
        return helper(self.root)

if __name__ == '__main__':
    q = sys.stdin.readline()
    q = int(q)
    bst = BST()
    for i in range(q):
        tmp = sys.stdin.readline()
        if tmp.startswith('print'):
            print ' ' + ' '.join(map(lambda x: str(x), bst.inorder()))
            print ' ' + ' '.join(map(lambda x: str(x), bst.preorder()))
        else:
            _, val = tmp.split()
            node = TreeNode(int(val))
            bst.insert(node)
import fractions

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

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

f = lcm(a[0], a[1])
for i in range(2, N):
    f = lcm(f, a[i])

if 1 <= f//2 <= M:
    print((M-f//2)//f + 1)
else:
    print(0)

### FIXED CODE ###

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

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

def div2(x):
    c = 0
    while x%2==0:
        x //= 2
        c+=1
    return c

def test():
    N, M = map(int, input().split())
    a = list(map(int, input().split()))
    for i in range(N):
        if a[i]%2 == 1:
            return 0
        a[i] //= 2

    t = div2(a[0])
    for i in range(N):
        if div2(a[i]) != t:
            return 0
        a[i] >>= t
    M >>= t

    L = a[0]
    for i in range(1, N):
        L = lcm(L, a[i])
        if L > M:
            return 0

    ans = (M-L)//(2*L)+1
    return ans

print(test())
s = input()
A, B, C, K = s.split(" ")
 
if K <= A:
  print(K)
elif K <= A + B:
  print(A)
elif K <= A + B + C:
  print(A - (K - A - B))

### FIXED CODE ###

S = input()
T = input()

if len(T) != len(S) + 1:
  print("Yes")
else:
  if T.startswith(S):
    print("Yes")
  else:
    print("No")
import sys

for line in sys.stdin:
  r = line

return r*r

### FIXED CODE ###

print(int(input())**2)
# 制約条件
MAX_RESULT = 1000000000000000000

N = int(input())
A1 = [int(x) for x in input().split()]

tmp = 1

for x in range(len(A1)):
    tmp = tmp * A1[x]

result = tmp

if (result > MAX_RESULT):
    result = -1

print(result)

### FIXED CODE ###

a,b = map(int,input().split())
print(a*b)
k, x = input(""). split("")
k = int(k)
x = int(x)

l = x - k + 1
m = x + k

for i in range(l, m):
    print(i)

### FIXED CODE ###

k, x = input() .split()
k = int(k)
x = int(x)

l = x - k + 1
m = x + k

for i in range(l, m):
    print(i)
N = int(input())
s, t = map(input().split())

for i in range(N):
  print(s[i], t[i], seq = '')
  
  

### FIXED CODE ###

N = int(input())
s, t = input().split()

new = list()
for i in range(N):
  new.append(s[i])
  new.append(t[i])
  
print(*new, sep='')
def solve(A):
    current_max = 2
    current_min = 2
    for a_k in reversed(A):
        if current_max < a_k:
            print('-1')
            return

        current_max = (current_max // a_k) * a_k + (a_k - 1)
        current_min = ((current_min - 1) // a_k + 1) * a_k
        current_min = max(current_min, a_k)

    print("{} {}".format(current_min, current_max))
    return


if __name__ == '__main__':
    K = int(input())
    A = list(map(int, input().split()))
    solve(A)


### FIXED CODE ###

N, A, B = map(int, input().split())
if (B - A) & 1:
    print("Borys")
else:
    print("Alice")
a=list(map(int,input().split()))
print(a.index(0)+1)


### FIXED CODE ###

x,y=map(int,input().split())
if y%2==0 and 2*x<=y and y<=4*x:
  print("Yes")
else:
  print("No")
S = input()
if S[3] == S[4] and S[5] == S[6]:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

S = input()
if S[2] == S[3] and S[4] == S[5]:
    print('Yes')
else:
    print('No')
while True:
  ( H, W) = [ int(i) for i in input().split() ]
  if H == W == 0: break
  for h in range(H): print( '#' * w)

### FIXED CODE ###

while True:
  ( H, W) = [ int(i) for i in input().split() ]
  if H == W == 0: break
  for h in range(H): print( '#' * W)
  print()
from itertools import *
from heapq import *

def solve(H, W, grid):
  goal = (H-1, W-1)
  fixed = set()
  candicates = [(grid[0,0], (0, 0))]
  while 1:
    dist, p = heappop(candicates)
    if p == goal:
      return dist
    if p in fixed:
      continue
    fixed.add(p)
    for i range(2):
      p1 = p[0]+i, p[1]+(1-i)
      if not (p1[0]<H and p1[1]<W) or p1 in fixed:
        continue
      x, y = p
      x1, y1 = p1
      heappush(candicates, (dist+(grid[p1] & ~grid[p]), p1))
  return None

H, W = map(int, input().split())
grid = {(i,j): int(c=="#") for i in range(H) for j, c in enumerate(input())}

print(solve(H, W, grid))



### FIXED CODE ###

from itertools import *
from heapq import *

def solve(H, W, grid):
  goal = (H-1, W-1)
  fixed = set()
  candicates = [(grid[0,0], (0, 0))]
  while 1:
    dist, p = heappop(candicates)
    if p == goal:
      return dist
    if p in fixed:
      continue
    fixed.add(p)
    for i in range(2):
      p1 = p[0]+i, p[1]+(1-i)
      if not (p1[0]<H and p1[1]<W) or p1 in fixed:
        continue
      x, y = p
      x1, y1 = p1
      heappush(candicates, (dist+(grid[p1] & ~grid[p]), p1))
  return None

H, W = map(int, input().split())
grid = {(i,j): int(c=="#") for i in range(H) for j, c in enumerate(input())}

print(solve(H, W, grid))
# -*- coding: utf-8 -*-
from collenctions import deque

S = input()
Q = int(input())

querys = []
op1_cnt = 0
op2_cnt = 0
prefix = deque()
suffix = deque()
for i in range(Q):
    query = input()
    if len(query) == 1:
        op1_cnt += 1

        if op2_cnt != 0:
            prefix.extend(S)
            prefix.extend(suffix)
            S = ''.join(prefix)
            prefix.clear()
            suffix.clear()
            op2_cnt = 0

    else:
        op2_cnt += 1

        if op1_cnt % 2 != 0:
            S = S[::-1]

        op1_cnt = 0

        t, F, C = query.split()
        if F == "1":
            prefix.appendleft(C)
        else:
            suffix.append(C)

if op1_cnt % 2 != 0:
    S = S[::-1]

if op2_cnt != 0:
    prefix.extend(S)
    prefix.extend(suffix)
    S = ''.join(prefix)


print(S)


### FIXED CODE ###

# -*- coding: utf-8 -*-
S = input()
Q = int(input())

reverse = 0
head = []
tail = []
for i in range(Q):
    query = input()
    if len(query) == 1:
        reverse = (reverse + 1) % 2

    else:
        t, F, C = query.split()
        if reverse == 0:
            if F == "1":
                head.append(C)
            else:
                tail.append(C)
        else:
            if F == "1":
                tail.append(C)
            else:
                head.append(C)

if reverse == 0:
    S = ''.join(head[::-1] + list(S) + tail)
else:
    S = ''.join(tail[::-1] + list(S[::-1]) + head)


print(S)
n = input()
sn = sum(map(int, n))

print('Yes' if n % sn == 0 else 'No')

### FIXED CODE ###

n = input()
sn = sum(map(int, n))

print('Yes' if int(n) % sn == 0 else 'No')
import math
a, b = map(int, input().split())



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

print(lcm(a, b))

### FIXED CODE ###

import fractions
a,b=map(int, input().split())
f=fractions.gcd(a,b)
f2=a*b//f
print(f2)
#!/usr/bin/env python3
import sys, math, itertools, heapq, collections, bisect,copy
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**7)
inf = float('inf')
mod = 10**9+7
ans = inf ;count = 0 ;pro = 1

h,w=map(int,input().split())
A=[tuple(map(int,input().split())) for i in range(h)]
B=[tuple(map(int,input().split())) for i in range(h)]
K = 51300
dp = [[[]*K for j in range(w)] for i in range(h)]
dp[0][0][0]=1
for i in range(h):
    for j in range(w):
        d=abs(A[i][j]-B[i][j])
        if i-1>=0:
            for k in range(K):
                if dp[i-1][j][k]:
                    dp[i][j][k+d]=1
                    dp[i][j][abs(k-d)]
        if j-1>=0:
            for k in range(K):
                if dp[i][j-1][k]:
                    dp[i][j][k+d] = 1
                    dp[i][j][abs(k-d)]
for ki in dp[h-1][w-1]:
    ans=min(ans,ki)
print(ans)
# for di in dp:
#     print(di)



### FIXED CODE ###

#!/usr/bin/env python3
import sys, math, itertools, heapq, collections, bisect,copy
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**7)
inf = float('inf')
mod = 10**9+7
ans = inf ;count = 0 ;pro = 1

h,w=map(int,input().split())
A=[tuple(map(int,input().split())) for i in range(h)]
B=[tuple(map(int,input().split())) for i in range(h)]
# a=[set() for j in range(w)]
K=160*80
dp = [[0]*w for i in range(h)]
dp[0][0]=1<<K
for i in range(h):
    for j in range(w):
        d=abs(A[i][j]-B[i][j])
        if i-1>=0:
            dp[i][j] |= dp[i-1][j]
        if j-1>=0:
            dp[i][j] |= dp[i][j-1]
        dp[i][j] = (dp[i][j]<<d) | (dp[i][j]>>d)


ans = K
for i in range(2*K):
    if dp[h-1][w-1]  & (1 << i)>0:
        ans = min(ans,abs(K-i))
print(ans)
# for di in dp:
#     print(di)
n=int(input())
s=input()
if n%2==1:
  print(No)
else:
  for i in range(n//2):
    if s[i]!=s[n//2+i]:
      print(No)
      break
    elif i==n//2:
      print(Yes)

### FIXED CODE ###

n=int(input())
s=input()
if n%2==1:
  print("No")
else:
  for i in range(n//2):
    if s[i]!=s[n//2+i]:
      print("No")
      break
    elif i==n//2-1:
      print("Yes")
import numpy
n=int(input())
a=list(map(int,input().split()))
A=np.array(a)
g=np.gcd.reduce(A)
m=1
for i in range(n):
  m*=a[i]
l=m//g
print(l+1)
  


### FIXED CODE ###

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

m=0
for i in range(n):
  m+=a[i]-1

print(m)
N = int(input())
h = list(map(int,input().split()))
flag = True

for i in range(N-1):
    if h[i] > h[i+1]:
        h[i] -= 1
for i in range(N-1):
    if h[i] > h[i+1]:
        print('No')
        sys.exit()
print('Yes')

### FIXED CODE ###

N = int(input())
h = list(map(int,input().split()))
ans = True
for i in range(N-2,-1,-1):
    if h[i] > h[i+1]:
        h[i]-=1
for i in range(N-1):
    if h[i] <= h[i+1]:
        ans = True
    else:
        ans = False
        break
if ans:
    print('Yes')
else:
    print('No')
from collections import*
I=lambda:map(int,input().split())
n,m=I()
a=Counter(I())
exec("b,c=I();a[c]+=b"*m)
s=0
for k,v in sorted(a.items())[::-1]:
 if n<v:exit(print(s+k*n))
 n-=v;s+=k*v

### FIXED CODE ###

from collections import Counter
n, m, *d = map(int, open(0).read().split())
a = Counter(d[:n])
for b, c in zip(d[n::2], d[n+1::2]):
    a[c] += b
ans = 0
for k, v in sorted(a.items())[::-1]:
    if n < v:
        exit(print(ans + k * n))
    n -= v
    ans += k * v
n,m = map(int,input().split())
arr = list(map(int,input().split()))
s = sum(arr)
a = (s//(4*M))
c = 0
for i in range(n):
    if arr[i]>a:
        c +=1
if c==m:
    print('YES')
else:
    print('NO')

### FIXED CODE ###

N, M = map(int,input().split())
A = list(map(int,input().split()))
A.sort(reverse=True)
S = sum(A)
if A[M-1] >= S / (4*M):
    print("Yes")
else:
    print("No")
N = int(input())
A = list(map(int, input().split()))

Q = int(input())

s = sum(A)

for i in range(Q):
    b, c = map(int, input().split())
    diff = c - A[b - 1]
    A[b - 1] = c
     diff
    print(s)


### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
ma = [0] * (100000 + 1)

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

Q = int(input())

s = sum(A)

for i in range(Q):
    b, c = map(int, input().split())
    diff = c * ma[b] - ma[b] * b
    ma[c] += ma[b]
    ma[b] = 0
    s += diff
    print(s)
word = input()
if word[2]==word[3] and word[4]==word[5]:
    print('Yes')
    sys.exit(0)
print('No')



### FIXED CODE ###

word = list(input())
if word[2]==word[3] and word[4]==word[5]:
    print('Yes')
else: print('No')
n = int(input())

word_list = list(map(str, input().split()))

result_string = ""
for num in range(len(word_list[0])):
    for i in range(0,n):
        word_selected = word_list[i]
        result_string += word_selected[num]

print(result_string)

### FIXED CODE ###

n = int(input())

word_list = list(map(str, input().split()))

result_string = ""
for num in range(len(word_list[0])):
    for i in range(0,2):
        word_selected = word_list[i]
        result_string += word_selected[num]

print(result_string)
d = {1:{1:'.',2:',',3:'!',4:'?',5:' '},
     2:{1:'a',2:'b',3:'c'},
     3:{1:'d',2:'e',3:'f'},
     4:{1:'g',2:'h',3:'i'},
     5:{1:'j',2:'k',3:'l'},
     6:{1:'m',2:'n',3:'o'},
     7:{1:'p',2:'q',3:'r',4:'s'},
     8:{1:'t',2:'u',3:'v'},
     9:{1:'w',2:'x',3:'y',4:'z'}
}
n = int(raw_input())
for i in range(n):
    mes = raw_input()
    mes = mes.split("0")
    mes=filter(lambda x:len(x)>0,mes)
    #print mes
    l=[]
    for e in mes:
        l.append([e[0], len(e)])
    res=""
    for e in l:
        i=int(e[0])
        if(i==1):
            if e[1]>5:x=e[1]%5
            else:x=e[1]
        elif(i==7 or i==9):
            if e[1]>4:x=e[1]%4
            else:x=e[1]
        else:
            if e[1]>3:x=e[1]%3
            else:x=e[1]
        res=res+d[i][x]

    print res

### FIXED CODE ###

d = {1:{1:'.',2:',',3:'!',4:'?',5:' '},
     2:{1:'a',2:'b',3:'c'},
     3:{1:'d',2:'e',3:'f'},
     4:{1:'g',2:'h',3:'i'},
     5:{1:'j',2:'k',3:'l'},
     6:{1:'m',2:'n',3:'o'},
     7:{1:'p',2:'q',3:'r',4:'s'},
     8:{1:'t',2:'u',3:'v'},
     9:{1:'w',2:'x',3:'y',4:'z'}
}
n = int(raw_input())
for i in range(n):
    mes = raw_input()
    mes = mes.split("0")
    mes=filter(lambda x:len(x)>0,mes)
    l=[]
    for e in mes:
        l.append([e[0], len(e)])
    res=""
    for e in l:
        i=int(e[0])
        if(i==1):
            if e[1]%5==0:x=5
            else:x=e[1]%5
        elif(i==7 or i==9):
            if e[1]%4==0:x=4
            else:x=e[1]%4
        else:
            if e[1]%3==0:x=3
            else:x=e[1]%3
        res=res+d[i][x]

    print res