Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
s=input()
ans=0
for i range (6):
  if int(s[i])==1:
    ans+=1
print(ans)

Fixed submission:
s=input()
ans=0
for i in range (6):
  if int(s[i])==1:
    ans+=1
print(ans)

Buggy python submission (verdict: Runtime Error):
s=input()
ans=0
for i range 6:
  if int(s[i])==1:
    ans+=1
print(ans)

Fixed submission:
s=input()
ans=0
for i in range (6):
  if int(s[i])==1:
    ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
s=input()
print("Yes" if （len(s)>=4 and s[:4]=="YAKI"）else "No")

Fixed submission:
s=input()
print("Yes" if len(s)>=4 and s[:4]=="YAKI" else "No")

Buggy python submission (verdict: Runtime Error):
s=input()
print("Yes" if len(s)>=4 && s[:4]=="YAKI" else "No")

Fixed submission:
s=input()
print("Yes" if len(s)>=4 and s[:4]=="YAKI" else "No")
Buggy python submission (verdict: Runtime Error):
a = input()
b = input()
flag = True
if (a=='H' and b=='H'):
    flag = True
if (a=='H' and b=='D'): 
    flag = False
if (a=='D' and b=='H'): 
    flag = False
if (a=='D' and b=='d'): 
    flag = True
print('H' if flag else 'D')

Fixed submission:
l = input().split()
a = l[0]
b = l[1]
flag = True
if (a=='H' and b=='H'):
    flag = True
if (a=='H' and b=='D'): 
    flag = False
if (a=='D' and b=='H'): 
    flag = False
if (a=='D' and b=='d'): 
    flag = True
print('H' if flag else 'D')

Buggy python submission (verdict: Runtime Error):
a = input()
b = input()
flag = true
if (a=='H') and (b=='H')
    flag = true
if (a=='H') and (b=='D') 
    flag = false
if (a=='D') and (b=='H') 
    flag = false
if (a=='D') and (b=='d') 
    flag = true
print(flag?H:D)

Fixed submission:
l = input().split()
a = l[0]
b = l[1]
flag = True
if (a=='H' and b=='H'):
    flag = True
if (a=='H' and b=='D'): 
    flag = False
if (a=='D' and b=='H'): 
    flag = False
if (a=='D' and b=='d'): 
    flag = True
print('H' if flag else 'D')
Buggy python submission (verdict: Runtime Error):
l = input()
for i in range(0, 5)
	print(l[i], end="")
for j in range(6, 13)
	print(l[j], end="")
for k in range(14, 19)
	print(l[k], end="")

Fixed submission:
l = input()
for i in range(0, 5):
	print(l[i], end="")
print(" ", end="")
for j in range(6, 13):
	print(l[j], end="")
print(" ", end="")
for k in range(14, 19):
	print(l[k], end="")

Buggy python submission (verdict: Runtime Error):
l = input()
for i in range(0, 5) 　print(l[i], end="")
for j in range(6, 13) 　print(l[j], end="")
for k in range(14, 19) 　print(l[k], end="")

Fixed submission:
l = input()
for i in range(0, 5):
	print(l[i], end="")
print(" ", end="")
for j in range(6, 13):
	print(l[j], end="")
print(" ", end="")
for k in range(14, 19):
	print(l[k], end="")

Buggy python submission (verdict: Runtime Error):
l = input()
for i in range(0, 5) 　print(l[i], end="")
for i in range(6, 13) 　print(l[i], end="")
for i in range(14, 19) 　print(l[i], end="")

Fixed submission:
l = input()
for i in range(0, 5):
	print(l[i], end="")
print(" ", end="")
for j in range(6, 13):
	print(l[j], end="")
print(" ", end="")
for k in range(14, 19):
	print(l[k], end="")
Buggy python submission (verdict: Runtime Error):
x = input()
if x == 'a' or x == 'i' or x == 'u' or x=='e' or x=='o':
  print ('vowel')
else
  print ('consonant')

Fixed submission:
x = input()
if x == 'a' or x == 'i' or x == 'u' or x=='e' or x=='o':
  print ('vowel')
else:
  print ('consonant')

Buggy python submission (verdict: Runtime Error):
x = input()
if x == 'a' || x == 'i' || x == 'u'||x=='e'||x=='o':
  print ('vowel')
else:
  print ('consonant')

Fixed submission:
x = input()
if x == 'a' or x == 'i' or x == 'u' or x=='e' or x=='o':
  print ('vowel')
else:
  print ('consonant')

Buggy python submission (verdict: Runtime Error):
x = input()
if x == 'a' || x == 'i' || x == 'u'||x=='e'||x=='o':
  print ('vowel')
else
  print ('consonant')

Fixed submission:
x = input()
if x == 'a' or x == 'i' or x == 'u' or x=='e' or x=='o':
  print ('vowel')
else:
  print ('consonant')

Buggy python submission (verdict: Runtime Error):
x = input()
if x == 'a' || x == 'i' || x == 'u'||x=='e'||x=='o':
  print ('vowel')
else
  print ('consonant')

Fixed submission:
x = input()
if x == 'a' or x == 'i' or x == 'u' or x=='e' or x=='o':
  print ('vowel')
else:
  print ('consonant')
Buggy python submission (verdict: Runtime Error):
a,b,c =map(int,input().split())
if a == 5 && b==5 && c==7:
  print("YES")
elif a == 5 && b==7 && c==5:
  print("YES")
elif a == 7 && b==5 && c==5:
  print("YES")
else :
  print("NO")

Fixed submission:
a,b,c =map(int,input().split())
if a == 5 and b==5 and c==7:
  print("YES")
elif a == 5 and b==7 and c==5:
  print("YES")
elif a == 7 and b==5 and c==5:
  print("YES")
else :
  print("NO")
Buggy python submission (verdict: Runtime Error):
N = input()
for i in range(65, 90):
  if i==ord(N):
    A += 1
for i in range(97, 123):
  if i==ord(N):
    a += 1
if A==1:
  print('A')
if a==1:
  print('a')

Fixed submission:
N = input()
A, a = 0, 0
for i in range(65, 91):
  if i==ord(N):
    A += 1
for i in range(97, 123):
  if i==ord(N):
    a += 1
if A==1:
  print('A')
if a==1:
  print('a')
Buggy python submission (verdict: Runtime Error):
X, N = input().split()
X = int(X)
N = int(N)
p = list(map(int, input().split()))

tmp = [i for i in range(1, 101)]
for i in p:
  tmp.remove(i)
for i in range(len(tmp)):
  tmp[i] = abs(tmp[i] - X)

ans = 0
for i in p:
  if X-min(tmp)==i:
    ans = 1

if ans==0:
  print(X-min(tmp))
else:
  print(X+min(tmp))

Fixed submission:
X, N = input().split()
X = int(X)
N = int(N)
p = list(map(int, input().split()))

tmp = [i for i in range(-101, 200)]
for i in p:
  tmp.remove(i)
for i in range(len(tmp)):
  tmp[i] = abs(tmp[i] - X)

ans = 0
for i in p:
  if X-min(tmp)==i:
    ans = 1

if ans==0:
  print(X-min(tmp))
else:
  print(X+min(tmp))
Buggy python submission (verdict: Runtime Error):
N = int(input())
cnt += 0
for i in range(N):
  if i%5!=0 and i%3!=0:
    cnt += i
print(cnt)

Fixed submission:
N = int(input())
cnt = 0
for i in range(N+1):
    if i%5!=0 and i%3!=0:
        cnt += i
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
import math
K = int(input())
cnt = 0
tmp = 0
for a in range(1, K+1):
    for b in range(1, K+1):
        for c in range(1, K+1):
            tmp = math.gcd(a, b)
            cnt += math.gcd(tmp, c)

print(cnt)

Fixed submission:
import math
K = int(input())
cnt = 0
tmp = 0
for a in range(1, K+1):
    for b in range(1, a+1):
        for c in range(1, b+1):
            if a==b==c:
                tmp = math.gcd(a, b)
                cnt += math.gcd(tmp, c)
            elif a!=b!=c!=a:
                tmp = math.gcd(a, b)
                cnt += 6*math.gcd(tmp, c)
            else:
                tmp = math.gcd(a, b)
                cnt += 3*math.gcd(tmp, c)

print(cnt)
Buggy python submission (verdict: Runtime Error):
A, B, M = input().split()
A=int(A)
B=int(B)
M=int(M)
a = list(map(int, input().split()))
b = list(map(int, input().split()))
x = [list(map(int, input().split())) for i in range(M)]
 
dis = []
for i in range(M):
    m = x[i][0]-1
    n = x[i][0]-1
    dis.append(a[m] + b[n] - x[i][2])
    
a.sort()
b.sort()
 
dis.append(a[0]+b[0])
 
print(min(dis))

Fixed submission:
A, B, M = input().split()
A=int(A)
B=int(B)
M=int(M)
a = list(map(int, input().split()))
b = list(map(int, input().split()))
x = [list(map(int, input().split())) for i in range(M)]
 
dis = []
for i in range(M):
    m = x[i][0]-1
    n = x[i][1]-1
    dis.append(a[m] + b[n] - x[i][2])
    
a.sort()
b.sort()
 
dis.append(a[0]+b[0])
 
print(min(dis))

Buggy python submission (verdict: Runtime Error):
A, B, M = input().split()
A=int(A)
B=int(B)
M=int(M)
a = list(map(int, input().split()))
b = list(map(int, input().split()))
x = [list(map(int, input().split())) for i in range(M)]

dis = []
for i in range(M):
    m = x[i][0]
    n = x[i][0]
    dis.append(a[m] + b[n] - x[i][2])
    
a.sort()
b.sort()

dis.append(a[0]+b[0])

print(min(dis))

Fixed submission:
A, B, M = input().split()
A=int(A)
B=int(B)
M=int(M)
a = list(map(int, input().split()))
b = list(map(int, input().split()))
x = [list(map(int, input().split())) for i in range(M)]
 
dis = []
for i in range(M):
    m = x[i][0]-1
    n = x[i][1]-1
    dis.append(a[m] + b[n] - x[i][2])
    
a.sort()
b.sort()
 
dis.append(a[0]+b[0])
 
print(min(dis))
Buggy python submission (verdict: Time Limit Exceeded):
N, A, B = input().split()
N = int(N)
A = int(A)
B = int(B)

cnt=0
ans=0

while cnt<N:
    if cnt%(A+B)<A:
        cnt+=1
        ans+=1
    else:
        cnt+=1
        
print(ans)

Fixed submission:
N, A, B = input().split()
N = int(N)
A = int(A)
B = int(B)
ans=0

if N%(A+B)<=A:
    ans = N//(A+B) * A + N%(A+B)
else:
    ans = N//(A+B) * A + A

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N, A, B = input().split()
N = int(N)
A = int(A)
B = int(B)

S = []

while len(S)<N:
    for i in range(A):
        if len(S)<N:
            S.append('b')
    for j in range(B):
        if len(S)<N:
            S.append('r')

print(S.count('b'))

Fixed submission:
N, A, B = input().split()
N = int(N)
A = int(A)
B = int(B)
ans=0

if N%(A+B)<=A:
    ans = N//(A+B) * A + N%(A+B)
else:
    ans = N//(A+B) * A + A

print(ans)
Buggy python submission (verdict: Runtime Error):
import numpy as np

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

B = []
for i in range(N):
    for j in range(N):
        if i>j:
            B.append(np.dot(A[i], A[j]))

B.sort()
print(B[K-1])

Fixed submission:
A, B, C = input().split()

if A==B==C:
    print('No')
else:
    if A==B:
        if B!=C:
            print('Yes')
    elif A==C:
        if C!=B:
            print('Yes')
    elif B==C:
        if C!=A:
            print('Yes')
    else:
        print('No')
Buggy python submission (verdict: Runtime Error):
S, T = map(input().split())
a, b = map(input().split())
U = input()

if S==U:
    a-=1
else:
    b-=1

print("{} {}".format(a, b))

Fixed submission:
S, T = input().split()
a, b = input().split()
U = input()

a = int(a)
b = int(b)

if S==U:
  a-=1
if T==U:
  b-=1

print("{} {}".format(a, b))
Buggy python submission (verdict: Runtime Error):
H, N = input().split()
H = int(H)
N = int(N)

A = input().split()

if sum(A)>=H:
  print('Yes')
else:
  print('No')

Fixed submission:
H, N = input().split()
H = int(H)
N = int(N)
A = input().split()
A = list(map(int, A))

if sum(A)>=H:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Time Limit Exceeded):
X = int(input())
pn=[2]
for L in range(3, 2*X):
    chk=True
    for L2 in pn:
        if L%L2 == 0:chk=False
    if chk==True:pn.append(L)

for i in range(len(pn)):
    if pn[i]>X:
        print(pn[i])
        break
    elif pn[i]==X:
        print(X)
        break

Fixed submission:
X = int(input())
def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]

tmp = primes(2*X)

for i in range(len(tmp)):
    if tmp[i]>X:
        print(tmp[i])
        break
    elif tmp[i]==X:
        print(X)
        break
Buggy python submission (verdict: Runtime Error):
import math
N = int(input())
A = []
I = []
cnt=0

for i in range(50000):
  I.append(i)
  A.append(math.floor(1.08*i))

for i in range(len(A)+1):
  if A[i]==N:
    cnt+=i

if cnt!=0:
  print(cnt)
elif cnt==0:
  print(':(')

Fixed submission:
import math
N = int(input())
A = []
I = []
cnt=0

for i in range(50000):
  I.append(i)
  A.append(math.floor(1.08*i))

for i in range(len(A)):
  if A[i]==N:
    cnt+=i

if cnt!=0:
  print(cnt)
elif cnt==0:
  print(':(')
Buggy python submission (verdict: Runtime Error):
S = input()
T = input()
S = [i for i in S]
T = [i for i in T]

for i in range(3):
  if S[i]==T[i]:
    cnt+=1

print(cnt)

Fixed submission:
S = input()
T = input()
S = [i for i in S]
T = [i for i in T]
cnt=0

for i in range(3):
  if S[i]==T[i]:
    cnt+=1

print(cnt)
Buggy python submission (verdict: Runtime Error):
N, X = map(int, input().split())
L = list(map(int, input().split()))
z = 0
cnt = 0

while z<=X:
    z += L[cnt]
    cnt += 1

print(min(cnt, N+1))

Fixed submission:
N, X = map(int, input().split())
L = list(map(int, input().split()))
cnt = 1
D = 0

for i in L:
    D += i
    if D<=X:
        cnt += 1

print(min(N+1, cnt))

Buggy python submission (verdict: Runtime Error):
N, X = map(int, input().split())
L = list(map(int, input().split()))
z = 0
cnt = 0

while z<=X:
    z += L[cnt]
    cnt += 1

print(cnt)

Fixed submission:
N, X = map(int, input().split())
L = list(map(int, input().split()))
cnt = 1
D = 0

for i in L:
    D += i
    if D<=X:
        cnt += 1

print(min(N+1, cnt))
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
S = [i for i in input()]

for i in range(65, 65+26):
    if S[K]==chr(i):
        S[K]=chr(i+32)

print(''.join(S))

Fixed submission:
N, K = map(int, input().split())
S = [i for i in input()]

for i in range(65, 65+26):
    if S[K-1]==chr(i):
        S[K-1]=chr(i+32)

print(''.join(S))
Buggy python submission (verdict: Runtime Error):
S = list(map(str, input()))
cnt = 0
CNT = []
for i in range(len(S)):
    if S[i]=='A' or S[i]=='C' or S[i]=='G' or S[i]=='T':
        cnt += 1
    if S[i]!='A' and S[i]!='C' and S[i]!='G' and S[i]!='T':
        CNT.append(cnt)
        cnt = 0

print(max(CNT))

Fixed submission:
S = list(map(str, input()))
cnt = 0
CNT = []
for i in range(len(S)):
    if S[i]=='A' or S[i]=='C' or S[i]=='G' or S[i]=='T':
        cnt += 1
        if i==len(S)-1:
            CNT.append(cnt)
    if S[i]!='A' and S[i]!='C' and S[i]!='G' and S[i]!='T':
        CNT.append(cnt)
        cnt = 0

print(max(CNT))
Buggy python submission (verdict: Runtime Error):
A, B, K = map(int, input().split())
s = []
for i in range(100):
  if A%i==0 and B%i==0:
    s.append(i)
print(s[K-1])

Fixed submission:
A, B, K = map(int, input().split())
s = []
for i in range(1, 101):
    if A%i==0 and B%i==0:
        s.append(i)
print(s[len(s)-K])
Buggy python submission (verdict: Runtime Error):
N = int(input())
if N==1:
  print('Hello World')
elif N==2:
  A, B = map(int, input().split())
  print(A+B)

Fixed submission:
N = int(input())
if N==1:
    print('Hello World')
elif N==2:
    A = int(input())
    B = int(input())
    print(A+B)
Buggy python submission (verdict: Runtime Error):
A, B, C, D = map(int, input())
if A+B>C+D:
  print('Left')
elif A+B<C+D:
  print('Right')
else:
  print('Balanced')

Fixed submission:
A, B, C, D = map(int, input().split())
if A+B>C+D:
  print('Left')
elif A+B<C+D:
  print('Right')
else:
  print('Balanced')
Buggy python submission (verdict: Runtime Error):
N, A, B = map(int, input(),split())
print(min(A*N, B))

Fixed submission:
N, A, B = map(int, input().split())
print(min(A*N, B))
Buggy python submission (verdict: Runtime Error):
C11, C12, C13 = map(str, input().split())
C21, C22, C23 = map(str, input().split())
if C11+C12+C13==C23+C22+C21:
  print('YES')
else:
  print('NO')

Fixed submission:
C11, C12, C13 = map(str, input())
C21, C22, C23 = map(str, input())
if C11+C12+C13==C23+C22+C21:
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Runtime Error):
k, x = map(int, input().split(' ')

minimum = max(x - k + 1, -1000000)
maximum = min(x + k - 1, 1000000)

ran = [str(i) for i in range(minimum, maximum+1)]
print(' '.join(ran)

Fixed submission:
a, b = input().split(" ")
a = int(a)
b = int(b)

add = a + b
diff = a - b
mul = a * b

print(max(add, diff, mul))
Buggy python submission (verdict: Runtime Error):
def two_power(num: int) -> int:
    count = 0

    while num % 2 == 0:
        try:
            num = num / 2
            count += 1
        except ValueError:
            pass
    return count


n = int(input())
li = (input().split(' '))

l = []
for i in range(0, n):
    l.append(int(li[i]))

ans_list = []
for i in range(0, n):
    ans_list.append(two_power(l[i]))

print(min(ans_list))

Fixed submission:
n = input()

n0 = int(n[0])
n1 = int(n[1])
n2 = int(n[2])

s = n0 + n1 + n2
print(s)

Buggy python submission (verdict: Runtime Error):
def two_power(num: int) -> int:
    count = 0

    while num % 2 == 0:
        try:
            num = num / 2
            count += 1
        except ValueError:
            pass
    return count


n = int(input())
li = (input().split(' '))

l = []
for i in range(0, n):
    l.append(int(li[i]))

ans_list = []
for i in range(0, n):
    ans_list.append(two_power(l[i]))

print(max(ans_list))

Fixed submission:
n = input()

n0 = int(n[0])
n1 = int(n[1])
n2 = int(n[2])

s = n0 + n1 + n2
print(s)
Buggy python submission (verdict: Time Limit Exceeded):
#整数値入力 1文字の入力
def input_one_number():
    return int(input())

#整数値龍力　複数の入力
def input_multiple_number():
    return map(int, input().split())

#整数値龍力　複数の入力(配列)
def input_multiple_number_as_list():
    return list(map(int, input().split()))

n = input_one_number()
a = input_multiple_number_as_list()

ssum =0
mod = 10**9+7
import itertools as itr
for i in itr.combinations(range(len(a)),2):
	ssum += a[i[0]]*a[i[1]]
	ssum %= mod
print(ssum)

Fixed submission:
#整数値入力 1文字の入力
def input_one_number():
    return int(input())

#整数値龍力　複数の入力
def input_multiple_number():
    return map(int, input().split())

#整数値龍力　複数の入力(配列)
def input_multiple_number_as_list():
    return list(map(int, input().split()))

n = input_one_number()
a = input_multiple_number_as_list()

mod = 10**9+7
ssum = 0

sumA = sum(a)

for _a in a:
	ssum += _a * (sumA-_a)

print(ssum//2%mod)
Buggy python submission (verdict: Runtime Error):
def input_one_number():
    return int(input())


D = input_one_number()

def input_multiple_number_as_list():
    return list(map(int, input().split()))

c = input_multiple_number_as_list()
last = [-1]*26


s = [[]*26 for _ in range(D)]

def dot(day):
	k = [0]*26
	for i in range(26):
		k[i] = c[i]*(day+1-last[i])
	return k


for i in range(D):
	s[i] = input_multiple_number_as_list()

for day in range(D):
	maxSatis = max(s[day])
	damage = dot(day)
	maxDamage = max(damage)

	if(maxSatis > maxDamage):
		idx = s[day].index(maxSatis)
		print(idx+1)
		last[idx] = day
	else:
		idx = s[day].index(maxDamage)
		print(idx+1)
		last[idx] = day



Fixed submission:
def input_one_number():
    return int(input())


D = input_one_number()

def input_multiple_number_as_list():
    return list(map(int, input().split()))

c = input_multiple_number_as_list()

s = [[]*26 for _ in range(D)]

for i in range(D):
	s[i] = input_multiple_number_as_list()

for day in range(D):
	m = max(s[day])
	print(s[day].index(m)+1)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

def input_one_number():
    return int(input())

def input_multiple_number():
    return map(int, input().split())

def input_multiple_number_as_list():
    return list(map(int, input().split()))


A , V = input_multiple_number()
B, W = input_multiple_number()
T = input_one_number()

D = abs(B-A)
v = W-V

if D - v*T > 0 or :
	print("NO")
else:
	print("YES")



Fixed submission:
# -*- coding: utf-8 -*-

def input_one_number():
    return int(input())

def input_multiple_number():
    return map(int, input().split())

def input_multiple_number_as_list():
    return list(map(int, input().split()))


A , V = input_multiple_number()
B, W = input_multiple_number()
T = input_one_number()

D = abs(B-A)
v = V-W

if D - v*T > 0 :
	print("NO")
else:
	print("YES")
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

def input_one_number():
    return int(input())

def input_multiple_number():
    return map(int, input().split())

def input_multiple_number_as_list():
    return list(map(int, input().split()))

N,M = input_multiple_number()

shilve = [-1]*(N+1)
michi = [[] for _i in range(N+1)]

for i in range(M):
	a,b = input_multiple_number()
	michi[a].append(b)
	michi[b].append(a)

que = [1]

while len(que) > 0:
	now_heya = que.pop(0)
	for nexthop in michi[now_heya]:
		if shilve[nexthop] == -1:
			shilve[nexthop] = now_heya
			que.append(nexthop)


print("Yes")
for i in shilve[2:]:
	print(i)








Fixed submission:
# -*- coding: utf-8 -*-

def input_one_number():
    return int(input())

def input_multiple_number():
    return map(int, input().split())

def input_multiple_number_as_list():
    return list(map(int, input().split()))

N,M = input_multiple_number()

shilve = [-1]*(N+1)
michi = [[] for _i in range(N+1)]

for i in range(M):
	a,b = input_multiple_number()
	michi[a].append(b)
	michi[b].append(a)

que = [1]

while len(que) > 0:
	now_heya = que.pop(0)
	for nexthop in michi[now_heya]:
		if shilve[nexthop] == -1:
			shilve[nexthop] = now_heya
			que.append(nexthop)


print("Yes")
for i in shilve[2:]:
	print(i)

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

def input_one_number():
    return int(input())

def input_multiple_number():
    return map(int, input().split())

def input_multiple_number_as_list():
    return list(map(int, input().split()))



N,M = input_multiple_number()

ans = [0]*(N)
ans[0] = 1
michi = [[] for i in range(N+1)]
isVisit = [False]*N
isVisit[0] = True

for i in range(M):
	a,b = input_multiple_number()
	michi[a].append(b)
	michi[b].append(a)

def DFS(K):
	for heya in michi[K]:
		if ans[heya-1] == 0:
			ans[heya-1] = K

	for heya in michi[K]:
		if not isVisit[heya-1]:
			isVisit[heya-1] = True
			DFS(heya)

DFS(1)
print("Yes")
for i in ans[1:]:
	print(i)




Fixed submission:
# -*- coding: utf-8 -*-

def input_one_number():
    return int(input())

def input_multiple_number():
    return map(int, input().split())

def input_multiple_number_as_list():
    return list(map(int, input().split()))

N,M = input_multiple_number()

shilve = [-1]*(N+1)
michi = [[] for _i in range(N+1)]

for i in range(M):
	a,b = input_multiple_number()
	michi[a].append(b)
	michi[b].append(a)

que = [1]

while len(que) > 0:
	now_heya = que.pop(0)
	for nexthop in michi[now_heya]:
		if shilve[nexthop] == -1:
			shilve[nexthop] = now_heya
			que.append(nexthop)


print("Yes")
for i in shilve[2:]:
	print(i)
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

#整数値龍力　複数の入力
def input_multiple_number():
    return map(int, input().split())

S = input()
Q = int(input())

preffix = ""
suffix = ""
revcnt = 0
for i in range(Q):
    query = input()
    if query[0] == "1":
        wk = preffix
        preffix = suffix
        suffix = wk
        suffix = suffix[::-1]
        preffix = preffix[::-1]
        revcnt += 1
    elif query[2] == "1":
        preffix = (query[4]+preffix)
    else:
        suffix += query[4]

if revcnt%2 == 1:
    S = S[::-1]

print(preffix+S+suffix)



Fixed submission:
# -*- coding: utf-8 -*-

#整数値龍力　複数の入力
def input_multiple_number():
    return map(int, input().split())

S = input()
Q = int(input())

preffix = ""
suffix = ""
revcnt = 0
for i in range(Q):
    query = input()
    if query[0] == "1":
        wk = preffix
        preffix = suffix
        suffix = wk
        revcnt += 1
    elif query[2] == "1":
        if revcnt %2 ==0:
            preffix = (query[4]+preffix)
        else:
            preffix += query[4]
    else:
        if revcnt %2 ==1:
            suffix = (query[4]+suffix)
        else:
            suffix += query[4]

if revcnt%2 == 1:
    S = S[::-1]
    suffix = suffix[::-1]
    preffix = preffix[::-1]


print(preffix+S+suffix)