Harryxun/stf_run huggingface dataset:
import sys
if __name__ == '__main__':
    N = int(input())
    W = [int(input()) for _ in range(N)]
    for i in range(1,N):
        if W[i-1][-1] != W[i][0]:
            print('No')
            sys.exit(0)
    print('Yes')

### FIXED CODE ###

if __name__ == '__main__':
    AB = [int(n) for n in input().split()]
    if AB[0] * AB[1] % 2 == 0:
        print('No')
    else:
        print('Yes')
import sys
input = sys.stdin.readline
import bisect

N,Q=map(int,input().split())
S=input().strip()
S=[ord(s)-65 for s in S]
M=[input().split() for i in range(Q)]

MLIST=[[] for i in range(26)]

for i in range(Q):
    m,lr=M[i][0],M[i][1]
    MLIST[ord(m)-65].append(i)

dist=dict()
def distinct(PLACE,TURN):
    #print(PLACE,TURN)

    x=bisect.bisect_left(MLIST[S[PLACE]],TURN)

    if x==len(MLIST[S[PLACE]]):
        #dist[(PLACE,TURN)]=1
        return 1

    TURN=MLIST[S[PLACE]][x]

    if dist.get((PLACE,TURN))!=None:
        return dist.get((PLACE,TURN))
    
    if PLACE==0 and M[TURN][1]=="L":
        dist[(PLACE,TURN)]=0
        return 0
    
    if PLACE==N-1 and M[TURN][1]=="R":
        dist[(PLACE,TURN)]=0
        return 0

    if M[TURN][1]=="L":
        dist[(PLACE,TURN)]=distinct(PLACE-1,TURN+1)
        return dist[(PLACE,TURN)]

    if M[TURN][1]=="R":
        dist[(PLACE,TURN)]=distinct(PLACE+1,TURN+1)
        return dist[(PLACE,TURN)]

ANS=0
for i in range(N):
    ANS+=distinct(i,0)
    #print(i,dist)

print(ANS)

### FIXED CODE ###

import sys
input = sys.stdin.readline

N,Q=map(int,input().split())
S=input().strip()
M=[input().split() for i in range(Q)]

PLACE=-1

for i in range(Q-1,-1,-1):

    if PLACE+1<N and M[i][0]==S[PLACE+1] and M[i][1]=="L":
        PLACE+=1

    elif PLACE>=0 and M[i][0]==S[PLACE] and M[i][1]=="R":
        PLACE-=1

    if PLACE==N:
        print(0)
        sys.exit()

PLACE2=N

for i in range(Q-1,-1,-1):

    if PLACE2-1>=0 and M[i][0]==S[PLACE2-1] and M[i][1]=="R":
        PLACE2-=1

    elif PLACE2<=N-1 and M[i][0]==S[PLACE2] and M[i][1]=="L":
        PLACE2+=1

    if PLACE==-1:
        print(0)
        sys.exit()

print(max(0,N-(PLACE+1+(N-PLACE2))))
from sys import exit
from enum import Enum
class Direction(Enum):
    xp = 0
    xn = 1
    yp = 2
    yn = 3
def move(S, current, D, G):
    # print(D == Direction.xn)
    # print(S,D,current)
    if(S == []):return current == G
    elif(S[0] == "F"):
        if(D == Direction.xp):
            if move(S[1:],[current[0]+1,current[1]],D,G):return True
        elif(D == Direction.xn):
            if move(S[1:],[current[0]-1,current[1]],D,G):return True
        elif(D == Direction.yp):
            if move(S[1:],[current[0],current[1]+1],D,G):return True
        elif(D == Direction.yn):
            if move(S[1:],[current[0],current[1]-1],D,G):return True
        # del S[0]
    elif(S[0] == "T" and (D == Direction.xp or D == Direction.xn)):
        # del S[0]
        if move(S[1:],current,Direction.yp,G): return True
        if move(S[1:],current,Direction.yn,G): return True
    elif(S[0] == "T" and (D == Direction.yp or D == Direction.yn)):
        # del S[0]
        if move(S[1:],current,Direction.xp,G): return True
        if move(S[1:],current,Direction.xn,G): return True
    return False
current = [0,0]
D = Direction.xp
S = list(input())#["F","F","T","F"]
G = [int(n) for n in input().split()]#[4,4]

if(move(S,current,D,G)):
    print("Yes")
    exit()
else:
    print("No")


### FIXED CODE ###

from sys import exit
from collections import defaultdict
import itertools
# dic = defaultdict(int)
# N = int(input())
# a = [int(input()) for _ in range(N)]
S = str(input())
x,y = [int(n) for n in input().split()]

dx = []
dy = []
X = True
tmp = 0


S = [len(s) for s in S.split("T")]
dx = S[0::2]
dy = S[1::2]
x -= dx[0]
del dx[0]

def check(d, p):
    memo = set([0])
    for t in d:
        memo = {a+b for a,b in itertools.product(memo, [-t, t])}
    return (p in memo)


print("Yes" if check(dx,x) and check(dy,y) else "No")
A,B,C,x=[int(input()) for _ in range(4)]
a=x//500
b=x//100
c=x//50
ans=0
for s in range(1,a+1):
  for t in range(1+b+1):
    u=(x-500*s-100*t)//50
    if all(0<=s<=A and 0<=t<=B and 0<=u<=C):
      ans+=1
print(ans)


### FIXED CODE ###

A,B,C,x=[int(input()) for _ in range(4)]
a=x//500
b=x//100
c=x//50
ans=0
for s in range(0,a+1):
  for t in range(0,b+1):
    u=(x-500*s-100*t)//50
    if all([0<=s<=A,0<=t<=B,0<=u<=C]):
      ans+=1
print(ans)
n = int(input())

if n == 1:
	G = [1]
else:
	G = [g for g in [1, 4, 10, 23, 57, 132, 301, 701] if g < n]
	while True:
		g = int(2.25 * G[-1])
		if g > n:
			break
		G.append(g)
	G.reverse()

A = [int(input()) for _ in range(n)]
cnt = 0
for g in G:
	for j, v in enumerate(A[g:]):
		while j >= 0 and A[j] > v:
			A[j+g] = A[j]
			j -= g
			cnt += 1
		A[j+g] = v

print(len(G))
print(*G)
print(cnt, a*, sep='\n')


### FIXED CODE ###

import sys

n = int(input())
if n == 1:
	G = [1]
else:
	G = [g for g in [1, 4, 10, 23, 57, 132, 301, 701] if g < n]
	while True:
		g = int(2.25 * G[-1])
		if g > n:
			break
		G.append(g)
	G.reverse()

A = list(map(int, sys.stdin))
cnt = 0
for g in G:
	for j, v in enumerate(A[g:]):
		while j >= 0 and A[j] > v:
			A[j+g] = A[j]
			j -= g
			cnt += 1
		A[j+g] = v

print(len(G))
print(*G)
print(cnt)
for a in A:
	print(a)
def check(iter, broken):
    iter_ans=0
    for j in iter:
        tmp_sum=0
        tmp_broken=set()
        for t in range(j, n, j+1):
            if t not in broken:
                tmp_sum+=aa[t]
                tmp_broken.add(t)
        # print(ans, j, tmp_broken, broken)
        if tmp_sum < 0:
            iter_ans -= tmp_sum
            broken.update(tmp_broken)
    return iter_ans


n=int(input())
aa=list(map(int,input().split()))
ans=sum(aa)
i=n//2
broken=set()
for j in range(i,n):
    if aa[j] < 0:
        ans -= aa[j]
        broken.add(j)
ccc=0
import random
for _ in range(100):
    c=check(random.shuffle(aa[i]), broken.copy())
    ccc=max(ccc,c)
print(ans+ccc)

### FIXED CODE ###

from collections import deque


class Dinic:
    def __init__(self, n):
        self.n = n
        self.links = [[] for _ in range(n)]
        self.depth = None
        self.progress = None

    def add_link(self, _from, to, cap):
        self.links[_from].append([cap, to, len(self.links[to])])
        self.links[to].append([0, _from, len(self.links[_from]) - 1])

    def bfs(self, s):
        depth = [-1] * self.n
        depth[s] = 0
        q = deque([s])
        while q:
            v = q.popleft()
            for cap, to, rev in self.links[v]:
                if cap > 0 and depth[to] < 0:
                    depth[to] = depth[v] + 1
                    q.append(to)
        self.depth = depth

    def dfs(self, v, t, flow):
        if v == t:
            return flow
        for i, link in enumerate(self.links[v]):
            if i < self.progress[v]:
                continue
            self.progress[v] = i
            cap, to, rev = link
            if cap == 0 or self.depth[v] >= self.depth[to]:
                continue
            d = self.dfs(to, t, min(flow, cap))
            if d == 0:
                continue
            link[0] -= d
            self.links[to][rev][0] += d
            return d
        return 0

    def max_flow(self, s, t):
        flow = 0
        while True:
            self.bfs(s)
            if self.depth[t] < 0:
                return flow
            self.progress = [0] * self.n
            current_flow = self.dfs(s, t, float('inf'))
            while current_flow > 0:
                flow += current_flow
                current_flow = self.dfs(s, t, float('inf'))


n = int(input())
an = list(map(int, input().split()))
mf = Dinic(n + 2)
max_value = 0
for i, a in enumerate(an):
    i += 1
    if a > 0:
        max_value += a
        mf.add_link(i, n + 1, a)
    else:
        mf.add_link(0, i, -a)
    for j in range(2 * i, n + 1, i):
        mf.add_link(i, j, float('inf'))
print(max_value - mf.max_flow(0, n + 1))
10 3
3 6
5 7
6 9

### FIXED CODE ###

#C
n, m = map(int, input().split())
l = []
r = []
for i in range(m):
    lin = list(map(int, input().split()))
    l.append(lin[0])
    r.append(lin[1])
lma = max(l)
rmi = min(r)
if lma > rmi:
    print(0)
else:
    print(rmi - lma + 1)
A, B, K = map(int, input().split())

l = B - A + 1

nums = list(range(A, B + 1))
ans = set(nums[:min(K, l + 1)]) | set(nums[-min(K, l):])
ans = list(ans)
ans.sort()
for i in ans:
    print(i)


### FIXED CODE ###

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

ans = set()
for i in range(A, min(B + 1, A + K)):
    ans.add(i)

for i in range(max(A, B - K + 1), B + 1):
    ans.add(i)
ans = sorted(list(ans))
for i in ans:
    print(i)
import math
 
 
def c_cnt(n, r):
    return math.factorial(n) // (math.factorial(n - r) * (math.factorial(r)))
 
 
N, K = map(int, input().split())
red = N - K
div = 1
for i in range(1,K+1):
    place = c_cnt(red+1, i)
    if 1 < i < K:
        div = c_cnt(K-1, i-1)
    else:
        div = 1
    print((place * div) % (10**9+7))

### FIXED CODE ###

import math


def c_cnt(n, r):
    if n - r < 0:
        return 0
    return math.factorial(n) // (math.factorial(n - r) * (math.factorial(r)))


N, K = map(int, input().split())
red = N - K
div = 1
for i in range(1,K+1):
    place = c_cnt(red+1, i)
    if 1 < i < K:
        div = c_cnt(K-1, i-1)
    else:
        div = 1
    print(place * div % (10**9+7))
n,m = map(int, input().split())
a=[]
for i in range(n):
    a.append(tuple(map(int, input().split())))

memo = {}
def f(a, s, fn):
    global m
    l = len(a)
    if s >= m or l == 0:
        return 0
    if (l,s) in memo:
        return memo[(l,s)]
    elif len(a) == 1:
        ans = max(0, fn(a[0]))
    else:
        ans = max(f(a[1:], s, fn), fn(a[0]) + f(a[1:], s+1, fn))
    memo[(l,s)] = ans
    return ans

ans = []
ans.append(f(a,0, lambda x: x[0]+x[1]+x[2]))
memo.clear()
ans.append(f(a,0, lambda x: x[0]+x[1]-x[2]))
memo.clear()
ans.append(f(a,0, lambda x: x[0]-x[1]+x[2]))
memo.clear()
ans.append(f(a,0, lambda x: x[0]-x[1]-x[2]))
memo.clear()
ans.append(f(a,0, lambda x: -x[0]+x[1]+x[2]))
memo.clear()
ans.append(f(a,0, lambda x: -x[0]+x[1]-x[2]))
memo.clear()
ans.append(f(a,0, lambda x: -x[0]-x[1]+x[2]))
memo.clear()
ans.append(f(a,0, lambda x: -x[0]-x[1]-x[2]))
print(max(ans))


### FIXED CODE ###

n,m = map(int, input().split())
a=[]
for i in range(n):
    a.append(tuple(map(int, input().split())))

dp = []
for i in range(m+1):
    dp.append([0 for j in range(n+1)])

def f(fn):
    global dp, a
    for i in range(1,m+1):
        for j in range(i,n+1):
            if j == i:
                dp[i][j] = sum(map(fn, a[:j]))
            else:
                dp[i][j] = max(dp[i][j-1], dp[i-1][j-1] + fn(a[j-1]))

ans = []
f(lambda x: x[0]+x[1]+x[2])
ans.append(dp[m][n])
f(lambda x: x[0]+x[1]-x[2])
ans.append(dp[m][n])
f(lambda x: x[0]-x[1]+x[2])
ans.append(dp[m][n])
f(lambda x: x[0]-x[1]-x[2])
ans.append(dp[m][n])
f(lambda x: -x[0]+x[1]+x[2])
ans.append(dp[m][n])
f(lambda x: -x[0]+x[1]-x[2])
ans.append(dp[m][n])
f(lambda x: -x[0]-x[1]+x[2])
ans.append(dp[m][n])
f(lambda x: -x[0]-x[1]-x[2])
ans.append(dp[m][n])

print(max(ans))
S = input()
S1 = ''
S2 = ''
if i in range(len(S)):
    if i % 2 ==0 :
        S1 += '0'
        S2 += '1'
    else :
        S1 += '1'
        S2 += '0'
min1 = 0
for i in range(len(S)):
    if S[i] != S1[i]:
        min1 += 1
min2 = 0
for i in range(len(S)):
    if S[i] != S1[i]:
        min2 += 1 
print(min(min1,min2))


### FIXED CODE ###

A,B = map(int,input().split())
if A > B :
    print( 2*A - 1 )
elif A == B :
    print( A + B )
else :
    print( 2*B - 1 )
n,m=map(int,input().split())
a=[]
b=[]
C=[]
s=[0 for i in range(n)]
s[0] = "Yes"
 
for i in range(m):
  c,d=map(int,input().split())
  a.append(c)
  b.append(d)
 
def Next(be):
  C.clear()
  for j in be:
    for i in range(len(a)):
      if a[i] == j:
        if s[b[i]-1]==0 and 0 == be.count(b[i]):
          C.append(b[i])
          s[b[i]-1]=j
        continue

      if b[i] == j: 
        if s[a[i]-1]==0 and 0 == be.count(a[i]):
          C.append(a[i])
          s[a[i]-1]=j
        continue
    Dele(j)
  return C

def Dele(be):
  for j in range(a.count(be)):
    a.remove(be)
  for j in range(b.count(be)):
    b.remove(be)

co=[1]
for i in range(5):
  if s.count(0) == 0:
    break
  co = Next(list(co))
 
for i in s:
  print(i)

### FIXED CODE ###

from collections import deque

N, M=map(int,input().split())
a=[]
b=[]
for i in range(M):
  A,B=map(int,input().split())
  a.append(A)
  b.append(B)

graph = [[] for _ in range(N + 1)]
for i in range(M):
  graph[a[i]].append(b[i])
  graph[b[i]].append(a[i])

    # bfs
queue = deque([1])
signposts = [0] * (N + 1)
signposts[1] = 1
while queue:#キューが空になるまで
  u = queue.popleft()
  for v in graph[u]:
    if not signposts[v]:
      signposts[v] = u
      queue.append(v)
 
if all(signposts[2:]):
  print("Yes")
  print("\n".join(map(str, signposts[2:])))
else:
  print("No")
Tmp = []
Tmp = input().rstrip().split(' ')

M = int(Tmp[0])
N = int(Tmp[1])

if M=<N:
    print(N)
else:
    print(N-1)


### FIXED CODE ###

Tmp = []
Tmp = input().rstrip().split(' ')
 
M = int(Tmp[0])
N = int(Tmp[1])
 
if M<=N:
    print(M)
else:
    print(M-1)
N,K = map(int, input().split())
l = [int(i) for i in input().split()]
l.sort(reverse = True)
toral = 0
for i in range(K):
  total += l[i]
print(total)


### FIXED CODE ###

N,K = map(int, input().split())
l = list(map(int,input().split()))
l.sort()
lrev = l[::-1]
print(sum(lrev[:K]))
n = int(input())
a = list(map(int,input().split()))

li = []

for i in range(n):
    memo = a[i]-(i+1)
    li.append(memo)

li.sort()

memo = len(li)
memo2 = li[memo//2]

li2 = [memo2 for i in range(len(li))]
li = li - li2

ttl = 0
for i in range(n):
    ttl += abs(li[i])

print(ttl)


### FIXED CODE ###

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

li = []

for i in range(n):
    memo = a[i]-(i+1)
    li.append(memo)

li.sort()
#print(li)
memo = len(li)
memo2 = li[memo//2]

li2 = [-(memo2) for i in range(len(li))]
for i in range(n):
    li[i] = li[i] + li2[i]
#print(li)
ttl = 0
for i in range(n):
    ttl += abs(li[i])

print(ttl)
for i in range(0, 3000):
    array = map(int, input().split(' '))
    print(array)
    if array[0] == 0 and array[1] == 0:
        break
    else:
        print(' '.join(map(str, sorted(array))))


### FIXED CODE ###

for i in range(0, 3000):
    array = [int(x) for x in input().split(' ')]
    if array[0] == 0 and array[1] == 0:
        break
    else:
        print(' '.join([str(x) for x in sorted(array)]))
n = int(input())
a = list(map(int, input().split()))

flag = [False]*8
t = 0
for i in a:
  if i < 400: flag[0] = True
  elif i < 800: flag[1] = True
  elif i < 1200: flag[2] = True
  elif i < 1600: flag[3] = True
  elif i < 2000: flag[4] = True
  elif i < 2400: flag[5] = True
  elif i < 2800: flag[6] = True
  elif i < 3200: flag[7] = True
  elif 3200 <= i: t += 1
    
minNum = flag.count(True)
maxNum = 0
if minNum < 8:
  maxNum = min(8, minNum + t)
else: maxNum = minNUm

print(minNum,maxNum)

### FIXED CODE ###

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

flag = [False]*8
t = 0
for i in a:
  if i < 400: flag[0] = True
  elif i < 800: flag[1] = True
  elif i < 1200: flag[2] = True
  elif i < 1600: flag[3] = True
  elif i < 2000: flag[4] = True
  elif i < 2400: flag[5] = True
  elif i < 2800: flag[6] = True
  elif i < 3200: flag[7] = True
  elif 3200 <= i: t += 1
    
minNum = 0
p = flag.count(True)
if p > 0: minNum = p
elif p == 0 and t > 0:
  minNum = 1
  
maxNum = p + t

print(minNum,maxNum)
def dfs(v,d,dist,edge):
    dist[v] = d
    for ve in edge[v]:
        if dist[ve] is None:
            dist = dfs(ve, d+1, dist, edge)
    return dist

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

    
f_dist = dfs(0,0,[None]*n,edge)
s_dist = dfs(n-1,0,[None]*n,edge)

fget = sum(1 for f,s in zip(f_dist,s_dist) if f<=s)
print("Fennec" if fget*2>n else "Snuke")

### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000)

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

def dfs(v,d,dist):
    dist[v] = d
    for ve in edge[v]:
        if dist[ve] is None:
            dist = dfs(ve, d+1, dist)
    return dist
    
    
f_dist = dfs(0,0,[None]*n)
s_dist = dfs(n-1,0,[None]*n)

fget = sum(1 for f,s in zip(f_dist,s_dist) if f<=s)
print("Fennec" if fget*2>n else "Snuke")
n,k = list(map(int,input().split()))
num=1
for i in range(n):
    if  num>k:
        num+=k
    else:
        num*=2
print(num)

### FIXED CODE ###

n = int(input())
k = int(input())
num=1
for i in range(n):
    if  num>k:
        num+=k
    else:
        num*=2
print(num)
from collections import Counter
N = int(input())
A = tuple(map(int, input().split()))
A_count = Counter(A)
ans = 0
for i, j in A_count:
    ans += j * (j - 1) // 2
for k in range(1, N+1):
    n = A_count[A[k-1]]
    ans_ = ans - (n - 1)
    print(ans_)


### FIXED CODE ###

from collections import Counter
N = int(input())
A = tuple(map(int, input().split()))
A_count = Counter(A)
ans = 0
for i, j in A_count.items():
    ans += j * (j - 1) // 2
for k in range(1, N+1):
    n = A_count[A[k-1]]
    ans_ = ans - (n - 1)
    print(ans_)
i = [int(input()) for i in range(5)]
temp = 0
if i[4] - i[3] > i[5]:
  temp += 1
if i[3] - i[2] > i[5]:
  temp += 1
if i[2] - i[1] > i[5]:
  temp += 1  
if i[1] - i[0] > i[5]:
  temp += 1  
if temp == 0:
  print('Yay!')
else:
  print(':(')


### FIXED CODE ###

i = [int(input()) for i in range(6)]
temp = 0
if i[4] - i[3] > i[5]:
  temp += 1
if i[4] - i[2] > i[5]:
  temp += 1
if i[4] - i[1] > i[5]:
  temp += 1
if i[4] - i[0] > i[5]:
  temp += 1
if i[3] - i[2] > i[5]:
  temp += 1
if i[3] - i[1] > i[5]:
  temp += 1
if i[3] - i[0] > i[5]:
  temp += 1
if i[2] - i[1] > i[5]:
  temp += 1
if i[2] - i[0] > i[5]:
  temp += 1  
if i[1] - i[0] > i[5]:
  temp += 1  
if temp != 0:
  print(':(')
else:
  print('Yay!')
n,x,m=map(int,input().split())
# 一定回数を経ると循環するので最後にかければよい
loop=list()
app = [0]*m
last = -1
a_i = x
while 1:
  a_i = (a_i**2)%m
  if a_i in (0,1) or app[a_i]:
    # あまりが0か1になったらそのあとはずっと一緒
    # もしくはloopの端にきたらloop開始
    last = a_i
    break
  else:
    app[a_i] = len(loop)
    loop.append(a_i)
    if len(loop) > n:
      break
# 答の計算
ans=x
if last < 1:
  ans += sum(loop) + last * (n - len(loop) - 1)
else:
  # ループの端までは普通に足す
  ans += sum(loop[:app[last]])
  #print(ans)
  # ループの中を累計で足す
  ans += sum(loop[app[last]:]) * ((n-1) // (len(loop)-app[last]))
  #print(ans)
  # 余りを足す
  ans += sum(loop[app[last]:((n-1) % (len(loop)-app[last]))])
print(ans)
#print(*loop)

### FIXED CODE ###

n,x,m=map(int,input().split())
# 一定回数を経ると循環するので最後にかければよい
a_i = x
log = [x]
app=[-1]*m
app[x]=0
last = x
for i in range(1,n):
  a_i = (a_i**2)%m
  if app[a_i] > -1:
    last = a_i
    break
  app[a_i] = i
  log.append(a_i)

# ループの手前(or最後)まで足し合わせる
ans = sum(log[:min(n, app[last])])
if n > app[last]:
  # ループ中合計
  ans += sum(log[app[last]:]) * ((n-app[last]) // (len(log) - app[last]))
  # 末端合計
  ans += sum(log[app[last]:app[last] + (n-app[last]) % (len(log) - app[last])])
print(ans)
n = int(input())
x = map(int, input().split())
x2 = sorted(x)
ans1, ans2 = x2[n//2-1], x2[n//2]
for i in range(n):
    if x[i] <= ans1:
        print(ans2)
    else:
        print(ans1)

### FIXED CODE ###

n = int(input())
x = [int(x) for x in input().split()]
x2 = sorted(x)
ans1, ans2 = x2[n//2-1], x2[n//2]
for i in range(n):
    if x[i] <= ans1:
        print(ans2)
    else:
        print(ans1)
a=input() 
line=a.split()
x=int(line[0])
y=int(line[1])
z1=x*y
z2=x*2+y*2
z3=str(z1)
z4=str(z2)
print(z1,z2)


### FIXED CODE ###

a=input() 
line=a.split()
x=int(line[0])
y=int(line[1])
z1=x*y
z2=x*2+y*2
z3=str(z1)
z4=str(z2)
print(z3,z4)
a = int(input())
b = 1

for i in range(a)
    b = b * a

print(b)

### FIXED CODE ###

a = int(input())
b = 0
 
for i in range(a + 1) :
    b = b + i
 
print(b)
N = int(input())
a_lis = list(input().split())

# 10^18を超えたら駄目

ans=1
rough_power=0
for i in a_lis:
    rough_power+=len(i)-1

if rough_power>18:
    print("-1")
elif 0 in a_lis:
    print(0)
else:
    for j in a_lis:
        ans=ans*int(j)

    if ans>pow(10,18):
        print("-1")
    else:
        print(ans)

### FIXED CODE ###

x,y = map(int, input().split())
ans = x*y
print(ans)
"""
author : halo2halo
date : 29, Jan, 2020
"""

import sys

# import itertools
# import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

s, t = readline().decode('utf8').split()
s.sort()
t.sort()
print('Yes' if s < t[::-1] else 'No')


### FIXED CODE ###

"""
author : halo2halo
date : 25,Oct,2019
"""

import sys
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 7)

a = readline().rstrip()
b = readline().rstrip()

print("Yes" if ''.join(sorted(a)) < ''.join(sorted(b)[::-1]) else "No")
if __name__ == '__main__':
    store = list()
    for i in range(int(input())):
        parts = input().split()
        cmd = parts[0]
        if cmd == 'insert':
            store.insert(0, int(parts[1]))
        elif cmd == 'delete':
            num = int(parts[1])
            store.remove(num)
        elif cmd == 'deleteFirst':
            store.remove(store[0])
        elif cmd =='deleteLast':
            store = store[:-1]
    print(' '.join(map(str, store)))


### FIXED CODE ###

class Node(object):
    def __init__(self, value, next=None, prev=None):
        self.value = value
        self.next = next
        self.prev = prev

class LinkedList(object):

    def __init__(self):
        self.dummy = Node(None)
        self.dummy.next = self.dummy
        self.dummy.prev = self.dummy

    def insert(self, x):
        node = Node(x, self.dummy.next, self.dummy)

        self.dummy.next.prev = node
        self.dummy.next = node
    
    def delete(self, x):
        node = self.dummy.next
        while node != self.dummy:
            if node.value == x:
                self.__remove_node(node)
                break
            else:
                node = node.next
    
    def deleteFirst(self):
        self.__remove_node(self.dummy.next)

    def deleteLast(self):
        self.__remove_node(self.dummy.prev)

    def __remove_node(self, node):
        if node != self.dummy:
            node.prev.next = node.next
            node.next.prev = node.prev

    def items(self):
        ret = []
        node = self.dummy.next
        while node != self.dummy:
            ret.append(node.value)
            node = node.next
        return ret

def main():
    from sys import stdin
    store = LinkedList()
    for i in range(int(input())):
        parts = stdin.readline().strip().split()
        cmd = parts[0]
        if cmd == 'insert':
            store.insert(parts[1])
        elif cmd == 'delete':
            store.delete(parts[1])
        elif cmd == 'deleteFirst':
            store.deleteFirst()
        elif cmd =='deleteLast':
            store.deleteLast()

    print(' '.join(store.items()))

if __name__ == '__main__':
    main()
import queue
import sys
imput = sys.stdin.readline

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

conne = [[0]*(n+1) for _ in range(m+1)]
dist = [99999]*(n+1)
par = [0] * (n+1)

for i in range(m):
    a,b = map(int,input().split()) 
    conne[a][b] = 1
    conne[b][a] = 1
    
q=queue.Queue()
dist[1] = 0
q.put((1,0))

while not q.empty():
    
    x,d = q.get()
    
    for i in range(len(conne[x])):
        if conne[x][i]==1 and dist[i]>d+1:
            q.put((i,d+1))
            par[i] = x
            dist[i] = d+1

if max(dist[1:]) == 99999:
    print("No")
    
else:
    print("Yes")    
    
    for i in par[2:]:
        print(i)
    


### FIXED CODE ###

import queue
import sys
imput = sys.stdin.readline

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

conne = [[] for _ in range(n)]
dist = [99999]*(n)
par = [0] * (n)

for i in range(m):
    a,b = map(int,input().split()) 
    conne[a-1].append(b-1)
    conne[b-1].append(a-1)
    
q=queue.Queue()
dist[0] = 0
q.put((0,0))

while not q.empty():
    
    x,d = q.get()
    
    for i in conne[x]:
        if dist[i]==99999:
            q.put((i,d+1))
            par[i] = x
            dist[i] = d+1

print("Yes")    

for i in par[1:]:
    print(i+1)