Harryxun/stf_run huggingface dataset:
n, m = map(int, input().split())
data = [[] for _ in range(n)]
for i in range(m):
    a, b = map(int,input().split())
    data[a - 1].append(b - 1)
    data[b - 1].append(a - 1)

ans = [0] * (n - 1)

def bfs(i, queue, p):
    if len(queue) == 0:
        return 
    while len(queue) > 0:
        x = queue.pop(0)
        pre = p.pop(0)
        for j in range(len(x)):
            if ans[x[j] - 1] == 0 and x[j] != 0:
                ans[x[j] - 1] = pre + 1
                queue.append(data[x[j]])
                p.append(x[j])
        bfs(x[j], queue, p)

queue = []
pre = [0]
queue.append(data[0])
bfs(0, queue, pre)

if 0 not in ans:
    print("Yes")
    for i in range(len(ans)):
        print(ans[i])
else:
    print("No")

### FIXED CODE ###

from collections import deque
n, m = map(int, input().split())
data = [[] for _ in range(n)]
for i in range(m):
    a, b = map(int,input().split())
    data[a - 1].append(b - 1)
    data[b - 1].append(a - 1)

ans = [0] * (n - 1)

def bfs(i, queue, p):
    while len(queue) > 0:
        x = queue.popleft()
        pre = p.popleft()
        for j in range(len(x)):
            if ans[x[j] - 1] == 0 and x[j] != 0:
                ans[x[j] - 1] = pre + 1
                queue.append(data[x[j]])
                p.append(x[j])

queue = deque()
pre = deque()
pre.append(0)
queue.append(data[0])
bfs(0, queue, pre)

if 0 not in ans:
    print("Yes")
    for i in range(len(ans)):
        print(ans[i])
else:
    print("No")
n,k = map(int,input().split())
if n % k ==0:
    print(0)
else:
    l = [n]
    p = n//k
    c = n-(p*k)
half = k//2
while c > half:
    c = abs(c-k)
    l.append(c)
print(min(l))

### FIXED CODE ###

n,k = map(int,input().split())
if n % k ==0:
    print(0)
else:
    l = [n]
    p = n//k
    c = n-(p*k)
    half = k//2
    while c > half:
        c = abs(c-k)
    l.append(c)
    print(min(l))
n,a,b = map(int,input().split())
if b > n*a:
  print(a*c)
elif b < a*a:
  print(b)
else:
  print(b)


### FIXED CODE ###

n,a,b = map(int,input().split())
if b > n*a:
  print(a*n)
elif b < a*a:
  print(b)
else:
  print(b)
N, Q = map(int, input().split())
s = list(input())
del s[-1]
sSet = set(s) 

death = 0

for i in range(Q):
	t, d = input().split()

	if t in sSet:
		tmpS = s.copy()
		for index, golems in enumerate(tmpS):
			if t in golems:
				if d == 'L' and index == 0: 
					s[index] = ""
					death += len(golems) 
				elif d == 'L':
					s[index-1] = tmpS[index-1] + golems
					s[index] = ""
				elif d == 'R' and index == N - 1:
					s[index] = ""
					death += len(golems)
				else:
					s[index+1] = tmpS[index+1] + golems
					s[index] = ""


print(len(s) - death)


### FIXED CODE ###

a, b, c = map(int, input().split())
res = "Yes" if a == b == c else "No"
print(res)
import sys

class Node():
    __slots__ = ['key', 'left', 'right']
    def __init__(self, key):
        self.key = key
        self.left, self.right = None

root = None
def insert(z):
    global root
    x, y = root, None
    while x:
        y = x
        if z < x.key:
            x = x.left
        else:
            x = x.right
    
    if y == -1:
        root = Node(z)
    elif z < y.key:
        y.left = Node(z)
    else:
        y.right = Node(z)
        
def preorder(x):
    return f" {x.key}" + preorder(x.left) + preorder(x.right) if x else ""

def inorder(x):
    return inorder(x.left) + f" {x.key}" + inorder(x.right) if x else ""
        
input()
node = {}
root = -1
for s in sys.stdin:
    if s[0] == "p":
        print(inorder(root))
        print(preorder(root))
    else:
        insert(int(s[7:]))



### FIXED CODE ###

import sys

class Node():
    __slots__ = ['key', 'left', 'right']
    def __init__(self, key):
        self.key = key
        self.left, self.right = None, None
        
    def __str__(self):
        return self.key

root = None
def insert(z):
    global root
    x, y = root, None
    while x:
        y = x
        if z < x.key:
            x = x.left
        else:
            x = x.right
    
    if y == None:
        root = Node(z)
    elif z < y.key:
        y.left = Node(z)
    else:
        y.right = Node(z)
        
def preorder(x):
    return f" {x.key}" + preorder(x.left) + preorder(x.right) if x else ""

def inorder(x):
    return inorder(x.left) + f" {x.key}" + inorder(x.right) if x else ""
        
input()
node = {}
for s in sys.stdin:
    if s[0] == "p":
        pass
        print(inorder(root))
        print(preorder(root))
    else:
        insert(int(s[7:]))
import math
n,d=map(int,input().split())
cnt=0
dlist=[list(map(int,input().split())) for _ in range(n)]
for i in range(n-1):
    for j in range(i+1:n):
        ans=0
        for k in range(d):
            ans+=(dlist[i][k]-dlist[j][k])**2
        cnt+=math.floor(ans**0.5)==math.ceil(ans**0.5):

print(cnt)    


### FIXED CODE ###

import math
n,d=map(int,input().split())
cnt=0
dlist=[list(map(int,input().split())) for _ in range(n)]
for i in range(n-1):
    for j in range(i+1,n):
        ans=0
        for k in range(d):
            ans+=(dlist[i][k]-dlist[j][k])**2
        cnt+=math.floor(ans**0.5)==math.ceil(ans**0.5)

print(cnt)
a=int(input())
b=list(map(int,input().split()))
counter=0
exist_odd=False
while True:
  count=0
  while count<=a-1:
    if b[count]%2==1:
      exist_odd=True
      break
    else:
      b[count]=b[count]//2
      count+=1
  if exist_odd:
    break
  else:
    counter+=1
print(counter)
    

### FIXED CODE ###

S=input()
print(S.count("1"))
s, t, u = map(int, input().split())
x = 0
if s % 1 == 1:
  x = x + 1
if t % 1 == 1:
  x = x + 1
if u % 1 == 1:
  x = x + 1
 
print(x)

### FIXED CODE ###

s=input()
print(s.count("1"))
n = int(input())

arr6 = []
for i in range(10):
	arr6.append(6**i)

arr9 = []
for i in range(10):
	arr9.append(9**i)


ans = float("inf")
for i in range(n+1):
	count = 0
	tmp = i
	while tmp > 0:
		t = 0
		while arr6[t] <= tmp:
			t+=1

		tmp -= arr6[t-1]
		count += 1

	tmp = n-i
	while tmp > 0:
		t = 0
		while arr9[t] <= tmp:
			t += 1
		tmp -= arr9[t-1]
		count += 1

	ans = min(ans,count)

print ans


### FIXED CODE ###

import numpy as np
N = int(input())

coin = [6**n for n in range(10) if 6**n <= N]
coin += [9**n for n in range(10) if 9**n <= N]

dp = np.zeros(N+1, dtype=np.int32)
dp += 10**9
dp[0] = 0

for c in coin:
  for _ in range(9):
    dp[c:] = np.minimum(dp[:-c] + 1, dp[c:])

answer = dp[-1]
print(answer)
L=input()
a=int(L[0])
b=int(L[1])
c=int(L[2])
d=int(L[3])
def s(i,x):
	if i==0:
		return x
	else:
		return -x

def c(x):
	if x==0:
		return '+'
	else:
		return '-'

for i in range(2):
	for j in range(2):
		for k in range(2):
			p=a+s(i,b)+s(j,c)+s(k,d)
			if p==7:
				ans=L[0]+c(i)+L[1]+c(j)+L[2]+c(k)+L[3]
				print(ans)
				exit()

### FIXED CODE ###

L=input()
a=int(L[0])
b=int(L[1])
c=int(L[2])
d=int(L[3])

import itertools

A=(1,-1)

def e(x):
	if x==1:
		return '+'
	else:
		return '-'

for v in itertools.product(A,repeat=3):
	s=a+b*v[0]+c*v[1]+d*v[2]
	if s==7:
		print(L[0]+e(v[0])+L[1]+e(v[1])+L[2]+e(v[2])+L[3]+'=7')
		exit()
h, w, k = map(int, input().split())
s = [input() for _ in range(h)]
a = [[0]*w for _ in range(h)]
cnt = 1
later = []
for i in range(h):
    if '#' not in s[i]: continue
    if i < h-1: later.append(i)
    fst = True
    for j in range(w):
        if not fst and s[i][j] == '#':
            cnt += 1
        if fst and s[i][j] == '#':
            fst = False
        a[i][j] = cnt
    cnt += 1

for i in later:
    if a[i+1][0] != 0: continue
    for j in range(w):
        k = i
        while k < h-1:
            if a[k+1][j] == 0:
                a[k+1][j] = a[k][j]
                k += 1
            else:
                break
                
if later[0] != 0:
    for i in range(later[0], 0, -1):
        for j in range(w):
            a[i-1][j] = a[i][j]
for ans in a:
    print(*ans)

### FIXED CODE ###

h, w, k = map(int, input().split())
s = [input() for _ in range(h)]
a = [[0]*w for _ in range(h)]
cnt = 0
later = []
for i in range(h):
    if '#' not in s[i]: continue
    later.append(i)
    fst = False
    idx = -1
    for j in range(w):
        if not fst and not s[i][j] == '#':
            continue
        if not fst and s[i][j] == '#':
            idx = j
        if s[i][j] == '#':
            fst = True
            cnt += 1
        a[i][j] = cnt
    for j in range(idx):
        a[i][j] = a[i][idx]

for i in later:
    if i >= h-1: break
    for j in range(w):
        k = i
        while k < h-1:
            if a[k+1][j] == 0:
                a[k+1][j] = a[k][j]
                k += 1
            else:
                break
                
if later[0] != 0:
    for i in range(later[0], 0, -1):
        for j in range(w):
            a[i-1][j] = a[i][j]
for ans in a:
    print(*ans)
import collections

N = int(input())
V = list(int(i) for i in input().split())
even = V[0::2]
odd =  V[1::2]
all_length = len(V)
even = collections.Counter(even).most_common(2)
odd = collections.Counter(odd).most_common(2)
if (even[0][0] != odd[0][0]):
    print(all_length - even[0][1] - odd[0][1])
else:
    if(len(even)==1 and len(odd)==1):
        print(all_length//2)
    elif(len(even)==1):
        print(all_length - odd[0][1])
    elif(len(odd)==1):
        print(all_length - even[0][1])    
    else:
        print(min(all_length - even[0][1] - odd[0][2], all_length - even[0][2] - odd[0][1]))


### FIXED CODE ###

import collections

N = int(input())
V = list(int(i) for i in input().split())
even = V[0::2]
odd =  V[1::2]
all_length = len(V)
even = collections.Counter(even).most_common(2)
odd = collections.Counter(odd).most_common(2)
if (even[0][0] != odd[0][0]):
    print(all_length - even[0][1] - odd[0][1])
else:
    if(len(even) == 1 and len(odd) == 1):
        print(all_length // 2)
    elif(len(even)==1):
        print(all_length // 2 - odd[1][1])
    elif(len(odd)==1):
        print(all_length // 2 - even[1][1])    
    else:
        print(min(all_length - even[0][1] - odd[1][1], all_length - even[1][1] - odd[0][1]))
from math import gcd
from functools import reduce
n=int(input())
a=list(map(int,input().split()))
ans=reduce(gcd,a[1:])
ans=max(ans,reduce(gcd,a[:n-1]))
for i in range(1,n-1):
  ans=max(gcd(reduce(gcd,a[:i]),reduce(gcd,a[i+1:])),ans)
print(ans*gc)

### FIXED CODE ###

from math import*
n=int(input())
a=list(map(int,input().split()))
b=[a[0]]
c=[a[-1]]
for i in range(1,n):
  b+=[gcd(b[-1],a[i])]
  c+=[gcd(c[-1],a[-i-1])]
ans=0
c=c[::-1]
for i in range(n):
  if i==0:ans=max(ans,c[i+1])
  elif i==n-1:ans=max(ans,b[i-1])
  else:
    ans=max(ans,gcd(c[i+1],b[i-1]))
print(ans)
N = int(input())

edge_list = []
for i in range(N - 1):
    u, v = map(int, input().split())
    edge_list.append(edge(u - 1, v - 1))

ver_num = int(N * (N + 1) * (N + 2) / 6)

edge_num = 0
for e in edge_list:
    edge_num += (N + 1 - (e.max() + 1)) * (e.min() + 1)
    
print(ver_num - edge_num)

### FIXED CODE ###

class edge:
    def __init__(self, u, v):
        self.u = u
        self.v = v
    def min(self):
        return min(self.u, self.v)
    def max(self):
        return max(self.u, self.v)

N = int(input())
 
edge_list = []
for i in range(N - 1):
    u, v = map(int, input().split())
    edge_list.append(edge(u - 1, v - 1))
 
ver_num = int(N * (N + 1) * (N + 2) / 6)
 
edge_num = 0
for e in edge_list:
    edge_num += (N + 1 - (e.max() + 1)) * (e.min() + 1)
    
print(ver_num - edge_num)
N = int(raw_input())

S = raw_input()

num = S.count('E')
score_list = []
score_list.append(num)

for i in range(N-1)
	if S[i]=='W':
		num+=1
	else:
		num-=1
	score_list.append(num)
print min(score_list)

### FIXED CODE ###

N = int(raw_input())
S = raw_input()

num = S[1:].count('E')
score_list = []
score_list.append(num)

for i in range(N-1):
	if S[i]=='W':
		num+=1
	if S[i+1]=='E':
		num-=1
	score_list.append(num)
	
print min(score_list)
import collections
import bisect
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

N = int(input())
c = collections.Counter(prime_factorize(N))
sums = []
s=1
ans = 0
if c.values():
  while s <= max(c.values()):
    sums.append(s)
    s += s+1
  for v in c.values():
    idx = bisect.bisect_left(sums,v)
    
    if idx <= len(c.values()):
      if sums[idx] == v:
        ans += idx+1
      else:
        ans += idx
    else:
      ans += max(sums)
print(ans)

### FIXED CODE ###

import collections
import bisect
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

N = int(input())
c = collections.Counter(prime_factorize(N))
sums = []
s=1
ans = 0
for v in c.values():
  count = 0
  for i in range(1,v+1):
    if count+i > v:
      break
    else:
      count += i
      ans += 1
print(ans)
n - int(input())
a = input().split()
s = a[::-2]+a[::2]
print(" ".join(s))

### FIXED CODE ###

n = int(input())
a = input().split()
if n%2 == 0:
    s = a[::-2]+a[::2]
else:
    s = a[::-2]+a[1::2]
print(" ".join(s))
N=int(input())
sum_gcd=0
for a_1 in range(1,N+1):
    for a_2 in range(1,N+1):
        for a_3 in range(1,N+1):
            sum_gcd+=gcd(a_1,a_2,a_3)
print(sum_gcd)

### FIXED CODE ###

def gcd_2(a,b):
    if a<=b:
        x_min=a
        x_max=b
    else:
        x_min=b
        x_max=a
        
    while True:
#         print(x_min,x_max)
        if x_max % x_min ==0:
            return x_min
        
        x_temp = x_max % x_min
        
        x_max = x_min
        x_min = x_temp
        
def gcd(a,b,c):
    d=gcd_2(a,b)
    ans=gcd_2(d,c)
    return ans
  
N=int(input())
sum_gcd=0
for a_1 in range(1,N+1):
    for a_2 in range(1,N+1):
        for a_3 in range(1,N+1):
            sum_gcd+=gcd(a_1,a_2,a_3)
print(sum_gcd)
A, B, C, D, E, F = map(int, input().split())
# A:水を100Ag　B:水を100Bg C:砂糖をCg D:砂糖をDg E:100gあたりの溶ける最大量　F:入れられる物質の質量の限界

ans_mizu = 100
ans_sato = 0

mizu = set()
for i in range(int(F/(100*max(A,B)))+1):
    for j in range(int(F/(100*min(A,B)))+1):
        if 100*A*i + 100*B*j <= F:
            mizu.add(100*A*i+100*B*j)
            
for m in mizu:
    howaryo = (m*E)//100
    for i in range(int(howaryo//C)+1):
        for j in range(int(howaryo//D)+1):
            sato = C*i + D*j
            if (m + sato <= F) & (sato <= howaryo):
                if (ans_sato/(ans_mizu+ans_sato)) < (sato/(m+sato)):
                    ans_mizu = m
                    ans_sato = sato

print(ans_mizu+ans_sato,ans_sato)

### FIXED CODE ###


A, B, C, D, E, F = map(int, input().split())
# A:水を100Ag　B:水を100Bg C:砂糖をCg D:砂糖をDg E:100gあたりの溶ける最大量　F:入れられる物質の質量の限界

ans_mizu = 1
ans_sato = 0
pat = []
mizu = set()
for i in range(int(F/100)+1):
    for j in range(int(F/100)+1):
        if 100*A*i + 100*B*j <= F:
            mizu.add(100*A*i+100*B*j)

mizu.remove(0)

for m in mizu:
    howaryo = (m*E)//100
    for i in range(int(howaryo/C)+1):
        for j in range(int(howaryo/D)+1):
            sato = C*i + D*j
            if (m + sato <= F) & (sato <= howaryo):
                ans_sato = max(ans_sato,sato)
                
    pat.append([m+ans_sato,ans_sato])
    ans_mizu = 1
    ans_sato = 0
    
pat.sort(key = lambda x:x[1]/(x[0]+x[1]), reverse = True)
print(pat[0][0],pat[0][1])
a,b,c,d = map(int,input().split())

ans1 = 0
while a>=0:
    a -= d
    ans1 += 1

ans2 = 0
while c >= 0:
    c -= b
    ans2 += 1

if ans1 >= ans2:
    print("No")
else:
    print("Yes")

### FIXED CODE ###

s,w = map(int,input().split())
if s<=w:
    print("unsafe")
else:
    print("safe")
import sys
# import itertools
# import math

input = sys.stdin.readline().rstrip()


def resolve():
    S, T = map(str, input().split())
    A, B = map(int, input().split())
    U = input()

    if S == U:
        A -= 1
        print(str(A) + ' ' + str(B))
        return
    B -= 1
    print(str(A) + ' ' + str(B))


resolve()


### FIXED CODE ###

def resolve():
    S, T = map(str, input().split())
    A, B = map(int, input().split())
    U = input()
 
    if S == U:
        A -= 1
        print(str(A) + ' ' + str(B))
        return
    B -= 1
    print(str(A) + ' ' + str(B))


resolve()
S=input()
a = [int(c) for c in s]

if (a[0]-a[1]) * (a[1]-a[2]) * (a[2] - a[3]) ==0:
    print('Bad')
else:
    print('Good')

### FIXED CODE ###

S=input()
a = [int(c) for c in S]

if (a[0]-a[1]) * (a[1]-a[2]) * (a[2] - a[3]) ==0:
    print('Bad')
else:
    print('Good')
x = int(input())
if x == 0:
  print(1)
elif x == 1:
  print(0)
else:
  break

### FIXED CODE ###

x = int(input())
print(1-x)
N, M = map(int, input().split())
cand = ['*'] * M
mn = ''
for m in range(M):
    s, c = map(int, input().split())
    if s==1 and c==0 and N > 1:
        mn = '-1'

    if cand[s-1] == '*' or cand[s-1] == str(c):
        cand[s-1] = str(c)
    else:
        mn = '-1'
if mn == '-1':
    print (mn)
    exit()

for i in range(N):
    if cand[i]=='*':
        if i==0:
            mn+='1'
        else:
            mn+='0'
    else:
        mn+=cand[i]
print (mn)

### FIXED CODE ###

N, M = map(int, input().split())
cand = ['*'] * N
mn = ''
for m in range(M):
    s, c = map(int, input().split())
    if s==1 and c==0 and N > 1:
        mn = '-1'

    if cand[s-1] == '*' or cand[s-1] == str(c):
        cand[s-1] = str(c)
    else:
        mn = '-1'
if mn == '-1':
    print (mn)
    exit()

for i in range(N):
    if cand[i]=='*':
        if i==0 and N > 1:
            mn+='1'
        else:
            mn+='0'
    else:
        mn+=cand[i]
print (mn)
M, K = map(int,input().split())


if M == 1 and K == 1:
    print(-1)
elif M==1 and K == 0:
    print("0 0 1 1")
elif K >= 2**M:
    print(-1)
else:
    else:
        M = [i for i in range(2**M)]
        M.remove(K)
        ans = M + [K] + M[::-1] + [K]
        anstr = ""
        for a in ans:
            anstr += str(a) + " "
        print(anstr[:-1])

### FIXED CODE ###

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


if M == 1 and K == 1:
    print(-1)
elif M==1 and K == 0:
    print("0 0 1 1")
elif K >= 2**M:
    print(-1)
else:
    M = [i for i in range(2**M)]
    M.remove(K)
    ans = M + [K] + M[::-1] + [K]
    anstr = ""
    for a in ans:
        anstr += str(a) + " "
    print(anstr[:-1])
N = int(intput())

print(N ** 3)

### FIXED CODE ###

N = int(input())
a = N**3
print(a)
a,b,c,x,y = map(int, input().split())
mx = a if x >= y else b
if c * 2 <= (a+b):
  if c * 2 <= mx:
    print((min(x,y)+abs(x-y))*c*2)
  else:
    print(min(x,y)*c*2+ans(x-y)*mx)
else:
  print(a*x+b*y)

### FIXED CODE ###

a,b,c,x,y = map(int, input().split())
mx = a if x >= y else b
if c * 2 <= (a+b):
  if c * 2 <= mx:
    print((min(x,y)+abs(x-y))*c*2)
  else:
    print(min(x,y)*c*2+abs(x-y)*mx)
else:
  print(a*x+b*y)
P=int(input())
Q=int(input())
R=int(input())
a=P+Q
b=Q+R
c=R+P

if a<=b:
    if a<=c:
        print(a)
    else:
        print(c)
elif b<a:
    if b<=c:
        print(b)
    else:
        print(c)

### FIXED CODE ###

p,q,r = map(int, input().split())
print(min(p+q,q+r,r+p))
N = int(raw_input())
A = int(raw_input())
B = int(raw_input())

ans = 0

for x in range(N+1):
    sum = 0
    xx = x
    while xx != 0:
        sum += xx % 10
        xx = xx / 10

    if A <= sum and B >= sum:
        ans += x

print(ans)

### FIXED CODE ###

n, a, b = map(int, input().split())
ans = 0
for i in range(n+1):
    if a <= sum(list(map(int, list(str(i))))) <= b:
        ans += i
print(ans)
n,x,t=map(int,input().split())

if n%x=0:
   a=n//x
if n%x!=0:
   a=n//x+1

b=int(a*t)

print(b)


### FIXED CODE ###

n,x,t=map(int,input().split())

if n%x==0:
   a=int(n//x)
else:
   a=int(n//x+1)

b=int(a*t)

print(b)
import math

a, b= map(int, input().split())
def lcm(x,y):
    return (x*y/math.gcd(x, y))

print(int(lcm(a, b)))


### FIXED CODE ###

import fractions as fr

a, b= map(int, input().split())
def lcm(x,y):
    return (x*y/fr.gcd(x,y))

print(int(lcm(a,b)))
from fractions import gcd
from functools import reduce
import copy

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

valueList = [a[0]]
maxList = []

g = a[0]
valueList.append(g)
g = a[1]
for k in range(i+1, n):
  g = gcd(g, a[k])
maxList.append(g)
  

for i in range(1,n):
  g = a[0]
  for j in range(i):
    g = gcd(g,a[j])
  valueList.append(g)
  g = valueList[i]
  for k in range(i+1, n):
    g = gcd(g, a[k])
  maxList.append(g)
    
print(max(maxList))

### FIXED CODE ###

from fractions import gcd
from functools import reduce
import copy

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

fValueList = []
lValueList = []
maxList = []

if n == 2:
  print(max(a[0], a[1]))
else:
  fValueList.append(a[0])
  lValueList.append(a[n-1])
  for i in range(1,n-1):
    g = fValueList[i-1]
    fValueList.append(gcd(g, a[i]))

  for i in range(1,n-1):
    g = lValueList[i-1]
    lValueList.append(gcd(g, a[n-1-i]))
  
  maxList.append(fValueList[n-2])
  maxList.append(lValueList[n-2])
  for k in range(n-2):
    g = gcd(fValueList[k], lValueList[n-3-k])
    maxList.append(g)
    
  print(max(maxList))
A=input().split()
B=input().split()
if A[0]==B[2] and A[1]==B[1] and A[2]==B[2]:
    print("YES")
else:
    print("NO")

### FIXED CODE ###

A=str(input())
B=str(input())
if A[0]==B[2] and A[1]==B[1] and A[2]==B[0]:
    print("YES")
else:
    print("NO")
S = input()
dic = {"Sunny":"Cloudy","Rainy":"Sunny","Cloudy":"Rainy"}
print(dic(S))

### FIXED CODE ###

S = input()
dic = {"Sunny":"Cloudy","Rainy":"Sunny","Cloudy":"Rainy"}
print(dic[S])
a, b, c, d = map(int, input().split())
print(max([a*c, a*d, b*c, c*d]))

### FIXED CODE ###

x = int(input())
print(1 if x == 0 else 0)
a,b=int(input().split())
if a < 10:
  c = int(b-1000+199*a)
else:
  c = int(b)
print(c)

### FIXED CODE ###

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

if a >=10:
  c=int(b)
  print(c)
else:
  c=int(b+1000-100*a)
  print(c)
from sys import stdout


def upper(n):
    if n < 5:
        return list("* ")
    else:
        return list(" *")


def lower(n):
    m = n % 5
    a = ['*'] * m + [' ']
    a = a + ['*'] * (5 - len(a))
    return a


def abacus(n):
    return upper(n) + ['='] + lower(n)


while True:
    try:
        ns = map(int, ("0" + raw_input().strip())[-5:])
    except EOFError:
        break

    ab = []
    for n in ns:
        ab.append(abacus(n))

    for i in range(8):
        for j in range(5):
            stdout.write(ab[j][i])
        stdout.write("\n")

    print

### FIXED CODE ###

from sys import stdout


def upper(n):
    if n < 5:
        return ['*', ' ']
    else:
        return [' ', '*']


def lower(n):
    m = n % 5
    return ['*'] * m + [' '] + ['*'] * (4 - m)


def abacus(n):
    return upper(n) + ['='] + lower(n)


res = []
while True:
    try:
        ns = map(int, ('00000' + raw_input().strip())[-5:])
    except EOFError:
        break

    ab = []
    for n in ns:
        ab.append(abacus(n))

    for i in range(8):
        for j in range(5):
            res.append(ab[j][i])
        res.append('\n')
    res.append('\n')

stdout.write(''.join(res[:-1]))
K,X=map(int,raw_input().split())
if K*500>=X:
  print "Yes"
else:
  print "No"

### FIXED CODE ###

K,X=map(int,raw_input().split())
if K*500>=X:
  print "Yes"
else:
  print "No"
x=int(input())

if x==7:
  	print("Yes")
elif x==5:
  	print("Yes")
elif x==3:
  	print("Yes")
else:
  	print("No"

### FIXED CODE ###

a = input()
a = int(a)

if a == 7 or a == 5 or a == 3:
    print('YES')
else:
    print('NO')
N = input()
if N < 1000:
    print("ABC")
else:
    print("ABD")

### FIXED CODE ###

N = int(input())
if N < 1000:
    print("ABC")
else:
    print("ABD")