Harryxun/stf_run huggingface dataset:
def dfs(x, y, gx, gy, s, f):
    if len(s) == 0:
        if (x, y) == (gx, gy):
            return True
        return False
    ans = False
    if s[0] == 'T':
        if f:
            for xx, yy in [(x, y + 1), (x, y - 1)]:
                ans = ans or dfs(xx, yy, gx, gy, s[1:], f)
        else:
            for xx, yy in [(x + 1, y), (x - 1, y)]:
                ans = ans or dfs(xx, yy, gx, gy, s[1:], f)
    else:
        if f:
            for xx, yy in [(x + 1, y), (x - 1, y)]:
                ans = ans or dfs(xx, yy, gx, gy, s[1:], f)
        else:
            for xx, yy in [(x, y + 1), (x, y - 1)]:
                ans = ans or dfs(xx, yy, gx, gy, s[1:], f)
    return ans


def main():
    s = input()
    x, y = map(int, input().split())
    if dfs(0, 0, x, y, s, True):
        print('Yes')
    else:
        print('No')


main()


### FIXED CODE ###

def main():
    s = input()
    x, y = map(int, input().split())
    sl = s.split('T')
    dx = list(map(len, sl[::2]))
    dy = list(map(len, sl[1::2]))
    nx = dx.pop(0)
    ny = 0
    dx.sort(reverse=True)
    dy.sort(reverse=True)
    for xx in dx:
        if x >= nx:
            nx += xx
        else:
            nx -= xx
    for yy in dy:
        if y >= ny:
            ny += yy
        else:
            ny -= yy
    print('YNeos'[nx != x or ny != y::2])


main()
if N >= 10:
    print(R)
else:
    print(100*(10-K))
    

### FIXED CODE ###

N, R = map(int, input().split())
if N >= 10:
    print(R)
else:
    print(100*(10-N) + R)
import sys
input = sys.stdin.readline
#sys.setrecursionlimit(10**9)
n,m = map(int,input().split())
s = list(input())
s.reverse()
list1 = []
def maze(mass,times): #今いるマス、現状の手数
  if mass+m >= n:
    list1.append(str(n-mass))
    return
  for i in range(m,0,-1):
    if s[mass+i] == "0":
      list1.append(str(i))
      maze(mass+i,times+1)
      return
    elif i == 1:
      print("-1")
      exit()
  return

a = maze(0,0)
list1.reverse()
print(" ".join(list1))

### FIXED CODE ###

import sys
#input = sys.stdin.readline
sys.setrecursionlimit(10**9)
n,m = map(int,input().split())
s = list(input())
s.reverse()
list1 = []
def maze(mass,times): #今いるマス、現状の手数
  if mass+m >= n:
    list1.append(str(n-mass))
    return
  for i in range(m,0,-1):
    if s[mass+i] == "0":
      list1.append(str(i))
      maze(mass+i,times+1)
      return
    elif i == 1:
      print("-1")
      exit()
  return

a = maze(0,0)
list1.reverse()
print(" ".join(list1))
N, W = map(int, input().split())
A = [[int(i) for i in input().split()] for i in range(N)]
memo = [[0] * (W + 1) for i in range(N + 1)]

def dfs(i, j):
    if memo[i][j] != 0:
        ans = memo[i][j]
    elif i == N:
        return 0
    elif A[i][0] > j:
        return dfs(i + 1, j)
    else:
        ans  = max(dfs(i + 1, j), A[i][1] + dfs(i + 1, j - A[i][0]))
        memo[i][j] = ans
    return ans
        
print(dfs(0, W))

### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 8)

N, W = map(int, input().split())
A = [[int(i) for i in input().split()] for i in range(N)]
memo = {i : {} for i in range(N)}

def dfs(i, j):
    if i == N:
        return 0
    elif j in memo[i]:
        return memo[i][j]
    elif A[i][0] > j:
        ans = dfs(i + 1, j)
    else:
        ans  = max(dfs(i + 1, j), A[i][1] + dfs(i + 1, j - A[i][0]))
    memo[i][j] = ans
    return ans
        
print(dfs(0, W))
nums = input().sprit()
a = int(nums[0])
b = int(nums[1])
print(a * b,(a + b) * 2)

### FIXED CODE ###

nums = input().split()
a = int(nums[0])
b = int(nums[1])
print(a * b,(a + b) * 2)
from collections import deque

n = int(input())
commands = [input() for _ in range(n)] # splitとかしてると間に合わない

l = deque()
for com in commands:
    if com[0]=='i':
        l.appendleft(com[7:])
    elif com[6]=='F':
        l.popleft()
    elif com[6]=='L':
        l.pop()
    else:
        l.remove(com[7:])

s = ' '.join(l)
print(s)


### FIXED CODE ###

from collections import deque

n = int(input())
commands = [input() for _ in range(n)] # splitとかしてると間に合わない

l = deque()
for com in commands:
    if com[0]=='i':
        l.appendleft(com[7:])
    elif com[6]=='F':
        l.popleft()
    elif com[6]=='L':
        l.pop()
    else:
        try:
            l.remove(com[7:])
        except:
            pass

s = ' '.join(l)
print(s)
n=int(input())
X=[]
Y=[]
A=[0]*n
for i in range(n):
  A[i]=int(input())
  a=A[i]
  x=[]
  y=[]
  for j in range(a):
    x,y=[int(s) for s in input().split()]
  X.append(x)
  Y.append(y)
  
c=0
for i in range(int(n/2)-1):
  l=[1]*n
  for j in range(i,n-i):
    #if l[j]==0:continue
    #for k in range(A[j]):
      #b=X[j][k]
      #l[b] *= Y[j][k]

if c < l.count(1):
  c=l.count(1) 
  
        
  
print(c)  
   

### FIXED CODE ###

n=int(input())
X=[]
Y=[]
A=[0]*n
for i in range(n):
  A[i]=int(input())
  a=A[i]
  x=[0]*a
  y=[0]*a
  for j in range(a):
    x[j],y[j]=[int(s) for s in input().split()]
  X.append(x)
  Y.append(y)
  
s=0
for i in range(2**n):
  c=0
  d=0
  B=[0]*n
  for j in range(n):
    if((i >> j) & 1):
      c=c+1
      B[j]=1
  for k in range(n):
    if B[k]==1:
      for j in range(A[k]):
        if Y[k][j]!=B[X[k][j]-1]:
          d=-1
          break
    if d<0:
      break
  if s<c and d==0:
    s=c
      
      
print(s)
N = input()
A = input()
B = input()
if NA > B:
  return B
else:
  return NA

### FIXED CODE ###

import numpy as np
N,A,B=map(int,input().split())
if N*A > B:
  print(B)
else:
  print(N*A)
import itertools
A = list(map(int, list(input()))

ans = 0
N = len(A)-1
for p in product([0,1], repeat = N):
	now = A[0]
    for i in range(N):
      if p[i] == 0:
        now = now*10 + A[i+1]
      else:
        ans += now
        now = A[i+1]
	ans += now
print(ans)    


### FIXED CODE ###

A = list(map(int, list(input())))
 
ans = 0
from itertools import *
N = len(A)-1
for p in product([0,1],repeat=N):
    now = A[0]
    for i in range(N):
        if p[i] == 0:
            now = now*10+A[i+1]
        else:
            ans += now
            now = A[i+1]
    ans += now
print(ans)
import sys

y = sys.stdin.readline()
y = int(y)

x = sys.stdin.readline()

x_list = int(x.split(" "))

for i in range(1, y + 1):
  if list(i) < list(i - 1):
    for j range(i - 1, 0):
      if list(j) < list(i):
        list(i),  list(j+1) = list(j+1), list(i)
        break
  for k in range(0, y):
    print list(k)

### FIXED CODE ###

import sys

def insertionSort(x_list,y):
  for i in range(1, y):
    v = x_list[i]
    j = i - 1
    while j >= 0 and x_list[j] > v:
      x_list[j + 1] = x_list[j]
      j -= 1
    x_list[j+1] = v
    for k in range(0, y):
      print x_list[k],
    print

y = sys.stdin.readline()
y = int(y)

x = sys.stdin.readline()

x_list = x.split(" ")

for i in range(y):
  x_list[i] = int(x_list[i])

for k in range(0, y):
  print x_list[k],
print

insertionSort(x_list, y)
n = int(input())
l = set()

for _ in range(n):
    a = int(input())

    if a in l:
        l.remove(a)
    else:
        l.append(a)

print(len(l))


### FIXED CODE ###

n = int(input())
l = set()

for _ in range(n):
    a = int(input())

    if a in l:
        l.remove(a)
    else:
        l.add(a)

print(len(l))
class Factorial:
    def __init__(self, n, mod):
        self.f = [1]
        self.mod = mod
        for j in range(1, n + 1):
            self.f.append(self.f[-1] * j % mod)
        self.i = [pow(self.f[-1], mod - 2, mod)]
        for j in range(n, 0, -1):
            self.i.append(self.i[-1] * j % mod)
        self.i.reverse()
    def factorial(self, j):
        return self.f[j]
    def ifactorial(self, j):
        return self.i[j]
    def comb(self, n, k):
        return self.f[n] * self.i[n - k] % self.mod * self.i[k] % self.mod if n >= k else 0


N, A, B, K = map(int, input().split())
MOD = 998244353

c = Factorial(N + 1, MOD).comb

def calc(a, b):
    return (c(N, a) * c(N, b)) % MOD

ans = 0
for a in range(N + 1):
    b = (K - (A * a)) // B
    if A * a + B * b == K and b <= N:
        ans += calc(a, b)
        ans %= MOD

print (ans)


### FIXED CODE ###

import numpy as np
MOD = 998244353

class Factorial:
    def __init__(self, n, mod):
        self.f = [1]
        self.mod = mod
        for j in range(1, n + 1):
            self.f.append(self.f[-1] * j % mod)
        self.i = [pow(self.f[-1], mod - 2, mod)]
        for j in range(n, 0, -1):
            self.i.append(self.i[-1] * j % mod)
        self.i.reverse()
    def factorial(self, j):
        return self.f[j]
    def ifactorial(self, j):
        return self.i[j]
    def comb(self, n, k):
        return self.f[n] * self.i[n - k] % self.mod * self.i[k] % self.mod if n >= k else 0

def gcd(a, b):
    if a > b:
        a, b = b, a
    if b % a == 0:
        return a
    return gcd(b % a, a)

N, A, B, K = map(int, input().split())

if A < B:
    A, B = B, A

# n = 2 * min(K // A + 2, N + 1) + 3
n = min((K + A - 1) // A, N) + 1
lcm = A * B // gcd(A, B)
step = lcm // A

c = Factorial(N + 1, MOD).comb #O(N)

def calc(a, b):
    if a > b:
        a, b = b, a #必ずaのほうが小さくなる
    return (c(N, a) * c(N, b)) % MOD


def count(a, b):
    if a <= N and b <= N:
        return calc(a, b)
    return 0

def maike_satrt(step):
    for i in range(step):
        if (K - A * i) % B == 0:
            return i

start = maike_satrt(step)
# print (start, n)
ans = 0
for a in range(start, n, step): #Aの数
    if A * a > K:
        break
    # if (K - A * a) % B != 0:
    #     continue
    b = (K - A * a) // B
    # print ('a=', a, 'b=', b)
    ans += count(a, b)
    ans %= MOD

print (ans)
#dp[i][sum_v]:= i-1以下の品物の中から、価値をsum_v以上になる時の重さの最小値
import math
N,W=map(int,input().split())

w,v=[0],[0]

for _ in range(N):
    wi,vi=map(int,input().split())
    w.append(wi)
    v.append(vi)

dp=[[math.inf for _ in range(N*max(v)+1)] for _ in range(N+1)]
dp[0][0]=0

for i in range(N):
    for sum_v in range(N*max(v)+1):
        if sum_v-v[i]>=0:
            dp[i+1][sum_v]=min(dp[i][sum_v-v[i+1]]+w[i+1],dp[i][sum_v])
        else:
            dp[i+1][sum_v]=dp[i][sum_v]
#print(dp)

ans=0
for i in range(N+1):
    for sum_v in range(N*max(v)+1):
        if dp[i][sum_v]<=W:
            ans=max(ans,sum_v)
print(ans)   


### FIXED CODE ###

#dp[i][sum_v]:= i-1以下の品物の中から、価値をsum_v以上になる時の重さの最小値

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

w,v=[0],[0]

for _ in range(N):
    wi,vi=map(int,input().split())
    w.append(wi)
    v.append(vi)

dp=[[10**12 for _ in range(N*max(v)+1)] for _ in range(N+1)]
dp[0][0]=0

for i in range(N):
    for sum_v in range(N*max(v)+1):
        if sum_v-v[i+1]>=0:
            dp[i+1][sum_v]=min(dp[i][sum_v-v[i+1]]+w[i+1],dp[i][sum_v])
        else:
            dp[i+1][sum_v]=dp[i][sum_v]

ans=0

for sum_v in range(N*max(v)+1):
    if dp[N][sum_v]<=W:
        ans=max(ans,sum_v)
print(ans)
h, w, d = map(int, input().split())
a = []
for i in range(h):
    a+=list(map(int, input().split()))
n = len(a)
q = int(input())
max_dbl_line = 10

def dist(i, j):
    dw = abs(i%w - j%w)
    dh = abs(i//w - j//w)
    return dw + dh

idx_table = [0] * n
for i in range(n):
    idx_table[a[i]-1] = i

# ダブンリングテーブル作成
dbl = [[0] * n for i in range(max_dbl_line)]
tmp = []
for i in range(n):
    if a[i]+d in a:
        next_node = idx_table[i]
    else:
        next_node = -1
    if next_node!=-1:
        next_d = dist(idx_table[i], next_node)
    else:
        next_d = float('inf')
    tmp.append((next_node, next_d))
dbl[0] = tmp
for i in range(max_dbl_line-1):
    temp = []
    for j in range(n):
        next_node = dbl[i][dbl[i][j][0]][0]
        next_d = dbl[i][j][1]+dbl[i][dbl[i][j][0]][1]
        temp.append((next_node, next_d))
    dbl[i+1] = temp

def f(l, r):
    cnt = (r-l)//d
    ret = 0
    now = a.index(l)-1
    if cnt==0:
        return ret
    for i in range(max_dbl_line):
        if cnt & 1<<i:
            ret+=dbl[i][now][1]
            now = now + d*2**i
    return ret

for i in range(q):
    l, r = map(int, input().split())
    print(f(l,r))

### FIXED CODE ###

import sys
input = sys.stdin.readline

h, w, d = map(int, input().split())
n = h*w
a = [0]*n
for i in range(h):
    t = list(map(int, input().split()))
    for j in range(w):
        a[w*i+j] = t[j]-1

def dist(i, j):
    dh = abs(i//w - j//w)
    dw = abs(i%w - j%w)
    return dh + dw

idx_list = [0] * n
for i in range(n):
    idx_list[a[i]] = i

dist_list = [0]*n
for i in range(n):
    if i < d:
        dist_list[i] = 0
    else:
        dist_list[i] = dist_list[i-d] + dist(idx_list[i-d], idx_list[i])

q = int(input())
for i in range(q):
    l, r = map(int, input().split())
    l-=1; r-=1
    print(dist_list[r] - dist_list[l])
a,b = map(int,input())
print(int(a*b))

### FIXED CODE ###

a,b = input().split()
a = int(a)
c,d = b.split('.')
c = int(c)
d = int(d)
print(a*c+a*d//100)
K = int(input())
A,B = map(int,input().split())
if A == B:
	if K//A == 0:
        print('OK')
    else:
		if K//A == K//B:
			print('NG')
		else:
			print('OK')

### FIXED CODE ###

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

for i in range(1000):
  if K*i >= A and K*i <= B:
    print('OK')
    break
else:
  print('NG')
n = int(input())
l = list(map(int, input().split()))

for i in range(n):
  while l[i] % 2 == 0:
    count += 1
    l[i] = l[i]/2

print(count)

### FIXED CODE ###

n = int(input())
l = list(map(int, input().split()))
count = 0
for i in range(n):
  while l[i] % 2 == 0:
    count += 1
    l[i] = l[i]/2

print(count)
i = 0
while True:
    n = int(input())
     i += 1
    if n == 0:break
     print("Case {}: {}".format(i, n))

### FIXED CODE ###

i = 0

while True:
 n = int(input())
 i += 1
 if n == 0:
  break
 print("Case {}: {}".format(i, n))
a,p=map(int,input().split())↲
print(int((a*3+p)/2))


### FIXED CODE ###

a, p = map(int, input().split())
#print (int((a*3 + p) / 2))
#a,p=map(int,input().split())↲
print(int((a*3+p)/2))
from itertools import product
import numpy as np

N, M, X = list(map(int, input().split()))
conditions = product([0, 1], repeat=N)
A = np.array([list(map(int, input().split())) for i in range(N)])
succeed = []
for c in conditions:
    p = A * np.array(c).reshape((N, 1))
    res = p.sum(axis=0)
    if np.all(res[1:] >= X):
        succeed.append(res[0])
print(min(succeed) if len(succeed) > 0 else -1)

### FIXED CODE ###

N, M, X = list(map(int, input().split()))
conditions = [str(bin((2**N + i) & (2**(N+1) - 1)))[3:] for i in range(2**N)]
Q = [list(map(int, input().split())) for i in range(N)]
ans = -1
for c in conditions:
    res = [0]*(M+1)
    for i in range(N):
        if c[i] == '1':
            for j in range(M+1):
                res[j] += Q[i][j]

    failed = False
    for i in range(1, M+1):
        if res[i] >= X:
            continue
        else:
            failed = True
    if failed:
        continue
    else:
        if ans == -1:
            ans = res[0]
        else:
            ans = min(ans, res[0])

print(ans)
n=input()
a=input()
b=input()
t=0
i=0
while t<=n:
    if t+a>n:
        i+=n-t
        break
    i+=a
    t+=a
    t+=b
print(i)

### FIXED CODE ###

l = input().split()

[n,a,b] = [int(x) for x in l]

if a==b and a==0:
    print(0)
else:
    x = a+b
    y = n//x

    if a == 0:
        print(0)
    else:
        if b == 0:
            print(n)
        else:
            t = n - y*x
            if t > a:
                print(y*a+a)
            else:
                print(y*a+t)
a,b=map(int,input().split())
if b%a==0:
  print(b//a)
elif:
  print(b//a+1)

### FIXED CODE ###

a,b=map(int,input().split())
c=a-1
count=1
while a<b:
  a=a+c
  count+=1
if b==1:
  count=0
print(count)
for i in range(9):
    a,b,c = map(int, raw_input().split())
    print a,b+c,200*b+300*c

### FIXED CODE ###

for i in range(9):
    a,b,c = map(str, raw_input().split())
    b,c = int(b),int(c)
    print a,b+c,200*b+300*c
from collections import Counter,defaultdict,deque
import sys
from itertools import permutations, combinations
from heapq import heappop, heappush
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
    
def inp(): # n=1
    return int(input())
def inpm(): # x=1,y=2
    return map(int,input().split())
def inpl(): # a=[1,2,3,4,5,...,n]
    return list(map(int, input().split()))
def inpls(): # a=['1','2','3',...,'n']
    return list(input().split())
def inplm(n): # x=[] 複数行
    return list(int(input()) for _ in range(n))
def inpll(n): # [[1,1,1,1],[2,2,2,2],[3,3,3,3]]
    return sorted([list(map(int, input().split())) for _ in range(n)])

def main():
    s=list(input())
    k=inp()
    for i in range(len(s)):
        s[i]=ord(s[i])
    for i in range(len(s)):
        if i==len(s)-1:
            s[i]+=k
            if s[i]>=123:
                s[i]-=26
        elif 123-s[i]<=k:
            k-=123-s[i]
            s[i]=97
        s[i]=chr(s[i])
    print(''.join(s))



if __name__ == "__main__":
    main()

### FIXED CODE ###

from collections import Counter,defaultdict,deque
import sys
from itertools import permutations, combinations
from heapq import heappop, heappush
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
    
def inp(): # n=1
    return int(input())
def inpm(): # x=1,y=2
    return map(int,input().split())
def inpl(): # a=[1,2,3,4,5,...,n]
    return list(map(int, input().split()))
def inpls(): # a=['1','2','3',...,'n']
    return list(input().split())
def inplm(n): # x=[] 複数行
    return list(int(input()) for _ in range(n))
def inpll(n): # [[1,1,1,1],[2,2,2,2],[3,3,3,3]]
    return sorted([list(map(int, input().split())) for _ in range(n)])

def main():
    s=list(input())
    k=inp()
    n=len(s)
    for i in range(n):
        s[i]=ord(s[i])
    for i in range(n):
        if i==n-1:
            s[i]+=k
            if s[i]>=123:
                s[i]=(s[i]-97)%26+97
        elif s[i]==97:
            s[i]='a'
            continue
        elif 123-s[i]<=k:
            k-=123-s[i]
            s[i]=97
        s[i]=chr(s[i])
    print(''.join(s))

if __name__ == "__main__":
    main()
import sys

stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

def intersection(p,q):
    x1, y1, r1 = p
    x2, y2, r2 = q
    d = ((x1 - x2)**2 + (y1 - y2)**2)**.5
    if d > r1 + r2 or abs(r1 - r2) > d:
        return list()
    rc = (d**2 + r1**2 - r2**2) / (2 * d)
    rs = (r1**2 - rc**2)**.5
    vx = (x2 - x1) / d
    vy = (y2 - y1) / d
    p1x = x1 + rc * vx + rs * vy
    p1y = y1 + rc * vy - rs * vx
    p2x = x1 + rc * vx - rs * vy
    p2y = y1 + rc * vy + rs * vx
    return [(p1x, p1y), (p2x, p2y)]

n,k = nm()
if k == 1: print(0); exit(0)
niku = [tuple(nm()) for _ in range(n)]
l = [c*(x**2+y**2)**.5 for x,y,c in niku]
l.sort()
hi = l[k-1]
lo = 0
for _ in range(200):
  mid = (hi+lo)/2
  l = [(x,y,mid/c) for x,y,c in niku]
  p = [(x,y) for x,y,c in niku]
  for i in range(n-1):
    for j in range(i+1,n):
      p.extend(intersection(l[i], l[j]))
  for x,y in p:
    f = sum((v-x)**2 + (w-y)**2 <= r**2 for v,w,r in l)
    if f >= k:
      hi = mid
      break
  else:
    lo = mid
print(hi)

### FIXED CODE ###

import sys

stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

def intersection(p, q, eps = 10**-7):
    x1, y1, r1 = p
    x2, y2, r2 = q
    X = x2 - x1; Y = y2 - y1
    d = X**2 + Y**2
    c1 = r1**2; c2 = r2**2

    rc = (d + c1 - c2) / 2
    rs = d * c1 - rc ** 2
    
    if rs < eps: return list()
    
    rs **= .5
    p1x = x1 + (rc * X + rs * Y) / d
    p1y = y1 + (rc * Y - rs * X) / d
    p2x = x1 + (rc * X + rs * Y) / d
    p2y = y1 + (rc * Y + rs * X) / d
    return [(p1x, p1y), (p2x, p2y)]

eps = 10**-7
n,k = nm()
if k == 1: print(0); exit(0)
niku = [tuple(nm()) for _ in range(n)]
l = [c*(x**2+y**2)**.5 for x,y,c in niku]
l.sort()
hi = l[k-1]
lo = 0
for _ in range(50):
  mid = (hi+lo)/2
  l = [(x,y,mid/c) for x,y,c in niku]
  p = [(x,y) for x,y,c in niku]
  for i in range(n-1):
    for j in range(i+1,n):
      p.extend(intersection(l[i], l[j]))
  for x,y in p:
    f = sum((v-x)**2 + (w-y)**2 <= r**2 + eps for v,w,r in l)
    if f >= k:
      hi = mid
      break
  else:
    lo = mid
print(hi)
n = int(input())

t_list = list()
x_list = list()
y_list = list()

for a in range(n):
    t, x, y = map(int, input().split())
    t_list.append(t)
    x_list.append(x)
    y_list.append(y)

for a in range(1, n):
    dt = t_list[a] - t_list[a-1]
    dx = x_list[a] - x_list[a-1]
    dy = y_list[a] - y_list[a-1]

    if abs(dx) + abs(dy) <= dt:
        if (dx + dy) % 2 == dt % 2:
            ans = True
        else:
            ans = False
            break
    else:
        ans = False
        break

if ans:
    print('Yes')
else:
    print('No')


### FIXED CODE ###

n = int(input())

t_list = [0]
x_list = [0]
y_list = [0]

for a in range(n):
    t, x, y = map(int, input().split())
    t_list.append(t)
    x_list.append(x)
    y_list.append(y)

for a in range(1, n+1):
    dt = t_list[a] - t_list[a-1]
    dx = x_list[a] - x_list[a-1]
    dy = y_list[a] - y_list[a-1]

    if abs(dx) + abs(dy) <= dt:
        if (dx + dy) % 2 == dt % 2:
            ans = True
        else:
            ans = False
            break
    else:
        ans = False
        break

if ans:
    print('Yes')
else:
    print('No')
n = int(input())
a = list(map(int,input().split()))
print(*a[::-2],*a[n%2::2])

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
if n == 1:
    print(a[0])
else:
    print(*a[::-2],end = ' ')
    print(*a[n%2::2])
i=1
while True:
 s=int(input)
 if s==0:break
 print(f'Case {i}: {s}')

### FIXED CODE ###

import sys
i=1
for e in sys.stdin:
 if'0\n'==e:break
 print(f'Case {i}: {e[:-1]}');i+=1
import collections
import copy

N = int(input())
A = list(map(int, input().split()))
C = collections.Counter(A)

for a in A:
    pC = copy.deepcopy(C)

    ans = 0
    for k, v in pC.items():
        if k == a:
            ans += (v - 1) * (v - 2) // 2
        else:
            ans += v * (v - 1) // 2
    print(ans)



### FIXED CODE ###

L = int(input())

ans = L**3 / 27

print(ans)
import numpy as np
import sys

n,m = map(int,input().split())
ab = [[int(i) for i in input().split()] for i in range(m)]

an=[0]*(n-1)
wk=[0]*n
awk=np.array(wk)
aab=np.array(ab)
tg =[1]
wtg=[]

while not(all(an)):# or len(aab)<=0:
    if len(aab)<=0:
        break
    for i in tg:
        awk=aab[np.any(aab==i,axis=1)]
        for j in range(len(awk)):
            if awk[j][0]==i:
                if an[awk[j][1]-2]==0:
                    an[awk[j][1]-2]=i
                    wtg.append(awk[j][1])
            else:
                if an[awk[j][0]-2]==0:
                    an[awk[j][0]-2]=i
                    wtg.append(awk[j][0])
            aab=aab[~np.any(aab==tg,axis=1)]

    tg=list(wtg)
    wtg=[]
if all(an):
    print('Yes')
    for i in an:
        print(i)
else:
    print('No')

### FIXED CODE ###

def main():
    from collections import deque
 
    n,m =map(int,input().split())
    abl=[[] for i in range(n+1)]
    for i in range(m):
        a,b = map(int,input().split())
        abl[a].append(b)
        abl[b].append(a)
 
    an=[0]*(n+1)
    an[0]=1
    tg = deque([1])
    while len(tg):
        itg = tg.popleft()
        for j in abl[itg]:
            if an[j]==0:
                an[j]=itg
                tg.append(j)

    if all(an):
        print('Yes')
        for j in an[2:]:
            print(j)
    else:
        print('No')
 
main()