Harryxun/stf_run huggingface dataset:
H, W = map(int, input().split())

amap = [list(map(int, input().split())) for i in range(H)]
bmap = [list(map(int, input().split())) for i in range(H)]
dist_map = [[amap[y][x] - bmap[y][x] for x in range(W)] for y in range(H)]

# mid = 80 * 80 * 5 // 2
mid = 20
dp = [[1 << mid] * W for y in range(H)]

dp[0][0] = ((1 << (dist_map[0][0] + mid)) | (1 << (mid - dist_map[0][0])))


for x in range(1, W):
    y = 0
    d = abs(dist_map[y][x])
    dp[y][x] = (dp[y][x - 1] << d) | (dp[y][x - 1] >> d)


for y in range(1, H):
    x = 0
    d = abs(dist_map[y][x])
    dp[y][x] = (dp[y - 1][x] << d) | (dp[y - 1][x] >> d)


for y in range(1, H):
    for x in range(1, W):
        d = abs(dist_map[y][x])
        dp[y][x] = (dp[y][x - 1] << d) | (dp[y][x - 1] >> d) | ((dp[y - 1][x] << d) | (dp[y - 1][x] >> d))


ans = dp[-1][-1]

for i in range(mid + 1):
    if (ans & (1 << (mid - i))) or (ans & (1 << (mid + i))):
        print(i)
        exit()


### FIXED CODE ###



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

amap = [list(map(int, input().split())) for i in range(H)]
bmap = [list(map(int, input().split())) for i in range(H)]
dist_map = [[amap[y][x] - bmap[y][x] for x in range(W)] for y in range(H)]

mid = 80 * 80 * 5 // 2
# mid = 20
dp = [[1 << mid] * W for y in range(H)]

dp[0][0] = ((1 << (dist_map[0][0] + mid)) | (1 << (mid - dist_map[0][0])))


for x in range(1, W):
    y = 0
    d = abs(dist_map[y][x])
    dp[y][x] = (dp[y][x - 1] << d) | (dp[y][x - 1] >> d)


for y in range(1, H):
    x = 0
    d = abs(dist_map[y][x])
    dp[y][x] = (dp[y - 1][x] << d) | (dp[y - 1][x] >> d)


for y in range(1, H):
    for x in range(1, W):
        d = abs(dist_map[y][x])
        dp[y][x] = (dp[y][x - 1] << d) | (dp[y][x - 1] >> d) | ((dp[y - 1][x] << d) | (dp[y - 1][x] >> d))


ans = dp[-1][-1]

for i in range(mid + 1):
    if (ans & (1 << (mid - i))) or (ans & (1 << (mid + i))):
        print(i)
        exit()
K = int(input())
mod = K
if K % 2 == 0 or K % 5 ==0:
    print(-1)
elif K % 7 != 0:
    x = 10 % mod
    y = 1 % mod
    X = [y] * K
    S = [y] * K
    for i in range(1, K + 1):
        X[i] = (X[i - 1] * x) % mod
        S[i] = S[i - 1] + X[i]
        if S[i] % mod == 0:
            print(i + 1)
            exit()
        elif X[i] == 1 % mod:
            loop = i
            print(loop * K)
            exit()
else:
    mod = K // 7
    x = 10 % mod
    y = 1 % mod
    X = [y] * K
    S = [y] * K
    for i in range(1, K + 1):
        X[i] = (X[i - 1] * x) % mod
        S[i] = S[i - 1] + X[i]
        if S[i] % mod == 0:
            print(i + 1)
            exit()
        elif X[i] == 1 % mod:
            loop = i
            print(loop * K)
            exit()

### FIXED CODE ###

K = int(input())
mod = K
if K == 1:
    print(1)
elif K % 2 == 0 or K % 5 == 0:
    print(-1)
elif K % 7 != 0:
    x = 10 % mod
    X = [1] * K
    S = [1] * K
    for i in range(1, K + 1):
        X[i] = (X[i - 1] * x) % mod
        S[i] = S[i - 1] + X[i]
        if S[i] % mod == 0:
            print(i + 1)
            exit()
    print(-1)
else:
    mod = K // 7
    if mod == 1:
        print(1)
    else:
        x = 10 % mod
        y = 1 % mod
        X = [y] * K
        S = [y] * K
        for i in range(1, K + 1):
            X[i] = (X[i - 1] * x) % mod
            S[i] = S[i - 1] + X[i]
            if S[i] % mod == 0:
                print(i + 1)
                exit()
        print(-1)
from sys import stdin, exit
import itertools
#stdin = open("input.txt")

if __name__ == "__main__":
    N, K = [int(item) for item in stdin.readline().split()]
    li = [int(item) for item in stdin.readline().split()]
    
    li.sort()
    
    if sum(li) == K:
        print(N)
    elif sum(li) < K:
        print(N-1)
    else:
        cumsum = itertools.accumulate(li)
        index = [i for i, item in enumerate(cumsum) if item<=K]
        print(index[-1] + 1)

### FIXED CODE ###

from sys import stdin, exit
import itertools
#stdin = open("input.txt")

if __name__ == "__main__":
    N, K = [int(item) for item in stdin.readline().split()]
    li = [int(item) for item in stdin.readline().split()]
    
    li.sort()
    
    if sum(li) == K:
        print(N)
    elif sum(li) < K:
        print(N-1)
    else:
        cumsum = itertools.accumulate(li)
        index = [i for i, item in enumerate(cumsum) if item<=K]
        print(len(index))
# -*- coding: utf-8 -*-

s = input()

ans = ''

for i in range(len(s)-1):
    if s[i] == s[i+1]:
        ans = ' '.join([str(i+1), str(i+2)])
for j in range(len(s)-2):
    if s[i] == s[i+1] == s[i+2]:
        ans = ' '.join([str(i+1), str(i+3)])

if ans:
    print(ans)
else:
    print('-1 -1')


### FIXED CODE ###

# -*- coding: utf-8 -*-

s = input()

ans = ''

for i in range(len(s)-1):
    if s[i] == s[i+1]:
        ans = ' '.join([str(i+1), str(i+2)])
for j in range(len(s)-2):
    if s[j] == s[j+2]:
        ans = ' '.join([str(j+1), str(j+3)])

if ans:
    print(ans)
else:
    print('-1 -1')
#!/usr/bin/env python3
# atcoder 
# Türkler var mı?
# Herkese memnün oldum
import sys

iimr = lambda: map(int, sys.stdin.readline().rstrip().split())
readline = sys.stdin.readline
sys.setrecursionlimit(10 ** 8)


def 関数(x, n, p_liste):
    if n == 0:
        return x
    
    if x not in p_liste:
        return x
    chikai = x-1
    plus = x + 1

    for _ in range(n/2+4):
        #print(p_liste)
        if chikai not in p_liste:
            return chikai
        elif plus not in p_liste:
            return plus
        else: 
            plus += 1
            chikai -= 1
    return "問題"

def çözmek():
    X,N = map(int,sys.stdin.readline().split())
    P_liste = list(map(int, sys.stdin.readline().split()))

   
    res = []
    res.append(関数(X,N,P_liste))
    print(*res, sep="\n")

if __name__ == "__main__":
    çözmek()


### FIXED CODE ###

#!/usr/bin/env python3
# atcoder 
# Türkler var mı?
# Herkese memnün oldum
import sys

iimr = lambda: map(int, sys.stdin.readline().rstrip().split())
readline = sys.stdin.readline
sys.setrecursionlimit(10 ** 8)


def 関数(x, n, p_liste):
    if n == 0:
        return x
    
    if x not in p_liste:
        return x
    chikai = x-1
    plus = x + 1

    for _ in range(0,101):
        #print(p_liste)
        if chikai not in p_liste:
            return chikai
        elif plus not in p_liste:
            return plus
        else: 
            plus += 1
            chikai -= 1
    return "問題"

def çözmek():
    X,N = map(int,sys.stdin.readline().split())
    P_liste = list(map(int, sys.stdin.readline().split()))

   
    res = []
    res.append(関数(X,N,P_liste))
    print(*res, sep="\n")

if __name__ == "__main__":
    çözmek()
import sys
import re
S = input()
if not ( 1 <= len(S) <= 10 ): sys.exit()
if not S.isupper: sys.exit()

print(len(max(re.findall('[A|T|G|C]+', S))))

### FIXED CODE ###

import sys
import re
S = input()
if not ( 1 <= len(S) <= 10 ): sys.exit()
if not S.isupper: sys.exit()

result = 0
max = max(re.findall('[A|T|G|C]+', S),key=len) if re.findall('[A|T|G|C]+', S) else ''
if len(max) > 0:result = len(max)
print(result)
N = int(input())
d = list(map(int,input().split()))
sum = 0
for i in range(N-1):
    for j in range(i+1,N):
        sum += d[i] + d[j]
print(ans)

### FIXED CODE ###

N = int(input())
d = list(map(int,input().split()))
sum = 0
for i in range(N-1):
    for j in range(i+1,N):
        sum += d[i]*d[j]
print(sum)
n=int(input())
xyh = [list(map(int,input().split())) for i in range(n)]

ansh=-1
ans=[]
for cx in range(0,101):
  if len(ans)>0:
    break
  for cy in range(0,101):
    if len(ans)>0:
      break
    ansh = -1
    for pira in xyh:
      
      if pira[2] > 0 and ansh == -1:
        ansh = pira[2]+abs(cx-pira[0])+abs(cy-pira[1])
        ans.append([cx,cy,ansh])
        
      elif len(ans)>0 and pira[2] > 0 and ansh !=pira[2]+abs(cx-pira[0])+abs(cy-pira[1]):
        ans=[]
        break
        
      elif len(ans)>0 and pira[2]==0 and pira[2]+abs(cx-pira[0])+abs(cy-pira[1])>0:
        ans=[]
        break
print(*ans[0])

### FIXED CODE ###

n=int(input())
xyh = [list(map(int,input().split())) for i in range(n)]
xyh.sort(key=lambda x:x[2], reverse=True)

ansh=-1
ans=[[]]
flag=True
for cx in range(0,101):
  if flag==False:
    break
    
  for cy in range(0,101):
    ansh = 0
    for pira in xyh:
      if ansh==0:
        ansh=pira[2]+(abs(cx-pira[0])+abs(cy-pira[1]))
        ans[0]=[cx,cy,ansh]
        
      elif len(ans[0])>0 and max(ansh -(abs(cx-pira[0])+abs(cy-pira[1])), 0) != pira[2]:
        ans[0]=[]
    if len(ans[0])>0:
      flag=False
      break
print(*ans[0])
o = list(input())
e = list(input())

for i in range(len(e)):
        print(o[i],e[i],sep="",end="")

if len(e)<len(o):
        print(o[len(o)])

print("")


### FIXED CODE ###

o = list(input())
e = list(input())

for i in range(len(e)):
        print(o[i],e[i],sep="",end="")

if len(e)<len(o):
        print(o[len(o)-1])

print("")
n = int(input)
if n<1200:
  print("ABC")
 else:
  print("ARC")

### FIXED CODE ###

x = int(input())
if x<1200:
	print("ABC")
elif x>=1200:
	print("ARC")
#106
n = int(input())
if(n<105):
    print(0)
elif(n<135):
    print(1)
elif(n<165):
    print(2)
elif(n<195)
    print(3)
else:
    print(4)

### FIXED CODE ###

#106
n = int(input())
if(n<105):
    print(0)
elif(n<135):
    print(1)
elif(n<165):
    print(2)
elif(n<189):
    print(3)
elif(n<195):
    print(4)
else:
    print(5)
A,B,C,D,E=int(input()),int(input()),int(input()),int(input()),int(input())
orders = {'A': A, 'B': B, 'C': C, 'D': D, 'E': E}
orders = sorted(orders.items(), key=lambda item: item[1] % 10, reverse=True)
res = 0
while orders:
  if res % 10 != 0:
    res += (10 - res % 10)
  order = orders.pop(0)
  res += order
print(res)


### FIXED CODE ###

A,B,C,D,E=int(input()),int(input()),int(input()),int(input()),int(input())
orders = {'A': A, 'B': B, 'C': C, 'D': D, 'E': E}
orders = sorted(orders.items(), key=lambda item: (10 if item[1] % 10 == 0 else item[1] % 10), reverse=True)
res = 0
while orders:
  if res % 10 != 0:
    res += (10 - res % 10)
  order = orders.pop(0)
  res += order[1]
print(res)
S, T = map(input().split())
A, B = map(int, input().split())
U = input()
ans = 0

if(S == U):
  ans = A - 1
  print(ans,B)
else:
  ans = B - 1
  print(A,ans)

### FIXED CODE ###

S, T = map(str,input().split())
A, B = map(int, input().split())
U = input()
ans = 0

if(S == U):
  ans = A - 1
  print(ans,B)
else:
  ans = B - 1
  print(A,ans)
N = int(input())

#リストにするとき
A_list = list(map(int,input().split()))

for i in A_list:
    if i%2==0 and (i%3!=0 and i%5!=0):
        a+=1

if a>0:
      print('DENIED')
else:
  print('APPROVED')

### FIXED CODE ###

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

a=0
for i in num_list:
  if i%2==0 and (i%3!=0 and i%5!=0):
    a+=1

if a>0:
  print('DENIED')
else:
  print('APPROVED')
n = "NO"
y = "YES"

A, V = map(int, input().split()) #Aは初期座標 Vは1秒あたりの移動距離#
B, W = map(int, input().split()) #Aは初期座標 Wは1秒あたりの移動距離#
T = int(input()) #移動許可秒数#

##################################################
# 答えはT秒後に鬼が逃げ役と同じ座標or追い越せばYES#
# 計算はTLE対策として掛け算を使用　　　　　　　　　#
#V,W * T でT秒間の移動距離を算出 　　　　　　　　　#
# ANS = A,B + V,W * T　　　　　　　　　　　　　　　#   
##################################################

X = V * T
Y = W * T

A += X
B += Y

if B > A:
  print(y)
else:
  print(n)


### FIXED CODE ###

S = input()

print(S[0:3])
n = (int)input()
i = 0
while n > i:
  a[i] = (int)input()
  i+=1
j = 1
i = 0
max = a[j]-a[i]
 while i < n:
    while  j < n:
       if max < a[j]-a[i]:
          max = a[j]-a[i]
        j+ = 1
     i+ = 1
  print "max"

### FIXED CODE ###

N = int(raw_input())
min = int(raw_input())
max = int(raw_input())

ans = max - min
if max < min:
    min = max
 
for i in range(N - 2):
    R = int(raw_input())
    if R - min > ans:
        ans = R - min
    if R < min:
        min = R
 
print ans
H = int(input())
if H == 1:
  ret = 1
else:
  count = 0
  while True:
	H = H // 2
    count += 1
    if H == 0:
      break
  ret = 2 **( count + 1) - 1

### FIXED CODE ###

H = int(input())
if H == 1:
  ret = 1
else:
  count = 0
  while True:
    H = H // 2
    count += 1
    if H == 0:
      break
  ret = 2 **( count ) - 1
print(ret)
N = input()
if N[3] == N[4] and N[5] == N[6]:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

N = input()
if N[2] == N[3] and N[4] == N[5]:
  print('Yes')
else:
  print('No')
a, b, c, d = int(input().split())
x = a * b
y = c * d
if x == y:
  print(x)
elif x > y:
  print(x)
elif y > x:
  print(y)

### FIXED CODE ###

a, b, c, d = map(int, input().split())
x = a * b
y = c * d
if x == y:
  print(x)
elif x > y:
  print(x)
elif y > x:
  print(y)
S = input()

ans = 0
pre = ''

while True:
    flag = 1
    for i, c in enumerate(S):
        if pre == '':
            pre = c
            continue

        if (pre == '1' and c == '0') or (pre == '0' and c == '1'):
            if i + 1 != len(S):
                S = S[:i - 1] + S[i + 1:]
            else:
                S = S[:i - 1]
            ans += 2
            flag = 0
            break
        pre = c
    if flag:
        break
print(ans)


### FIXED CODE ###

S = input()

# while True:
#     flag = 1
#     for i, c in enumerate(S):
#         if pre == '':
#             pre = c
#             continue

#         if (pre == '1' and c == '0') or (pre == '0' and c == '1'):
#             if i + 1 != len(S):
#                 S = S[:i - 1] + S[i + 1:]
#             else:
#                 S = S[:i - 1]
#             ans += 2
#             flag = 0
#             break
#         pre = c
#     if flag:
#         break
a = S.count("1")
b = S.count("0")
print(min(a, b) * 2)
def f(x,y):
	if x*y < 0:
		return min(f(-x,y),f(y,-x))
	else:
		return x-y+2 if x>y else x-y
print(f(map(int,input().split())))

### FIXED CODE ###

x,y = map(int,input().split())
def f(a):
	m = float('inf')
	for i in a:
		if i >= 0:
			m = min(i,m)
	return m
print(f([y-x,y+x+1,-x-y+1,x-y+2]))
N, M = map(int, input().split())
A = list(map(int, input().split()))

count = 0
allpoint = sum(A)

for i in A:
    if i > float(allpoint // (4 * M)):
        count += 1

if  count >= M:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

x, y, z = map(int, input().split())

x, y = y, x
x, z = z, x

print(x, y ,z)
def main():
    N = int(input())
    A = tuple(map(int, input().split()))

    a = list(A)
    m = 0
    xy = []
    apnd = xy.append
    if min(a) == max(a):
        print(0)
        return
    elif min(a) < 0 and max(a) >= 0:
        if abs(min(a)) > max(a):
            x = min(a)
        else:
            x = max(a)
        idx = a.index(x)

    for i, j in enumerate(a):
        if j != x:
            a[i] += x
            m += 1
            apnd((idx + 1, i + 1))

    if min(a) >= 0:
        for i in range(N - 1):
            a[i+1] += a[i]
            m += 1
            apnd((i + 1, i + 2))
    elif max(a) < 0:
        for i in range(N - 1, 0, -1):
            a[i-1] += a[i]
            m += 1
            apnd((i + 1, i))

    print(m)
    for x, y in xy:
        print(x, y)

main()


### FIXED CODE ###

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

    a = list(A)
    m = 0
    xy = []
    apnd = xy.append
    if min(a) == max(a):
        print(0)
        return
    elif min(a) < 0 and max(a) >= 0:
        if abs(min(a)) > max(a):
            x = min(a)
        else:
            x = max(a)
        idx = a.index(x)
        for i, j in enumerate(a):
            if j != x:
                a[i] += x
                m += 1
                apnd((idx + 1, i + 1))

    if min(a) >= 0:
        for i in range(N - 1):
            a[i+1] += a[i]
            m += 1
            apnd((i + 1, i + 2))
    elif max(a) < 0:
        for i in range(N - 1, 0, -1):
            a[i-1] += a[i]
            m += 1
            apnd((i + 1, i))

    print(m)
    for x, y in xy:
        print(x, y)

main()
n, m = list(map(int, input().split()))
par = list(range(n+1))
dis = [0] * (n+1)

def root(x):
  if x == par[x]:
    return x
  r = root(par[x])
  dis[x] += dis[par[x]]
  par[x] = r
  return r

def cost(x):
  # xからxの根までのコスト
  if x == par[x]:
    return 0
  return dis[x] + cost(par[x])

for _ in range(m):
  l, r, d = list(map(int, input().split()))
  # 根が違ってればマージ
  # 同じなら入力されたdistanceがこれまでの入力データからなる
  # 現在の木の構造から計算した数値とあっているか判断
  rootl, rootr = root(l), root(r)
  if rootl != rootr:
    # lをrにマージする
    if r == rootr:
      dis[rootl] = d - cost(l)
    else:
      dis[rootl] = d - (dist[x] - dist[y]) # (cost(l) - cost(r))
    par[rootl] = r
  else:
    # コストが同じかどうか
    if d == cost(l) - cost(r):
      continue
    else:
      print("No")
      exit()
print("Yes")

### FIXED CODE ###

x, a, b = int(input()), int(input()), int(input())
x-=a

print(x%b)
n,x,m=map(int,raw_input().split())
i=0
v=[x]
t={x:0}
p=0 
start=0
while True: 
    i+=1
    y=(x*x)%m 
    if y in t: 
        p+=(i-t[y]) 
        start+=t[y]
        break 
    p[y]=i
    v.append(y) 
    x=y 
ans=0
if n<(start): 
    for i in range(n): 
        ans+=v[i] 
    print ans 
else: 
    for i in range(start): 
        ans+=v[i] 
    n-=(start+1) 
    g=n%p 
    l=n/p 
    for i in range(start,n): 
        ans+=(l*v[i]) 
        if i<g: 
            ans+=v[i] 
print ans

    
    


### FIXED CODE ###

n,x,m=map(int,raw_input().split())
i=0
v=[x]
t={x:0}
p=0 
start=0
while True: 
    i+=1
    y=(x*x)%m 
    if y in t: 
        p+=(i-t[y]) 
        start+=t[y]
        break 
    t[y]=i
    v.append(y) 
    x=y 
ans=0 

if n<(len(v)): 
    for i in range(n): 
        ans+=v[i] 
    print ans 
else: 
    for i in range(start): 
        ans+=v[i] 
    n-=(start) 
    g=n%p+start
    l=n/p 
    for i in range(start,len(v)): 
        ans+=(l*v[i]) 
        if i<g: 
            ans+=v[i] 
    print ans
import bisect
n = int(input())
c = [int(input()) for i in range(n)]

ans = 1
li = [[] for i in range(9)]
for i in range(n):
  if not li[c[i]]:
    li[c[i]].append(i)
    print(i)
  else:
#    if li[c[i]] != li[c[i]][-1]

    li[c[i]].append(i)
    ans += len(li[c[i]]) - 1
#    for j in range(9):
#      ans += len()-1
#      bisect.bisect_left(li[i],)
print(ans)

### FIXED CODE ###

n = int(input())
cc = [int(input()) for i in range(n)]
c = [cc[0]]
for i in range(1,n):
  if cc[i] != cc[i-1]:
    c.append(cc[i])

n = len(c)
dp = [0 for i in range(n)]
pos_dp = [-1 for i in range(2*10**5+1)]

dp[0] = 1
pos_dp[c[0]] = 0
     
for i in range(1,n):
  if pos_dp[c[i]]!=-1:
    dp[i] = (dp[i-1] + dp[pos_dp[c[i]]])%1000000007
  else:
    dp[i] = dp[i-1] 
  pos_dp[c[i]] = i

print(dp[n-1])
def dfs(i):
    if all(visited):
        global ans
        ans += 1
        return
    for j in range(N):
        if g[i][j] and not visited[j]:
            visited[j] = True
            dfs(j)
            visited[j] = False
    return

N, M = map(int, input().split())
g = [[False] * M for _ in range(M)]
for _ in range(M):
    a, b = map(int, input().split())
    g[a-1][b-1] = True
    g[b-1][a-1] = True

ans = 0
visited = [False] * N
visited[0] = True
dfs(0)

### FIXED CODE ###

def dfs(i):
    if all(visited):
        global ans
        ans += 1
        return
    for j in range(N):
        if g[i][j] and not visited[j]:
            visited[j] = True
            dfs(j)
            visited[j] = False

N, M = map(int, input().split())
g = [[False] * N for _ in range(N)]
for _ in range(M):
    a, b = map(int, input().split())
    g[a-1][b-1] = True
    g[b-1][a-1] = True

ans = 0
visited = [False] * N
visited[0] = True
dfs(0)
print(ans)
a,b,x = map(int,input().split())
import math
if a**2*b / 2 <  x:
    alpha = math.degrees(math.atan(2 * (a**2 * b - x) / a**3))
else:
    alpha =  math.degrees(math.acos(2*x / (a*b**2)))
    
print(alpha)

### FIXED CODE ###

a,b,x = map(int,input().split())
import math
if a**2*b / 2 <=  x:
    alpha = math.degrees(math.atan(2 * (a**2 * b - x) / a**3))
else:
    alpha =  math.degrees(math.atan(a*b**2 / (2*x) ))
    
print(alpha)
s=list(map(int,input().split()))
num=1
cost=s[0]
while cost < s[1]:
  num+=1
  cost=num*s[0]-1
print(num)

### FIXED CODE ###

s=input()
t=input()
result=0
if s[:1]==t[:1]:
    result=result+1

if s[1:2]==t[1:2]:
    result=result+1

if s[2:3]==t[2:3]:
    result=result+1
print(result)
a,b=map(int,input().split())
print(a//b,a%b,{:a/b})


### FIXED CODE ###

a, b = map(int, input().split())
  
d = int(a / b)
r = a % b
f = a / b
  
print(d, r,"{:f}".format(f))
N =int(input())
i = 0

while True:
  i += N % 10
  i = i % 9
  N = int(N/10)
  if N < 10:
    i += N
    break

if i % 9 == 0:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

N =input()
array = list(map(int, N))

if sum(array) % 9 == 0:
  print("Yes")
else:
  print("No")
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=list(input())
b=list(input())
c=list(input())
oner='a'
while True:
        if oner=='a':
            if len(a)==0:break
            oner=a.pop(0)
        if oner=='b':
            if len(c)==0:break
            oner=b.pop(0)
        if oner=='c':
            if len(c)==0:break
            oner=c.pop(0)
print(oner.upper)

### FIXED CODE ###

a=list(input())
b=list(input())
c=list(input())
oner='a'
while True:
        if oner=='a':
            if len(a)==0:break
            oner=a.pop(0)
        if oner=='b':
            if len(b)==0:break
            oner=b.pop(0)
        if oner=='c':
            if len(c)==0:break
            oner=c.pop(0)
print(oner.upper())
# -*- coding: utf-8 -*-
"""
Created on Sun Jul 21 12:22:32 2019

@author: ctiuser
"""
import sys

N, M = map(int,input().split())
AB = [list(map(int,input().split())) for _ in range(M)]

if M & 1:
    print(-1)
    sys.exit()    

T = [[] for _ in range(N+1)]
for a,b in AB:
    T[a].append(b)
    T[b].append(a)

visited = [False] * (N+1)
tree = [set([]) for _ in range(N+1)]
def dfs(x=1):
    for c in T[x]:
        if visited[c]:
            continue
        tree[x].add(c)
        tree[c].add(x)
        visited[c] = True
        dfs(c)
dfs()

counta = [0] * (N+1)
ans = []
for a,b in AB:
    if b in tree[a]:
        continue
    ans.append('{} {}'.format(a,b))
    counta[a] += 1

def dfs2(x=1, parent = None):
    for y in tree[x]:
        if y == parent:
            continue
        dfs2(y,x)
        if counta[y]&1:
            ans.append('{} {}'.format(x,y))
            counta[y] += 1
        else:
            ans.append('{} {}'.format(y.x))
            counta[x] += 1
dfs2()
for i in range(M):
    print(ans[i])

### FIXED CODE ###

# -*- coding: utf-8 -*-
"""
Created on Thu Jul 18 12:05:59 2019

@author: ctiuser
"""
import sys
sys.setrecursionlimit(10**6)

N, M = map(int,input().split())
A = [list(map(int,input().split())) for i in range(M)]

if M % 2 == 1:
    print(-1)
    sys.exit()

class UnionFind():
    def __init__(self,size):
        self.table = [-1 for i in range(size+1)]
    def find(self,x):
        if self.table[x] < 0:
            return x
        else:
            return self.find(self.table[x])
    def union(self,x,y):
        s1 = self.find(x)
        s2 = self.find(y)
        if s1 == s2:
            return False
        if self.table[s1] < self.table[s2]:
            self.table[s1] = self.table[s1] + self.table[s2]
            self.table[s2] = self.find(x)
        else:
            self.table[s2] = self.table[s1] + self.table[s2]
            self.table[s1] = self.find(y)
        return True

UF = UnionFind(N)
ans = []
T = [[-1] for i in range(N+1)]
color = [-1 for i in range(N+1)]
counta = [0 for i in range(N+1)]
B = []
C = [[] for i in range(N+1)]
for c in A:
    if UF.union(c[0],c[1]):
        B.append(c)
        C[c[0]].append(c[1])
        C[c[1]].append(c[0])
    else:
        ans.append(c)
        counta[c[0]] += 1

def b(x):
    color[x] = 1
    for c in C[x]:
        if color[c] == -1:
            T[c][0] = x
            T[x].append(c)
            b(c)
b(1)

edge_leaf = []
for i in range(1,N+1):
    if len(T[i]) == 1:
        edge_leaf.append(i)

def a(x):
    p = T[x][0]
    if p == -1:
        return 0
    if counta[x] % 2 == 0:
        ans.append([p,x])
        counta[p] += 1
    else:
        ans.append([x,p])
    return p

for c in edge_leaf:
    point = c
    while color[point] == len(T[point]):
        point = a(point)
        color[point] += 1


for c in ans:
    print(' '.join(map(str,c)))