Harryxun/stf_run huggingface dataset:
x, a, b = map(int, input().split())
if abs(x - a) >= abs(x - b):
    print("B"):
else:
    print("A")

### FIXED CODE ###

x, a, b = map(int, input().split())
if abs(x - a) >= abs(x - b):
    print("B")
else:
    print("A")
a,b,c = map(int,input().split())
import math
if (math.sqrt(a)+math.sqrt(b)) ** 2 < numpy.sqrt(c) ** 2:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

a,b,c = map(int,input().split())
if c-a-b < 0:
    print('No')
elif (c-a-b)**2-4*a*b > 0:
    print('Yes')
else:
    print('No')
a = input()
b = input()

if a == b.reverse():
  print("YES")
else:
  print("NO")

### FIXED CODE ###

a = input()
b = input()

if a == b[::-1]:
  print("YES")
else:
  print("NO")
from numba.decorators import jit


### FIXED CODE ###

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


def memoize(f):
    cache = {}

    def helper(x, y):
        if (x, y) not in cache:
            cache[(x, y)] = f(x, y)
        return cache[(x, y)]
    return helper


def main():
    for number in m:
        if solve(0, number):
            print('yes')
        else:
            print('no')


@memoize
def solve(i, m):
    if m == 0:
        return True

    if i >= n:
        return False

    res = solve(i + 1, m) or solve(i + 1, m - a[i])
    return res


if __name__ == '__main__':
    main()
import math
a,b = map(int, input().split())
print( (a*b) // math.gcd(a,b))

### FIXED CODE ###

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

for i in range(s, a*b+1, s):
    if i % a  == 0 and  i % b == 0:
        break

print(i)
dice = {v: k for k, v in enumerate(list(map(int, input().split())))}
adjacent = {k: v for k, v in enumerate(sorted(dice.keys()))}
q = int(input())
p = [(-1,2,4,1,3,-1),(3,-1,0,5,-1,2),(1,5,-1,-1,0,4),(4,0,-1,-1,5,1),(2,-1,5,0,-1,3),(-1,3,1,4,2,-1)]
for _ in range(q):
    top, front = map(int, input().split())
    x = dice[top]
    print(adjacent[p[x][front-1]])

### FIXED CODE ###

dice = {v: k for k, v in enumerate(list(map(int, input().split())))}
adjacent = {k: v for k, v in enumerate(sorted(dice.keys()))}
q = int(input())
p = [(-1,2,4,1,3,-1),(3,-1,0,5,-1,2),(1,5,-1,-1,0,4),(4,0,-1,-1,5,1),(2,-1,5,0,-1,3),(-1,3,1,4,2,-1)]
for _ in range(q):
    top, front = map(int, input().split())
    x = dice[top]
    y = dice[front]
    print(adjacent[p[x][y]])
# -*- coding: utf-8 -*-

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

if x < a:
    print("0")
else:
    print("10")


### FIXED CODE ###

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

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

if x < a:
    print("0")
else:
    print("10")
from math import pow

  
s = input()
mod = 10**9 + 7
abc = 0
bc = 0
c = 0
q = 0
for i in s[::-1]:
  if i == "A":
    abc = (abc + bc) % mod
  if i == "B":
    bc = (bc + c) % mod
  if i == "C":
    c = (pow(3,q)+c) % mod
  if i == "?":
    abc = (abc*3 + bc) % mod
    bc = (bc*3 + c) % mod 
    c = (pow(3,q) + c*3) % mod
    q += 1
print(int(abc))

### FIXED CODE ###

s = input()
mod = 10**9 + 7
abc = 0
bc = 0
c = 0
q = 0
for i in s[::-1]:
  if i == "A":
    abc = (abc + bc) % mod
  if i == "B":
    bc = (bc + c) % mod
  if i == "C":
    c = (pow(3,q,mod) + c) % mod
  if i == "?":
    abc = (abc*3 + bc) % mod
    bc = (bc*3 + c) % mod 
    c = (pow(3,q,mod) + c*3) % mod
    q += 1
print(int(abc))
s = int(input()).split() #s_1 s_2を分割して取得し、sに値を入れる
 #出力：['s_1', 's_2']
A=s[0] #出力：s_1
B=s[1] #出力：s_2

if A<=9 and B<=9:
  print(A*B)
else:
  print(-1)

### FIXED CODE ###

i = list(map(int, input().split()))
 #出力：['s_1', 's_2']
A=i[0] #出力：s_1
B=i[1] #出力：s_2

if A<=9 and B<=9:
  print(A*B)
else:
  print(-1)
import sys
sys.setrecursionlimit(10000000)
 
N = int(input())
H = list(list(map(int,input().split())) for _ in range(N))
#sub problem: max cost from 0 to ith day
memo = {}
def rec(i, choice):
  if memo[(i, choice)]:
    return memo[(i,choice)]
  if i == len(H):
    return 0
  m = max(H[i][j] + rec(i+1,j) for j in range(3) if j != choice)
  memo[(i, choice)] = m
  return m
print(max(rec(0, j) for j in range(3)))


### FIXED CODE ###

import sys
sys.setrecursionlimit(10000000)
 
N = int(input())
H = list(list(map(int,input().split())) for _ in range(N))
#sub problem: max cost from 0 to ith day
memo = {}
def rec(i, choice):
  if (i, choice) in memo:
    return memo[(i, choice)]
  if i == len(H):
    return 0
  m = max(H[i][j] + rec(i+1,j) for j in range(3) if j != choice)
  memo[(i, choice)] = m
  return m
print(max(rec(0, j) for j in range(3)))
W, H, r, x ,y = list(map(int,input().split()))
if 0 <= x - r <= x + r = W and 0 <= y - r <= y + r = H:
 print('Yes')
else:
 print('No')

### FIXED CODE ###

W, H, x, y, r = list(map(int, input().split()))
print('Yes' if 0 <= x - r <= x + r <= W and 0 <= y - r <= y + r <= H else 'No')
n, m = map(int, input().split())
A = list(map(int, input().split()))
BC = [list(map(int, input().split())) for _ in range(m)]
BC.sort(key=lambda x: -x[1])

[extend([BC[i][1]] * BC[i][0]) for i in range(m)]

A.sort(reverse=True)
print(sum(A[:n]))

### FIXED CODE ###

import sys

input = sys.stdin.readline
n, m = map(int, input().split())
A = list(map(int, input().split()))
BC = [list(map(int, input().split())) for _ in range(m)]
BC.sort(key=lambda x: -x[1])

maxi = n*2
extend = A.extend
[extend([ls[1]] * ls[0]) for ls in BC if len(A) <= maxi]
A.sort(reverse=True)

print(sum(A[:n]))
A,B,K =(map(int,input().split()))
TL = list(range(A,B+1))
L = [i for i in TL if ((i>=A) and i<=A+K-1)] 
LU =  [i for i in TL if  ((i>=B-K+1) and i<=B)] 
#L.append( [i for i in TL if ((i<=B) and (i>=B-K))])
LL = set(L + LU)
for i in LL:
    print(i)

### FIXED CODE ###

a, b, k = map(int,input().split())
for i in range(a, min(a + k, b + 1)):
    print(i)
for i in range(max(b - k + 1, a + k), b + 1):
    print(i)
from fractions import gcd
import functools
#import math

def gcdf(a,n):
    a0=a[0]
    ramin=10**9
    ramin0=20**9
    while ramin0!=ramin:
        ramin0=ramin
        for i in range(1,n):
            ra=a[i]%a0
#            print(ra,a0,i,ramin)
            if ramin>ra and ra!=0:
                ramin=ra
        a0=ramin
    return ramin


#n=2
#a=[1000000000, 1000000000]
n=int(input())

a=[]
for i in map(int,input().split()):
    a.append(i)
#print(a)
if n==2:
    print(max(a))
else:
    gcdv=0
#    a.sort()
    for i in range(n):
        acpy=list(a)
        del acpy[i]
#        gcdx=gcdf(acpy,n-1)
#        gcdx=gcd(acpy)
#        gcdx=functools.reduce(gcd,acpy)
        gcdx=functools.reduce(math.gcd,acpy)
        if gcdx>gcdv:
            gcdv=gcdx
    print(gcdv)

### FIXED CODE ###

def gcdf(a):
    a.sort()
#    print("a2:",a)
    a0=a[0]
    a=[int(x%a0) for x in a if x%a0 != 0]
#    print("a2:",a)
    if len(a)==0:
        return a0
    else:
        a.append(a0)
        a0=min(a)
        return gcdf(a) 

#n=8
#a=[746130, 1385670, 4849845, 881790, 3233230, 1939938, 570570, 510510]
#ans=[19]
#n=2
#a=[1000000000, 1000000000]
#n=5
#a=[15, 18, 24, 36, 81]
#n=3
#a=[7, 6, 8]
n=int(input())
a=[]
for i in map(int,input().split()):
    a.append(i)
if n==2:
    print(max(a))
elif n<2**10:
    gcdv=0
    for i in range(n):
        acpy=list(a)
        del acpy[i]
        gcdx=gcdf(acpy)
        if gcdx>gcdv:
            gcdv=gcdx
    print(gcdv)
else:
    m=int(n**(1/2))
    ns=int(n/m)
    rgcd=[]
    for mi in range(m):
        ms=ns*mi
        if mi==m-1:
            am=a[ms:n]
        else:
            am=a[ms:ms+ns]
        gcdm=gcdf(am)
        rgcd.append(gcdm)
    gcdv=0

    for mi in range(m):
        rgcd1=list(rgcd)
        del rgcd1[mi]
        gcdrg1=gcdf(rgcd1)
        ms=ns*mi
        if mi==m-1:
            am=a[ms:n]
        else:
            am=a[ms:ms+ns]
#        print(mi,gcdf(am),len(am),gcdf(rgcd1))
        for i in range(len(am)):
            acpy=list(am)
#            del acpy[i]
#            acpy.append(gcdrg1)
            acpy[i]=gcdrg1
            gcdx=gcdf(acpy)
            if gcdx>gcdv:
                gcdv=gcdx
    print(gcdv)
s1 = int(raw_input())
s2 = int(raw_input())
if s1>s2:
    print "GREATER"
elif s1 == s2:
    print "EQUAL"
else:
    print "LESS

### FIXED CODE ###

s1 = int(raw_input())
s2 = int(raw_input())
if s1>s2:
    print "GREATER"
elif s1 == s2:
    print "EQUAL"
else:
    print "LESS"
def main():
    M=10**9+7
    n,k,*a=map(int,open(0).read().split())
    x,y=[],[]
    for i in a:
        if i>0:x+=i,
        if i<0:y+=i,
    if len(x)+len(y)<k or k%2 and not x and len(y)<n:
        print(0)
        exit()
    if k%2 and not x:
        c=1
        for i in sorted(y)[-k:]:
            c=c*i%M
        print(c)
        exit()
    x=sorted(x)[::-1][:k]
    i=len(x)
    y.sort()
    m=len(y)
    j=0
    if i<k:
        j=k-i
        if j%2:
            x=x[:-1]
            i-=1
            j+=1
        x+=y[:j]
        j+=1
    if len(x)!=k:1/0
    while i>1 and j+1<m and x[i-1]*x[i-2]<y[j]*y[j+1]:
        x[i-1],x[i-2]=y[j],y[j+1]
        i-=2
        j+=2
    c=1
    for i in x:
        c=c*i%M
    print(c)
main()

### FIXED CODE ###

def main():
    M=10**9+7
    n,k,*a=map(int,open(0).read().split())
    x,y=[],[]
    for i in a:
        if i>0:x+=i,
        if i<0:y+=i,
    if len(x)+len(y)<k or k%2 and not x and len(y)<n:
        print(0)
        return
    if n==k or k%2 and not x:
        c=1
        for i in sorted(x+y)[-k:]:
            c=c*i%M
        print(c)
        return
    x=sorted(x)[::-1][:k]
    i=len(x)
    y.sort()
    m=len(y)
    j=k-i
    if j%2:
        x=x[:-1]
        i-=1
        j+=1
    x+=y[:j]
    while i>1 and j+1<m and x[i-1]*x[i-2]<y[j]*y[j+1]:
        x[i-1],x[i-2]=y[j],y[j+1]
        i-=2
        j+=2
    c=1
    for i in x:
        c=c*i%M
    print(c)
main()
a,b,c=map(int, input().spilt())
ans= "NO"
for i in range(10):
	if a*i % b == c:
		ans ="YES"
print(ans)

### FIXED CODE ###

a,b,c=map(int, input().split())
ans= "NO"
for i in range(100):
	if a*i % b == c:
		ans ="YES"
print(ans)
s=input()
print(s.count(1))

### FIXED CODE ###

s=input()
print(s.count("1"))
a,b,c = map(int, input().split())
if ((((c-a-b)**2) > (4*a*b)) & (c-a-b > 0)):
  print("Yes")
else:
  print("No")


### FIXED CODE ###

K = int(input())
L = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(L[K-1])
n=int(input())
a=[int(input()) for i in range(n)]
cx=[0]*max(a)
for ai in a:
  cx[ai-1]+=1
ans=0
for ci in cx:
  if ci%2!=0:
    ans+=1
print(ans)

### FIXED CODE ###

from collections import Counter
n = int(input())
a = [int(input()) for i in range(n)]
ans = 0
c = Counter(a)
for i in c.values():
    if i%2!=0:
        ans+=1
print(ans)
def main():
    a,b=map(float,input().split())
    a=int(a)
    print(b*100//1)*a//100)
main()


### FIXED CODE ###

def main():
    a,b=map(float,input().split())
    a=int(a)
    print(int((b*100+0.1)//1)*a//100)
main()
b = input();
if b == "A":
  print("T")
elif b = "T":
  print("A")
elif b = "G":
  print("C")
elif v = "C":
  print("G")

### FIXED CODE ###

b = input()
if b == "A":
  print("T")
elif b == "T":
  print("A")
elif b == "G":
  print("C")
elif b == "C":
  print("G")
N = int(input())
A = list(map(int,input().split()))
A.sort()

w_min = A[1]

for i in range(w_min,0,-1):
    count = 0
    for j in A:
        if j%i != 0:
            count = count + 1
            if count > 1:
                break
    if count < 2:
        print(i)
        break
    


### FIXED CODE ###

A,B,T = map(int,input().split())

print(T//A * B)
from itertools import product
from collections import Counter
 
n, c = map(int, input().split())
color_costs = [list(map(int, input().split())) for _ in range(c)]
matrix = [list(map(int, input().split())) for _ in range(n)]

colord = {(i, j):cost for i, row in enumerate(color_costs)
                      for j, cost in enumerate(row)}
 
res = []
for n in range(3):
  color_count = Counter(c-1 for i, row in enumerate(matrix) 
                            for j, c in enumerate(row) 
                            if (i + j) % 3 == n)
  def color_cost(color):
    return sum(colord[ccolor, color] * ccount for ccolor, ccount in color_count.items())
  cx = [(color, color_cost(color)) for color in range(c)]
  sorted_by_cost = sorted(cx, key=lambda x:x[1])
  cheapest3 = sorted_by_cost[:3]
  res.append(cheapest3)

color_pickss = product(*res)
filtered_unique = (picks for picks in color_pickss if len(set(x[0] for x in picks)) == 3)
costs = (sum(x[1] for x in picks) for pick in filtered_unique)
print(min(costs))

### FIXED CODE ###

from itertools import product
n, c = map(int, input().split())
color_costs = [map(int, input().split()) for _ in range(c)]
matrix = [map(int, input().split()) for _ in range(n)]
colord = {(i+1, j+1):cost for i, row in enumerate(color_costs)
                         for j, cost in enumerate(row)}
 
cellgroups = [[] for _ in range(3)]
for i, row in enumerate(matrix):
  for j, color in enumerate(row):
    cellgroups[(i+1+j+1)%3].append(color)
  
cc = [[(color, sum(colord[cellcolor, color] for cellcolor in cells))
	       									for color in range(1,c+1)]
      										for cells in cellgroups]
 
dd = [sorted(xs, key=lambda x:x[1])[:3] for xs in cc]
ee = (a[1]+b[1]+c[1] for a, b, c in product(*dd) if len(set((a[0], b[0], c[0]))) == 3)
print(min(ee))
import itertools
n, m = map(int, input().split())
ks = [list(map(int, input().split())) for _ in range(m)]
p = list(map(int, input().split()))

#%%
cnt = 0
for bits in itertools.product([0, 1], repeat=n):
    # ライトの配列の初期化
    lights = [0] * m

    # 電球ごとのONになってるスイッチの数をカウント
    # スイッチのindexでループを回す
    for i in range(n):
        if bits[i] == 1: #スイッチがONのとき
            sw = i + 1 # スイッチの番号
            for j in range(len(ks)): # 全部のlight-switchの配線を確認
                if sw in ks[j][1:]: # 配線がつながってるとき
                    lights[j] += 1 # そのlightに1を加算

    # カウント終了後条件判別
    # 一つもスイッチがONになってないとライトが付きもしない
    # if 0 not in lights:
        # 2で割ったあまり
    m_lights = [l%2 for l in lights]
    if m_lights == p:
        cnt += 1

print(cnt)


### FIXED CODE ###

a, p = map(int, input().split())
print((a*3 + p)//2)
st = input()
if st[-1]=="s":
  st.append("es")
else:
  st.append("s")

### FIXED CODE ###

st = input()
if st[-1]=="s":
  name = st+"es"
else:
  name = st+"s"
print(name)
n=int(input())
s=[input() for i in range(n)]
m=int(input())
t=[input() for i in range(m)]

S=set(s[i] for i in range(n))
L=len(S)
a=[0]*(L+1)
for i in L:
    a[i]=s.count(S[i])-t.count(S[i])
print(max(a))


### FIXED CODE ###

n=int(input())
s=[input() for i in range(n)]
m=int(input())
t=[input() for i in range(m)]

S=set(s[i] for i in range(n))
L=len(S)
x = list(S)
a=[0]*(L+1)
for i in range(L):
    a[i]=s.count(x[i])-t.count(x[i])
print(max(a))
from collections import Counter
n = int(input())
v = list(map(int, input().split()))
C1 = []
C2 = []
for i in range(n)[::2]:
    C1.append(v[i])
    C2.append(v[i+1])

C1 = Counter(C1).most_common()
C2 = Counter(C2).most_common()

if C1[0][0] != C2[0][0]:
    print(n-C1[0][1]-C2[0][1])
else:
    ans1 = n-C1[0][1]-C2[1][1]
    ans2 = n-C1[1][1]-C2[0][1]
    print(min(ans1, ans2))

### FIXED CODE ###

from collections import Counter
n = int(input())
v = list(map(int, input().split()))
v1 = Counter(v[::2])
v2 = Counter(v[1::2])
E = v1.most_common()
O = v2.most_common()
if E[0][0] == O[0][0]:
    tmp1 = E[1][1] if len(E) > 1 else 0
    tmp2 = O[1][1] if len(O) > 1 else 0
    ans = min(n-E[0][1]-tmp2, n-tmp1-O[0][1])
else:
    ans = n-E[0][1]-O[0][1]
print(ans)
n=int(input())
d=list(map(int,input().split()))
d.sort()
ans=d[m]-d[m-1]
print(ans+1)


### FIXED CODE ###

n=int(input())
d=list(map(int,input().split()))
d.sort()
m=int(n/2)
ans=d[m]-d[m-1]
print(ans)
import sys
sys.setrecursionlimit=10**12

def modinv(a,m=10**9+7):
    if a==0: return 1
    else:
        b=m
        (x, lastx) = (0, 1)
        (y, lasty) = (1, 0)
        while b != 0:
            q = a // b
            (a, b) = (b, a % b)
            (x, lastx) = (lastx - q * x, x)
            (y, lasty) = (lasty - q * y, y)
        return lastx % m

def cur(p):
        for x in neighbor[p]:
            if x==0: sys.exit()
            if x==par[p]: continue
            par[x]=p
            descend[p]+=cur(x)
        return descend[p]


def cur2(p):
    for x in neighbor[p]:
        if x==par[p]: continue
        ans[x]=ans[p]*descend[x]*modinv(n-descend[x])
        ans[x]%=mod
        cur2(x)

mod=10**9+7
n=int(input())
neighbor=[[]  for _ in range(n+1)]
descend=[1]*(n+1)
par=[1]+[0]*(n)

for _ in range(n-1):
    a,b=map(int,input().split())
    neighbor[a].append(b)
    neighbor[b].append(a)
cur(1)

ans=[1]*(n+1)
ans1=1
for i in range(1,n+1):
    ans1=ans1*i*modinv(descend[i])
    ans1%=mod
ans[1]=ans1

cur2(1)

for i in range(1,n+1):
    print(ans[i])


### FIXED CODE ###

s=input()
print("Yes" if s[2]==s[3] and s[4]==s[5] else "No")
# スペース区切りの整数入力
N,M,K = map(int, input().split())

fcnum = [ 0 for i in range(N+1)]
fring = [[] for i in range(N+1)]
frno =  [-1 for i in range(N+1)]

ab = []
for i in range(M):
    aa,bb = map(int, input().split())
    if aa > bb:
        aa,bb = bb,aa
    #ab.append([aa,bb])
    fcnum[aa] -= 1
    fcnum[bb] -= 1
    #for aa,bb in ab:
    if frno[aa] == -1 and frno[bb] == -1:
        frn = min(aa,bb)
        frno[aa] = frn
        frno[bb] = frn
        fring[frn].append(aa)
        fring[frn].append(bb)
    elif frno[aa] == -1 and frno[bb] != -1:
        frn = frno[bb]
        frno[aa] = frn
        fring[frn].append(aa)
    elif frno[aa] != -1 and frno[bb] == -1:
        frn = frno[aa]
        frno[bb] = frn
        fring[frn].append(bb)
    else:
        if frno[aa] != frno[bb]:
            if len(fring[aa]) > len(fring[bb]):
                frnto = frno[aa]
                frnfrom = frno[bb]
            else:
                frnto = frno[bb]
                frnfrom = frno[aa]
            fring[frnto].extend(fring[frnfrom])
            for mvf in fring[frnfrom]:
                frno[mvf] = frnto
            del fring[frnfrom]

for k in range(len(fring)):
    cnum = len(fring[k]) - 1
    for ff in fring[k]:
        fcnum[ff] += cnum

cd = []
for i in range(K):
    cc,dd = map(int, input().split())
    #if cc > dd:
    #    cc,dd = dd,cc
    #cd.append([cc,dd])
    if frno[cc] == frno[dd]:
        fcnum[cc] -= 1
        fcnum[dd] -= 1

for i in range(1,len(fcnum)):
    print(fcnum[i]," ",end="")


### FIXED CODE ###

# スペース区切りの整数入力
N,M,K = map(int, input().split())

fcnum = [ 0 for i in range(N+1)]
fring = [[] for i in range(N+1)]
frno =  [-1 for i in range(N+1)]

ab = []
for i in range(M):
    aa,bb = map(int, input().split())
    if aa > bb:
        aa,bb = bb,aa
    fcnum[aa] -= 1
    fcnum[bb] -= 1
    ab.append([aa,bb])

for aa,bb in ab:
    if frno[aa] == -1 and frno[bb] == -1:
        frn = aa
        frno[aa] = frn
        frno[bb] = frn
        fring[frn].append(aa)
        fring[frn].append(bb)
    elif frno[aa] == -1 and frno[bb] != -1:
        frn = frno[bb]
        frno[aa] = frn
        fring[frn].append(aa)
    elif frno[aa] != -1 and frno[bb] == -1:
        frn = frno[aa]
        frno[bb] = frn
        fring[frn].append(bb)
    else:
        if frno[aa] != frno[bb]:
            if len(fring[frno[aa]]) > len(fring[frno[bb]]):
                frnto = frno[aa]
                frnfrom = frno[bb]
            else:
                frnto = frno[bb]
                frnfrom = frno[aa]
            fring[frnto].extend(fring[frnfrom])
            for mvf in fring[frnfrom]:
                frno[mvf] = frnto
            fring[frnfrom] = []

for i in range(K):
    cc,dd = map(int, input().split())
    if frno[cc] == frno[dd] and frno[cc] != -1:
        fcnum[cc] -= 1
        fcnum[dd] -= 1

for k in range(1,len(fring)):
    cnum = len(fring[k]) - 1
    for ff in fring[k]:
        fcnum[ff] += cnum

for i in range(1,len(fcnum)):
    print(fcnum[i]," ",end="")
# # import itertools

# # # N, K = map(int, input().split())

# # def com(n, r):
# #     a = len(list(itertools.combinations(range(n), r)))
# #     return a


from collections import defaultdict

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

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

S, T = map(int, input().split())
S -= 1
T -= 1

d = defaultdict(int)
ans = []
def dfs(u, path, num, dis):
    global ans
    path += str(u)
    if len(path) == 4 and d[path] != 0:
        ans.append(10**5)
        return

    if u == T and num % 3 == 0:
        ans.append(int(dis / 3))
        return
    if len(path) == 4:
        d[path] += 1
        path = ""
    for v in G[u]:
        dfs(v, path, num+1, dis+1)

dfs(S, path="", num=0, dis=0)
if len(ans) == 0:
    print(-1)
else:
    a = min(ans)
    if a == 10**5:
        print(-1)
    else:
        print(a)



### FIXED CODE ###

# SからTの長さが3の倍数の最短バスを求める
N, M = map(int, input().split())
G = [[] for _ in range(N)]

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

S, T = map(int, input().split())
S -= 1
T -= 1

from collections import deque

def bfs(start, terminal):
    q = deque([(start, 0)])
    color = [[0]*3 for _ in range(N)]
    d = [[-1]*3 for _ in range(N)]
    d[start][0] = 0
    l = 0
    while len(q) > 0:
        u, l = q.popleft()
        nl = (l + 1) % 3
        for v in G[u]:
            if color[v][nl] == 0:
                q.append((v, nl))
                color[v][nl] = 1
                d[v][nl] = d[u][l] + 1
    
    if d[terminal][0] == -1:
        return -1
    else:
        return d[terminal][0] // 3 

print(bfs(S, T))
x, n = map(int, input().split())
minn = 10000000
if n == 0:
    print(x)
    exit()
p = list(map(int, input().split()))
for i in range(1, 101):
    if i not in p:
        tmp = abs(x-i)
        if minn > tmp:
            ans = i
            minn = tmp
        elif minn == tmp:
            ans = min(i, ans)

print(ans)

### FIXED CODE ###

x, n = map(int, input().split())
p = list(map(int, input().split()))
for i in range(101):
    if x-i not in p:
        print(x-i)
        exit()
    elif x+i not in p:
        print(x+i)
        exit()
n=input()
b=list(map(int,input(). split ()))
c=1
if 0 in b:
  print(0)
  return
c=1
for i in b:
  c=c*i
  if c>10**18:
      print(-1)
      return
print(c)

### FIXED CODE ###

n=int(input())
a=list(map(int, input().split( )))
if 0 in a:
  print(0)
  
else:
    c=1
    for i in a:
        c= c*i
        if c> 10**18:
            c=-1
            break
    print(c)
import sys

N = int(input())
XYs = [tuple(map(int, input().split())) for _ in range(N)]

parities = [(X+Y) % 2 for X, Y in XYs]
if len(set(parities)) != 1:
    print(-1)
    sys.exit()

m = 19 if parities[0] else 20
ds = [1] * m
print(m)
print(*ds)

for X, Y in XYs:
    if X >= 0:
        ws = ['R'] * X
    else:
        ws = ['L'] * -X
    if Y >= 0:
        ws += ['U'] * Y
    else:
        ws += ['D'] * -Y
    ws += ['RL'] * ((m-abs(X)-abs(Y)) // 2)
    print(''.join(ws))


### FIXED CODE ###

import sys

LEN_D = 31
CONST = 2**LEN_D - 1

N = int(input())
XYs = [tuple(map(int, input().split())) for _ in range(N)]

parities = [(X+Y) % 2 for X, Y in XYs]
if len(set(parities)) != 1:
    print(-1)
    sys.exit()

if parities[0]:
    m = LEN_D
    ds = [2**i for i in range(LEN_D)]
else:
    m = LEN_D + 1
    ds = [1] + [2**i for i in range(LEN_D)]
print(m)
print(*ds)

for X, Y in XYs:
    ws = []
    if (X+Y) % 2 == 0:
        X -= 1
        ws.append('R')
    u = ((X+Y) + CONST) // 2
    v = ((X-Y) + CONST) // 2
    for i in range(LEN_D):
        ws.append('LDUR'[((u>>i) & 1) * 2 + ((v>>i) & 1)])
    print(''.join(ws))