Harryxun/stf_run huggingface dataset:
import random

numbers = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
count = random.randint(1, 9)
dk, i = [], 0
while i < count:
    m = random.choice(numbers)
    if m not in dk:
        dk.append(m)
        i += 1
    else:
        continue

number_input = random.randint(10, 10000)
number_result = number_input
while True:
    string_middle = str(number_result)
    judge = 0
    for each in string_middle:
        if each in numbers:
            judge = 1
            break
        else:
             continue
    if judge == 1:
        number_result += 1
    else:
        break
print('%d %d'%(number_input, count)
print(dk)
print('%d'%number_result)

### FIXED CODE ###

n,k=map(int,input().split())
d=list(map(int,input().split()))
while True:
    m=n
    f=False
    while m>0:
        if m%10 in d:
            f=True
            break
        m=int(m/10)
    if f:
        n+=1
    else:
        print(n)
        break
S = int(input())

h = S / 60
m = h % 60
s = m % 60

print(h+ ':' m + ':' + s)

### FIXED CODE ###

S = int(input())

h = S // 3600
m = S // 60 % 60
s = S % 60

#print(h+ ':' + m + ':' + s)
print('{0}:{1}:{2}'.format(h,m,s));
r,d,x = map(int, input().split())
result=[]
result.append(x)
for i in range(10):
	x=r*x-d
	result.append(x)
for i in result[1:10]:
	print(i)

### FIXED CODE ###

a, b = map(int, input().split())
if a>=13:
  print(int(b))
elif 6<=a<=12:
  print(int(b/2))
else:
  print(int(0))
m = [list(map(int, input().split())) for _ in range(H)]
visited = [[True]*(W+2)] + [[True]+[False]*W+[True] for _ in range(H)] + [[True]*(W+2)]

dirs = [
  (1, 0),
  (0, 1),
  (-1, 0),
  (0, -1)
]
direction = 0
x, y = 1, 1
carry = 0
ans = []
while not visited[y][x]:
  visited[y][x] = True
  m[y-1][x-1] += carry
  if carry:
    ans[-1] += [y, x]

  carry = m[y-1][x-1] % 2
  if carry:
    ans.append([y, x])
    m[y-1][x-1] -= 1 # 別にいらない

  # 今の向きに進めないなら右に曲がる
  nx, ny = x + dirs[direction][0], y + dirs[direction][1]
  if visited[ny][nx]:
    direction = (direction + 1) % 4
  x += dirs[direction][0]
  y += dirs[direction][1]

if len(ans[-1]) < 4:
  y, x = ans.pop()
  m[y-1][x-1] += 1 # もどす

print(len(ans))
for a in ans:
  print(' '.join(list(map(str, a))))

# for i in m:
#   print(' '.join(list(map(str, i))))

### FIXED CODE ###

H, W = map(int, input().split())
m = [list(map(int, input().split())) for _ in range(H)]
visited = [[True]*(W+2)] + [[True]+[False]*W+[True] for _ in range(H)] + [[True]*(W+2)]

dirs = [
  (1, 0),
  (0, 1),
  (-1, 0),
  (0, -1)
]
direction = 0
x, y = 1, 1
carry = 0
ans = []
while not visited[y][x]:
  visited[y][x] = True
  m[y-1][x-1] += carry
  if carry:
    ans[-1] += [y, x]

  carry = m[y-1][x-1] % 2
  if carry:
    ans.append([y, x])
    m[y-1][x-1] -= 1 # 別にいらない

  # 今の向きに進めないなら右に曲がる
  nx, ny = x + dirs[direction][0], y + dirs[direction][1]
  if visited[ny][nx]:
    direction = (direction + 1) % 4
  x += dirs[direction][0]
  y += dirs[direction][1]

if len(ans) > 0 and len(ans[-1]) < 4:
  y, x = ans.pop()
  m[y-1][x-1] += 1 # もどす

print(len(ans))
for a in ans:
  print(' '.join(list(map(str, a))))
import numpy as np
n = int(input())
a = np.array(input().split(),dtype=int)
mod = 10**9+7

#2^iをmodで割った余りを出しておく
twos = np.ones(60)
for i in range(1,60):
    twos[i] = (twos[i-1]*2)%mod

"""
#各baのbitごとに0の個数を求める
c0 = np.zeros(60)
for i in range(n):
    ins0 = list(format(a[i],'b').zfill(60))
    ins1 = np.array(ins0,dtype=int)
    c0 += ins1
"""

#答えは各bitごとの(0の数)*(1の数)より求まる
ans = 0
for i in range(60):
    ans += (((c0[59-i]*(n-c0[59-i]))%mod)*twos[i])%mod

ans %= mod
print(int(ans))


### FIXED CODE ###

import numpy as np
n = int(input())
a = np.array(input().split(),dtype=int)
mod = 10**9+7

twos = 1
ans = 0
for i in range(0,60):
    cou1 = np.count_nonzero((a >> i) & 1)
    ans += (cou1*(n-cou1)*twos)%mod
    twos = (twos*2)%mod

ans %= mod
print(ans)
N, M, K = map(int, input().split())
graph = [[] for _ in range(N)]
block = [[] for _ in range(N)]
connected_components = []
count = 0
counts = [0 for _ in range(N)]
seen = [False for _ in range(N)]
def dfs(v, c, seen, origin):
    global count
    seen[v] = True
    for node in graph[v]:
        if seen[node] == True:
            continue
        if node not in block[origin]:
            count += 1
        dfs(node, c+1, seen, origin)
def dfs_connected(v, order):
    seen[v] = True
    connected_components[order].append(v)
    for node in graph[v]:
        if seen[node] == True:
            continue
        dfs_connected(node, order)

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

for Ki in range(K):
    a, b = map(int, input().split())
    block[a-1].append(b-1)
    block[b-1].append(a-1)

for v in range(N):
    if seen[v] == True:
        continue
    connected_components.append([])
    dfs_connected(v, v)

for components in connected_components:
    for component in components:
        seen = [False for _ in range(N)]
        count = 0
        dfs(component, count, seen, component)
        counts[component] = count-len(graph[component])

print(' '.join(map(str, counts)))

### FIXED CODE ###

import sys
sys.setrecursionlimit(2147483647)
input = sys.stdin.readline

N, M, K = map(int, input().split())
friends = {i: set() for i in range(N)}
blocks = {i: set() for i in range(N)}

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

for _ in range(K):
    a, b = map(int, input().split())
    blocks[a-1].add(b-1)
    blocks[b-1].add(a-1)

counts = [0] * N
seen = [False] * N
def dfs(v):
    if seen[v] == True:
        return
    seen[v] = True
    for node in friends[v]:
        c.add(node)
        dfs(node)
 
for v in range(N):
    if seen[v] == True:
        continue
    c = set()
    dfs(v)
    l = len(c)
    for i in c:
        counts[i] = l - 1
        counts[i] -= len(c & friends[i])
        counts[i] -= len(c & blocks[i])
print(' '.join(map(str, counts)))
# | A - K | = | B - K |
in = raw_input().split()
A = in[0]
B = in[1]

K = (A**2-B**2) / 2 / ( A-B )

if isinstance(K, int):
	print(K)
else
	print("IMPOSSIBLE")

### FIXED CODE ###

# | A - K | = | B - K |
A, B = map(int, input().split())

up = (A**2-B**2)
down = (2 * ( A-B ))

if up % down == 0:
	print(int(up/down))
else:
	print("IMPOSSIBLE")
N,K = list(map(int,input().split()))
D = N//(K//2) - N//K
print(int((N//K)**3) if K%2 == 1 else int((N//K)**3)+int(D**3))

### FIXED CODE ###

N,K = list(map(int,input().split()))
print(int((N//K)**3) if K%2 == 1 else int((N//K)**3)+int((N//(K//2) - N//K)**3))
n = int(input())
h = list(map(int, input().split()))

n = len(h)
dp =[[-2] * 2 for i in range(n)]


def f(index, is_sub):
    if(dp[index][is_sub] != -2):
        return dp[index][is_sub]

    v = h[index] - is_sub
    if(index == 0):
        dp[index][is_sub] = v
        #print(dp)
        return dp[index][is_sub]

    pre_v = f(index-1, 0)
    if(pre_v != -1 and pre_v <= v):
        dp[index][is_sub] = v
        #print("set value",index,is_sub,pre_v,v)
    pre_v = f(index-1, 1)
    if(pre_v != -1 and pre_v <= v):
        dp[index][is_sub] = v
        #print("set value",index,is_sub,pre_v,v)

    if(dp[index][is_sub]!=v):
        #print("set value",index,is_sub,"NO")
        dp[index][is_sub] = -1
    
    #print(dp)
    return dp[index][is_sub]


#print(dp)
if(f(n-1,1)!=-1 or f(n-1,0)!=-1):
    print("Yes")
else:
    print("No")


### FIXED CODE ###

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


h[0] = h[0] -1
for i in range(1,n):
    if(h[i-1] < h[i]):
        h[i] = h[i]-1

flag = True
for i in range(1,n):
    if(h[i-1]>h[i]):
        flag = False

if(flag):
    print("Yes")
else:
    print("No")
a, b = map(int, input())
print(a if b>=a else b)

### FIXED CODE ###

a, b = map(int, input().split())
print(a if b >= a else a-1)
A, B, K = (int(i) for i in input().split())
list = []

if A > B:
  judge = A
else:
  judge = B
for i in range(judge):
  if i != 0:
    if A % i == 0 and B % i == 0:
      list.append(i)
print(list[len(list)-K])


### FIXED CODE ###

A, B, K = (int(i) for i in input().split())
list = []
 
for i in range(101):
  if i != 0:
    if A % i == 0 and B % i == 0:
      list.append(i)
print(list[len(list)-K])
input()
a = eval(input().replace(' ','*'))
print([a,-1][a>=10**18])

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
ans = 1
if 0 in a :
    ans = 0

else:
    for i in range(n):
        ans *= a[i]
        if ans >10**18:
            ans = -1
            break
            
print(ans)
a=0
n = int(input())
b = list(map(int, input().split()))

for i in range(n-2):
  if b[i] > b[i+1]:
    a = a + b[i+1]
  if b[i+1] > b[i]:
    a = a + b[i]
  a = a + b[n-1]
print(a)

### FIXED CODE ###

n = int(input())
b = list(map(int, input().split()))
a_sum = 0

a_sum += b[0]

for i in range(n-2):
    if b[i] >= b[i+1]:
        a_sum += b[i+1]
    if b[i+1] > b[i]:
        a_sum += b[i]

a_sum += b[n-2]
print(a_sum)
H,_=map(int,input().split())
if H <= list(map(int,input().split())):
    print("Yes")
else:
    print("No")

### FIXED CODE ###

H, _ = map(int, input().split())
if H <= sum(map(int, input().split())):
    print("Yes")
else:
    print("No")
s = str(input())
if s == "ABC":
    print("ARC")
else:
    print(ABC)

### FIXED CODE ###

s = str(input())
if s == "ABC":
    print("ARC")
else:
    print("ABC")
while True:
    H,W = map(int,input().split())

    if H == W == 0:
        break
    for i in range(H):
        if i % 2 == 0:
            print("#"+".")
        else
            print("."+"#")
    print("")
            
            
            


### FIXED CODE ###

while True:
    H,W = map(int,input().split())
    if H == W == 0:
        break
    for i in range(H):
        print(('#.'*W)[i%2:][:W])
    print()
n,m=map(int,input().split())
l=list(map(int,input().split()))

num=n-1
sl=sorted(l)

dsl=[sl[i+1]-sl[i] for i in range(m-1)]
priny(dsl)

### FIXED CODE ###

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

if n>=m:
  print(0)
else:
  num=n-1
  sl=sorted(l)

  dsl=[abs(sl[i+1]-sl[i]) for i in range(m-1)]

  dsl=sorted(dsl)
  print(sum(dsl[0:len(dsl)-num]))
N,X = map(int,input().split())
L = list(map(int,input().split()))

i = 0
D = 0
while D<=X:
  D += L[i]
  i += 1
print(i)


### FIXED CODE ###

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

D = 0
i = 0
while D<=X and i<N+1:
  #print('   {}'.format(D))
  if i<N:
	  D += L[i]
  i += 1
print(i)
def main():
    import sympy
    from collections import Counter
    n = int(input())
    A = list(map(int, input().split()))
    s = set(A)
    c = Counter(A)
    cnt = 0
    for a in A:
        if c[a] > 1:
            continue
        else:
            d = set(sympy.divisors(a))
            if len(d & s) == 1:
                cnt += 1
    print(cnt)
main()


### FIXED CODE ###

from collections import Counter
n = int(input())
A = sorted(map(int, input().split()))
M = A[-1]
c = Counter(A)
s = set()
ans = 0
for a in A:
    if a in s:
        continue
    if c[a] == 1:
        ans += 1
    i = 1
    while a * i <= M:
        s.add(a * i)
        i += 1
print(ans)
A,B,T = map(int,input().split())
a =T//A
number = 0
 for i in range(a):
  b=1
  s = a-b
  if s >0:
    number+=1
  b+=1
print(number*B)

  

### FIXED CODE ###

A,B,T = map(int,input().split())
a =T//A
number = 0
for i in range(a):
  b=1
  s = a-b
  if s >=0:
    number+=1
  b+=1
print(number*B)
a,b,c,d = map(int,input().split())
if(b<=0 and d<=0):
  print(a*c)
elif(b<0 or d<0):
  if(((a<0 and b>0) or (c<0 and d>0))):
    print(0)
  elif(a>0 and b>0):
    print(d*a)
  elif(c>0 and d>0):
    print(b*ChildProcessError)
else:
  print(b*d)

### FIXED CODE ###

a,b,c,d = map(int,input().split())
if(a<=0 and b>=0 or (c<=0 and d>=0)):
  print(max(a*c,b*d,a*d,b*c,0))
else:
  print(max(a*c,b*d,a*d,b*c))
import heapq

def dfs(v: int) -> int:
  res = 1
  for u in child[v]:
    res *= dfs(u)
  return res + 1

n = int(input())
robot = [tuple(map(int, input().split())) for _ in range(n)]
robot.sort()
child = [[] for _ in range(n)]

root = []
for i in range(n-1, -1, -1):
  x, d = robot[i]
  while root:
    r = heapq.heappop(root)
    if r[0] < x + d:
      child[i].append(r[1])
    else:
      heapq.heappush(root, r)
      break
  heapq.heappush(root, (x, i))
  
count = 1
for r in root:
  count *= dfs(r[1])
print(count)

### FIXED CODE ###

import heapq

mod = 998244353

n = int(input())
robot = [tuple(map(int, input().split())) for _ in range(n)]
robot.sort(reverse=True)
parent = list(range(n))

root = []
for i in range(n):
  x, d = robot[i]
  while root:
    r = heapq.heappop(root)
    if r[0] < x + d:
      parent[r[1]] = i
    else:
      heapq.heappush(root, r)
      break
  heapq.heappush(root, (x, i))
  
count = 1
dp = [1] * n
for i in range(n):
  p = parent[i]
  if p == i:
    count = count * (dp[i] + 1) % mod
  else:
    dp[p] = dp[p] * (dp[i] + 1) % mod
print(count)
from collections import deque
n,m=map(int,input().split())
g=[[] for _ in range(n)]
for _ in range(m):
    u,v=list(map(int,input().split()))
    g[u-1].append(v-1)
s,t=map(int,input().split())
s-=1;t-=1
INF=10**9
U=[[INF]*n for i in range(3)]
U[0][s]=0
que=deque([s,0])
while que:
    v,t=que.pop()
    u=(t+1)%3
    d=U[u][v]
    if t==2:
        d+=1
    for w in g[v]:
        if U[u][w]!=INF:
            continue
        que.append((w,u))
        U[u][w]=d
print(U[0][t] if U[0][t]<INF else -1)



### FIXED CODE ###

from collections import deque
n,m=map(int,input().split())
g=[[] for _ in range(n)]
for _ in range(m):
    u,v=list(map(int,input().split()))
    g[u-1].append(v-1)
S,T=map(int,input().split())
S-=1;T-=1
INF=10**9
U=[[INF]*n for i in range(3)]
U[0][S]=0
que=deque([(0,S)])
while que:
    t,v=que.popleft()
    u=(t+1)%3
    if t==2:
        U[t][v]+=1
    for w in g[v]:
        if U[u][w]!=INF:
            continue
        que.append((u,w))
        U[u][w]=U[t][v]
print(U[0][T] if U[0][T]<INF else -1)
N,K = map(int, input().split())
H = list(map(int, input().split()))
dp = [-1]*N
for i in range(1, N):
    if i <= K:
        mi = abs(H[i] - H[0])
        for j in range(1, i):
            if dp[j] + abs(H[i] - H[j]) < mi:
                mi = dp[j] + abs(H[i] - H[j])
        dp[i] = mi
    else:
        mi = dp[i - K] + abs(H[i] - H[i - K])
        for j in range(i - K, i):
            if dp[j] + abs(H[i] - H[j]) < mi:
                mi = dp[j] + abs(H[i] - H[j])
        dp[i] = mi
print(dp[N - 1])

### FIXED CODE ###

N = int(input())
L = list(map(int, input().split()))
dp = [0, abs(L[0] - L[1])]
if N == 2:
    print(dp[1])
else:
    for i in range(2, N):
        dp.append(min(dp[i - 2] + abs(L[i] - L[i - 2]), dp[i - 1] + abs(L[i] - L[i - 1])))
    print(dp[N - 1])
import numpy as np
N,M = list(map(int,input().split()))

A=[]
B=[]
for n in range(N):
    A_ = list(input())
    A.append(A_)
    
for m in range(M):
    B_ = list(input())
    B.append(B_)
    
B=np.array(B)

ans='No'
for n1 in range(N-M+1):
    for n2 in range(N-M+1):
        check = np.array(A)[n1:n1+M,n2:n2+M]
        c=np.unique(check == B)
        
        if False not in set(c):
            ans='Yes'
            break
            
print(ans)

### FIXED CODE ###

import numpy as np
N,M = list(map(int,input().split()))

A=[]
B=[]
for n in range(N):
    A_ = list(input())
    A.append(A_)
    
for m in range(M):
    B_ = list(input())
    B.append(B_)
    
B=np.array(B)

ans='No'
for n1 in range(N-M+1):
    for n2 in range(N-M+1):
        check = np.array(A)[n1:n1+M,n2:n2+M]
        c=np.unique(check == B)
        
        if False not in set(c):
            ans='Yes'
            break
            
print(ans)
fla = 0
ans = 0

ket , kaz = map(int,input().split())
num = [-1 for i in range(ket)]
for j in range(kaz):
    s , c = map(int,input().split())
    if num[s-1] == -1:
        num[s-1] = c
    elif num[s-1] != c:
        fla = -1
        break

if fla == 0:
    if num[0] == 0:
        if ket != 1 
            fla = -1
    elif num[0] == -1:
        if ket == 1:
            num[0] = 0
        elif ket != 1:
            num[0] = 1

if fla == 0:
    for i in range(ket-1):
        if num[i+1] == -1:
            num[i+1] = 0
            
if fla == 0:
    for h in range(ket):
        ans +=  num[h]*(10**(ket-h-1))
    print(ans)
elif fla == -1:
    print(-1)
    

### FIXED CODE ###

fla = 0
ans = 0

ket , kaz = map(int,input().split())
num = [-1 for i in range(ket)]
for j in range(kaz):
    s , c = map(int,input().split())
    if num[s-1] == -1:
        num[s-1] = c
    elif num[s-1] != c:
        fla = -1
        break

if fla == 0:
    if num[0] == 0:
        if ket != 1:
            fla = -1
    elif num[0] == -1:
        if ket == 1:
            num[0] = 0
        elif ket != 1:
            num[0] = 1

if fla == 0:
    for i in range(ket-1):
        if num[i+1] == -1:
            num[i+1] = 0
            
if fla == 0:
    for h in range(ket):
        ans +=  num[h]*(10**(ket-h-1))
    print(ans)
elif fla == -1:
    print(-1)
n=int(input())
a=list(map(int,input().split()))
c=[]
for i in range(n):
    if a[i]<=399:
        c.append('gray')
    elif a[i]<=799:
        c.append('br') 
    elif a[i]<=1199:
        c.append('green')
    elif a[i]<=1599:
        c.append('pb')
    elif a[i]<=1999:
        c.append('bl')
    elif a[i]<=2399:
        c.append('y')
    elif  a[i]<=2799:
        c.append('o')
    elif  a[i]<=3199:
        c.append('r')
x=n-len(c)
#3200以上の人数
c=list(set(c))
k=min(8,len(c)+x)
print(len(c),k)

### FIXED CODE ###

r,g,b=map(int,input().split())
if (10*g+b)%4==0:
    print('YES')
else:
    print('NO')
N, M = list(map(int,input().split()))
graph = [dict() for i in range(N)]
for i in range(N):
	graph[i]["edge"] = []
for i in range(M):
	a, b = list(map(int, input().split()))
	graph[a - 1]["edge"].append(b - 1)
	graph[b - 1]["edge"].append(a - 1)

def pow(N):
	ans = 1
	for i in range(N):
		ans *= i + 1
	return  ans

total = 0
for i in range(pow(N - 1)):
	node = [a+1 for a in range(N - 1)]
	num = i
	zyun = [0]
	for j in range(N - 1, 0 , -1):
		mod = num % j
		num -= num % j
		num = num//j
		zyun.append(copy.deepcopy(node[mod]))
		del node[mod]
	judge = 1
	for loc in range(N - 1):
		if not zyun[loc + 1] in graph[zyun[loc]]["edge"]:
			judge = 0
	total += judge

print(total)

### FIXED CODE ###

import copy


N, M = list(map(int,input().split()))
graph = [dict() for i in range(N)]
for i in range(N):
	graph[i]["edge"] = []
for i in range(M):
	a, b = list(map(int, input().split()))
	graph[a - 1]["edge"].append(b - 1)
	graph[b - 1]["edge"].append(a - 1)

def pow(N):
	ans = 1
	for i in range(N):
		ans *= i + 1
	return  ans

total = 0
for i in range(pow(N - 1)):
	node = [a+1 for a in range(N - 1)]
	num = i
	zyun = [0]
	for j in range(N - 1, 0 , -1):
		mod = num % j
		num -= num % j
		num = num//j
		zyun.append(copy.deepcopy(node[mod]))
		del node[mod]
	judge = 1
	for loc in range(N - 1):
		if not zyun[loc + 1] in graph[zyun[loc]]["edge"]:
			judge = 0
	total += judge

print(total)
import math
n,k = map(int,input().split())
for i in range(1,k+1):
    t = 1
    c = math.factorial(n-k+1)//(math.factorial(i)*math.factorial(n-k+1-i))
    h = math.factorial(i+(k-i)-1)//(math.factorial(k-i)*math.factorial(i-1))
    print((c*h)%(10**9+7))


### FIXED CODE ###

import math
n,k = map(int,input().split())
for i in range(1,k+1):
    if n-k-i+1 < 0:
        print(0)
        continue
    c = math.factorial(n-k+1)//(math.factorial(i)*math.factorial(n-k+1-i))
    h = math.factorial(k-1)//(math.factorial(k-i)*math.factorial(i-1))
    print((c*h)%(10**9+7))
n, m, k = map(int, input().split())
friendships = [[] for _ in range(n)]
for _ in range(m):
  a, b = map(int, input().split())
  friendships[a-1].append(b-1)
  friendships[b-1].append(a-1)
blockships = [[] for _ in range(n)]
for _ in range(k):
  c, d = map(int, input().split())
  blockships[c-1].append(d-1)
  blockships[d-1].append(c-1)
# assign users (id) for connected component, according to friendships
# also increment a counter for size of each component
component_id = [-1]*n
component_size = dict()
def search(node, parent_id):
  if component_id[node] != -1:
    return
  component_id[node] = parent_id
  component_size[parent_id] = component_size.get(parent_id, 0) + 1
  for other in friendships[node]:
    search(other, parent_id)
for initial_node in range(n):
  search(initial_node, initial_node)
# calculate number of suggestions for each node
for node in range(n):
  suggestions = 0
  current_id = component_id[node]
  suggestions += component_size[current_id] - 1
  suggestions -= len(friendships[node])
  suggestions -= sum(int(component_id[other] == current_id) for other in blockships[node])
  print(suggestions, end=" ")

### FIXED CODE ###

n, m, k = map(int, input().split())
friendships = [[] for _ in range(n)]
for _ in range(m):
  a, b = map(int, input().split())
  friendships[a-1].append(b-1)
  friendships[b-1].append(a-1)
blockships = [[] for _ in range(n)]
for _ in range(k):
  c, d = map(int, input().split())
  blockships[c-1].append(d-1)
  blockships[d-1].append(c-1)
# assign users (id) for connected component, according to friendships
# also increment a counter for size of each component
component_id = [-1]*n
component_size = dict()
stack_to_visit = [(node, node) for node in range(n)]
while stack_to_visit:
  node, parent_id = stack_to_visit.pop()
  if component_id[node] != -1:
    continue
  component_id[node] = parent_id
  component_size[parent_id] = component_size.get(parent_id, 0) + 1
  for other in friendships[node]:
    stack_to_visit.append((other, parent_id))
# calculate number of suggestions for each node
for node in range(n):
  suggestions = 0
  current_id = component_id[node]
  suggestions += component_size[current_id] - 1
  suggestions -= len(friendships[node])
  suggestions -= sum(int(component_id[other] == current_id) for other in blockships[node])
  print(suggestions, end=" ")
k=int(input())
#k*=9
def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]
if k%7==0:
    k//=7
if k%2==0 or k%5==0:
    print(-1)
else:
    for j in make_divisors(k-1):
        s=1
        for p in range(j):
            s=s*10%k
        if s==1:
            break
    print(j)

### FIXED CODE ###

k=int(input())
k*=9
if k%7==0:
    k//=7
if k%2==0 or k%5==0:
    print(-1)
else:
    i=1
    s=10
    while s%k!=1:
        s=s*10%k
        i+=1
    print(i)
= str(input())
s1 = ''

if len(s) == 4:
    df = len(s)
else:
    df = len(s) - 1
    s1 += s[df:]

flag = False

if s.count('C') == 1:
    for i in range(1, df):
        if s[i] == 'C' and i <= 2:
            flag = True
        else:
            s1 += s[i]
else:
    flag = False

if s1.islower() and len(s) >= 1:
    flag = True
else:
    flag = False

print(s1)

if flag and s[0] == 'A':
    print('AC')
else:
    print('WA')


### FIXED CODE ###

s = str(input())

ans = 'AC'

if s[0] != 'A':
    ans = 'WA'

for i in range(1, len(s)):
    if s[i].isupper():
        if i == 1 or i == len(s) - 1 or s[i] != 'C':
            ans = 'WA'

if s.count('C') != 1:
    ans = 'WA'

print(ans)
A = list(input())
B = list(input())
C = list(input())
if A[-1]==B[0] and B[-1]==C[0]:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

A,B,C=(i for i in input().split())
if A[-1]==B[0] and B[-1]==C[0]:
    print("YES")
else:
    print("NO")