Harryxun/stf_run huggingface dataset:
n, m = map(int, input().split())

jouken_1 = []
jouken_2 = []
jouken_3 = []

for _ in range(m):
    array = tuple(map(int, input().split()))
    if array[0] == 1:
        jouken_1.append(array)
    elif array[0] == 2:
        jouken_2.append(array)
    else:
        jouken_3.append(array)

a = set(jouken_1)
b = set(jouken_2)
c = set(jouken_3)
a = list(a)
b = list(b)
c = list(c)

if len(a) > 1:
    print(-1)
    exit()
elif len(b) > 1:
    print(-1)
    exit()
elif len(c) > 1:
    print(-1)
    exit()

if n == 1:
    if len(b) > 0 or len(c) > 0:
        print(-1)
        exit()
    else:
        print(a[1])
elif n == 2:
    if len(c) > 0:
        print(-1)
        exit()
    elif a[0][1] == 0:
        print(-1)
        exit()
    elif len(b) == 0 and len(a) == 1:
        num = a[0][1] * 10
        print(num)
    else:
        num = b[0][1]+ a[0][1] * 10
        print(num)
elif n == 3:
    if len(a) == 1:
        if a[0][1] == 0:
            print(-1)
            exit()
        if len(b) == 1:
            if len(c) == 1:
                num = a[0][1] * 100 + b[0][1] * 10 + c[0][1]
            else:
                num = a[0][1] * 100 + b[0][1] * 10
        else:
            if len(c) == 1:
                num = a[0][1] * 100 + c[0][1]
            else:
                num = a[0][1] * 100

    print(num)

### FIXED CODE ###

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

jouken_1 = []
jouken_2 = []
jouken_3 = []

if m == 0:
    if n == 1:
        print(0)
        exit()
    elif n == 2:
        print(10)
        exit()
    else:
        print(100)
        exit()

for _ in range(m):
    array = tuple(map(int, input().split()))
    if array[0] == 1:
        jouken_1.append(array)
    elif array[0] == 2:
        jouken_2.append(array)
    elif array[0] == 3:
        jouken_3.append(array)

a = set(jouken_1)
b = set(jouken_2)
c = set(jouken_3)
a = list(a)
b = list(b)
c = list(c)
flag = False

if len(a) > 1:
    print(-1)
    exit()
elif len(a) == 1:
    a = a[0][1]
else:
    flag = True
    a = 0

if len(b) > 1:
    print(-1)
    exit()
elif len(b) == 1:
    b = b[0][1]
else:
    b = 0

if len(c) > 1:
    print(-1)
    exit()
elif len(c) == 1:
    c = c[0][1]
else:
    c = 0

if n == 1:
    if b > 0 or c > 0:
        print(-1)
        exit()
    for i in range(10):
        if i == a:
            print(a)
            exit()
    print(-1)
elif n == 2:
    if c > 0:
        print(-1)
        exit()
    if a == 0 and flag is True:
        a = 1
    for i in range(10, 100):
        if str(i)[0] == str(a) and str(i)[1] == str(b):
            print(i)
            exit()
    print(-1)
elif n == 3:
    if a == 0 and flag is True:
        a = 1
    for i in range(100, 1000):
        if str(i)[0] == str(a) and str(i)[1] == str(b) and str(i)[2] == str(c):
            print(i)
            exit()
    print(-1)
N, M = map(int, input().split())
dp = [1]*(N+1)
for _ in range(M):
    a, = map(int, input().split())
    dp[a] = 0
    A.append(a)
for i in range(2,N+1):
    if dp[i] != 0:
        dp[i] = dp[i-1] + dp[i-2]
print(dp[N])


### FIXED CODE ###

N, M = map(int, input().split())
mod=10**9+7
dp = [1]*(N+1)
for _ in range(M):
    a, = map(int, input().split())
    dp[a] = 0
for i in range(2,N+1):
    if dp[i] != 0:
        dp[i] = (dp[i-1] + dp[i-2])%mod
print(dp[N])
N,K=map(int,input().split())
hoge={}
for j in range(K):
    input()
    [hoge.update({int(j):1}) for j in input().split()]
print(sum([not j in hoge for j in range(N)]))


### FIXED CODE ###

print("ARC" if input()=="ABC" else "ABC")
N = int(input())
A = list(map(int,input().split()))

n = len(bin(N))-2
D = [0]*n

for i in range(N):
    s = list(bin(A[i])[2:])[::-1]
    for j in range(len(s)):
        D[j] += int(s[j])
ans = 0
for i in range(n):
    ans += D[i]*(N-D[i])*2**i
    ans %= 10**9+7
print(ans)


### FIXED CODE ###

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

n = 62
D = [0]*n

for i in range(N):
    s = list(bin(A[i])[2:])[::-1]
    s = [i for i in range(len(s)) if s[i]=='1']
    for j in s:
        D[j] += 1
ans = 0
for i in range(n):
    ans += D[i]*(N-D[i])*2**i
    ans %= 10**9+7
print(ans)
def resolve(N):
    '''
    code here
    '''
    # N = int(input())
    res = 0

    def div2(num):
        if num == 1:
            return 0
        else:
            cnt = 0
            while True:
                if num % 2 == 0:
                    num //= 2
                    cnt += 1
                else:
                    return cnt


    res_max_cnt = 0
    res = 1
    for i in range(N):
        tepm_cnt = div2(i+1)
        if res_max_cnt < tepm_cnt:
            res_max_cnt = tepm_cnt
            res = i+1
    print(res)

if __name__ == "__main__":
    resolve()


### FIXED CODE ###

def resolve():
    '''
    code here
    '''
    N = int(input())
    res = 0

    def div2(num):
        if num == 1:
            return 1
        else:
            cnt = 0
            while True:
                if num % 2 == 0:
                    num //= 2
                    cnt += 1
                else:
                    return cnt


    res_max_cnt = 0
    for i in range(N):
        tepm_cnt = div2(i+1)
        if res_max_cnt <= tepm_cnt:
            res_max_cnt = tepm_cnt
            res = i+1
    print(res)

if __name__ == "__main__":
    resolve()
K = int(input())
S = input()
if len(S) <= K:
  print(S)
else:
  print(S[:K]+"...")

### FIXED CODE ###

n = int(input())
ones = n % 10
if ones in [2,4,5,7,9]:
  print('hon')
elif ones in [0,1,6,8]:
  print('pon')
else:
  print('bon')
print((input()+input())*input()//2)

### FIXED CODE ###

x = lambda:int(input())
print((x()+x())*x()//2)
S = input()

num = 0

for i in range(len(S)):
  if not(S[i] == S[-(1+i)]):
    S[i] = S[-1+i]
    num +=1
    
print(num)
  

### FIXED CODE ###

S = input()

num = 0

for i in range(len(S)):
  if not(S[i] == S[-(1+i)]):
    
    num +=1
    
print(int(num/2))
N = int(input())
A = [0]*N
r = 0
for i in range(N):
    a = int(input())
    A[i] = (a, i)
A.sort()
cnt = 0
for i in range(N, 2):
    a, j = A[i]
    cnt += j & 1
print(cnt)





### FIXED CODE ###

def main():
    import sys
    input = sys.stdin.readline
    N = int(input())
    A = [0]*N
    r = 0
    for i in range(N):
        a = int(input())
        A[i] = (a, i)
    A.sort()
    cnt = 0
    for i in range(0, N, 2):
        a, j = A[i]
        cnt += j & 1
    print(cnt)

main()
from fractions import gcd

N, M = list(map(int, input().split()))
S = input()
T = input()

L = (N * M) // gcd(N, M)

L1 = [1]
L2 = [1]
for i in range(1, N):
    t = i * (L // N) + 1
    L1.append(t)

for i in range(1, M):
    t = i * (L // M) + 1
    L2.append(t)


# TMP
x = min(10**5, L)
LS = [None] * x
for i, li in enumerate(L1):
    ind = li-1
    LS[ind] = S[i]

ans = True
for i, li in enumerate(L2):
    ind = li-1
    if LS[ind] is not None:
        if LS[ind] != T[i]:
            ans = False

if ans:
    print(L)
else:
    print(-1)


# print(L1)
# print(L2)
# print(LS)

### FIXED CODE ###

from fractions import gcd

N, M = list(map(int, input().split()))
S = input()
T = input()

L = (N * M) // gcd(N, M)

L1 = [0]
L2 = [0]

from collections import Counter
c = Counter()

for i in range(1, N):
    t = i * (L // N) + 1
    L1.append(t-1)

for i in range(1, M):
    t = i * (L // M) + 1
    L2.append(t-1)


d = {}
for i, li in enumerate(L1):
    d[li] = S[i]

# print(d)

ans = True

for i, li in enumerate(L2):
    if not d.get(li):
        continue
    if d[li] != T[i]:
        ans = False

# print(L1)
# print(L2)
# print(common)
# print(dic)

if ans:
    print(L)
else:
    print(-1)
#!/usr/bin/env python3

from collections import deque
import sys

INF = 10 ** 12


H, W = map(int, input().split())
s_i, s_j = map(lambda x: int(x) - 1, input().split())
t_i, t_j = map(lambda x: int(x) - 1, input().split())
field = [list(input()) for _ in range(H)]

# 1. bfs でワープなしで到達できるマスを探索
# 2. 1 で見つかったマスから一回ワープして到達できるマスを探索
# 3. 1, 2 を繰り返す


def bfs(que, warp_times):
    while que:
        i, j, times = que.popleft()
        # ワープ無しで到達できるマスの探索
        for di, dj in walk:
            i_adj, j_adj = i + di, j + dj
            if 0 <= i_adj < H and i <= j_adj < W and field[i_adj][j_adj] == '.':
                if warp_times[i_adj][j_adj] > times:
                    warp_times[i_adj][j_adj] = times
                    que.appendleft((i_adj, j_adj, times))

        # ワープ有りで到達できるマスの探索
        for di, dj in warp:
            i_adj, j_adj = i + di, j + dj
            if 0 <= i_adj < H and i <= j_adj < W and field[i_adj][j_adj] == '.':
                if warp_times[i_adj][j_adj] > times + 1:
                    warp_times[i_adj][j_adj] = times + 1
                    # ワープ無しで到達できるマスを探索しきった後に探索するため、単に append
                    que.append((i_adj, j_adj, times + 1))


walk = [(1, 0), (0, 1), (-1, 0), (0, -1)]
warp = [(i, j) for i in range(-2, 3) for j in range(-2, 3) if (i, j) not in [(0, 0)] + walk]

warp_times = [[INF for j in range(W)] for i in range(H)]
que = deque()

warp_times[start_i][start_j] = 0
que.append((start_i, start_j, 0))

bfs(que, warp_times)

ans = warp_times[goal_i][goal_j] if warp_times[goal_i][goal_j] < INF else '-1'
print(ans)


### FIXED CODE ###

#!/usr/bin/env python3

from collections import deque

INF = 10 ** 12


H, W = map(int, input().split())
s_i, s_j = map(lambda x: int(x) - 1, input().split())
t_i, t_j = map(lambda x: int(x) - 1, input().split())
field = [input() for _ in range(H)]

# 1. bfs でワープなしで到達できるマスを探索
# 2. 1 で見つかったマスから一回ワープして到達できるマスを探索
# 3. 1, 2 を繰り返す


walk = [(1, 0), (0, 1), (-1, 0), (0, -1)]
warp = [(i, j) for i in range(-2, 3) for j in range(-2, 3) if (i, j) not in [(0, 0)] + walk]

warp_times = [[INF for j in range(W)] for i in range(H)]
que = deque()

warp_times[s_i][s_j] = 0
que.append((s_i, s_j, 0))

while que:
    i, j, times = que.popleft()
    # ワープ無しで到達できるマスの探索
    for di, dj in walk:
        i_adj, j_adj = i + di, j + dj
        if 0 <= i_adj < H and 0 <= j_adj < W and field[i_adj][j_adj] == '.':
            if warp_times[i_adj][j_adj] > times:
                warp_times[i_adj][j_adj] = times
                que.appendleft((i_adj, j_adj, times))

    # ワープ有りで到達できるマスの探索
    for di, dj in warp:
        i_adj, j_adj = i + di, j + dj
        if 0 <= i_adj < H and 0 <= j_adj < W and field[i_adj][j_adj] == '.':
            if warp_times[i_adj][j_adj] > times + 1:
                warp_times[i_adj][j_adj] = times + 1
                # ワープ無しで到達できるマスを探索しきった後に探索するため、単に append
                que.append((i_adj, j_adj, times + 1))

ans = warp_times[t_i][t_j] if warp_times[t_i][t_j] < INF else '-1'
print(ans)
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
  int n, k;
  cin >> n >> k;

  vector<int> h(n);
  for (int i = 0; i < n; i++) {
    cin >> h[i];
  }
  sort(h.begin(), h.end(), greater<int>());

  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (i < k) {
      ans++;
    } else {
      ans += h[i];
    }
  }
  cout << ans << endl;
  return 0;
}

### FIXED CODE ###

#!/usr/bin/env python3

n, k = map(int, input().split())
h = sorted(map(int, input().split()), reverse=True)

print(sum(h[k:]))
N, K = map(int, input().split())

def combination(a, b):
    minb = min(a-b, b)
    r = 1
    for i in range(1, minb+1):
        r = r * (a-minb+i)/i
    return int(r)

for i in range(1, K+1):
    if N==K and i!=1:
        print(0)
        continue
    must = combination(K-1, i-1)
    left_ball = N-K-i+1
    if left_ball < 0:
        print(0)
        continue
    can = combination(left_ball+i, i)
    print((must*can)%1000000007)

### FIXED CODE ###

N, K = map(int, input().split())
mod = 10**9+7

import math

def combination(a, b):
    minb = min(a-b, b)
    r = 1
    for j in range(1, minb+1):
        r = r * (a-minb+j)//j
    return int(r)

for i in range(1, K+1):
    if N==K and i!=1:
        print(0)
        continue
    must = combination(K-1, i-1)
    if must is None:
        print("K:"+str(K)+", i:"+str(i))
    left_ball = N-K-i+1
    if left_ball < 0:
        print(0)
        continue
    can = combination(left_ball+i, i)
    print((must*can)%mod)
a, b = map(int, input().split())
if a != b:
    c = (abs(a) + abs(b))/2
    if type(c) is int:
        print(c)
        return
if a == b:
    print(0)
    return
print("IMPOSSIBLE")


### FIXED CODE ###

a, b = map(int, input().split())
if (abs(a)+abs(b))%2 == 0:
    print(int((abs(a) + abs(b))/2))
else:
    print("IMPOSSIBLE")
N, K = map(int, input().split()
a = list(map(int, input().split()))
s = [sum([b > c for c in a])*K for b in a]
p = [sum([l < a[i] for l in a[:i]]) for i in range(1, len(a))]
print(int((sum(s)-sum(p))%(1e9+7)))

### FIXED CODE ###

MAX = 10**9 + 7
_, K = map(int, input().split())
a = list(map(int, input().split()))
s = [sum([b > c for c in a]) for b in a]
r = [sum([b > c for c in a[i:]]) for i, b in enumerate(a)]
b = sum(s)*(K-1)*K//2%MAX
print((b+sum(r)*K)%MAX)
A,B,C,D= map(int, input().split())
L=A+B:
R=C+D:
if L>R:
  print('Left')
elif L=R:
  print('Balanced')
else :
  print('Right')


### FIXED CODE ###

a , b, c ,d = map(int,input().split(' '))
L=a+b
R=c + d
if L> R:
    print('Left')
elif L<R:
    print('Right')
else:
    print('Balanced ')
N = int(input())
a = list(map(int, input().split()))
count = 0
if 1 not in a:
    print(-1)
else:
    count += a.index(1)
    prev_index = a.index(1)
    for i in range(prev_index):
        a[i] = 0
for i in range(2,N+2):
    if i not in a:
        count += N - (prev_index + 1)
        break
    else:
        count += a.index(i) - prev_index -1
        two_ago_index = prev_index
        prev_index = a.index(i)
        for j in range(two_ago_index,prev_index+1):
            a[j] = 0
print(count)

### FIXED CODE ###

N = int(input())
a = list(map(int, input().split()))
count = 1
brick = 0
for i in range(N):
    if a[i] != count:
        brick += 1
    else:
        count += 1
if brick == N:
    print(-1)
else:
    print(brick)
n,m = map(int, input().split())
p = [0]*m 
for i in range(m):
    p[i] = input().split()
for i in range(m):
    p[i][0]=int(p[i][0])
AC=[]
WA=0
for i in range(m):
    if p[i][1]=="AC" and p[i][0] not in AC:
        AC.append(p[i][0])
    elif s[i]=="WA" and p[i][0] not in AC and [p[i][0],"AC"] in p:
        WA=WA+1
print(len(AC),WA)

### FIXED CODE ###

n,m = map(int, input().split())
p = [0]*m 

for i in range(m):
    p[i] = input().split()
AC=[[0,-1] for j in range(n)]
k=0
WA=0
for i in range(m):
    if p[i][1]=="AC" and AC[int(p[i][0])-1][0]==0 :
        AC[int(p[i][0])-1][0]=1
        AC[int(p[i][0])-1][1]=i
        k=k+1
for i in range(m):
    if p[i][1]=="WA" and AC[int(p[i][0])-1][0]==1 and AC[int(p[i][0])-1][1]>i:
        WA=WA+1

print(k,WA)
s = map(int, input().split())
l=[s]
i=1
def func(a):
  if a%2==0:
    return a/2
  else:
    return 3s+1

def Collatz(s):
    i+=1
	l.append(func(s))
	if not len(l) == len(set(l)):
        print(i)
        break
    else:
        continue
Collatz(s)

### FIXED CODE ###

s = int(input())
l=[s]
i=1
def func(a):
  if a%2==0:
    return(a/2)
  else:
    return(3*a+1)

while (len(l)==len(set(l))):
  i+=1
  s = func(s)
  l.append(s)
print(i)
a, b = input().split()
l_a = len(a)
l_b = len(b)
if sqrt(int(a)*10**l_b + int(b)).is_integer():
  print('Yes')
else:
  print('No')

### FIXED CODE ###

a, b = input().split()
l_a = len(a)
l_b = len(b)
if ((int(a)*(10**l_b) + int(b))**0.5).is_integer():
  print('Yes')
else:
  print('No')
# coding: utf-8
import numpy as np

a,b,c = map(long,input().split())

# print(a,b,c)
# if np.sqrt(a)+np.sqrt(b)<np.sqrt(c):
#     print("Yes")
# else:
#     print("No")
if a*a+b*b+c*c-2*a*b-2*b*c-2*a*c>0:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

# coding: utf-8
import numpy as np

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

# print(a,b,c)
# if np.sqrt(a)+np.sqrt(b)<np.sqrt(c):
#     print("Yes")
# else:
#     print("No")
d = c-a-b
if d>0 and 4*a*b<d*d :
    print("Yes")
else:
    print("No")
def merge(A, left, mid, right):
  global count
  n1 = mid - left
  n2 = right - mid
  L = A[left:mid] + [10**9]
  R = A[mid:right] + [10**9]
  
  i = 0
  j = 0

  for k in range(left, right):
    if L[i] <= R[i]:
      A[k] = L[i]
      i += 1
    else:
      A[k] = R[j]
      j += 1
  count += right - left

def mergeSort(A, left, right):
  if left + 1 < right:
    mid = (left + right) // 2
    mergeSort(A, left, mid)
    mergeSort(A, mid, right)
    merge(A, left, mid, right)

N = int(input())
A = list(map(int, input().split()))
count = 0
mergeSort(A, 0, N)
print(*A)
print(count)
    

### FIXED CODE ###

def merge(A, left, mid, right):
  global count
  L = A[left:mid] + [10**9 + 1]
  R = A[mid:right] + [10**9 + 1]
  
  i = 0
  j = 0

  for k in range(left, right):
    if L[i] <= R[j]:
      A[k] = L[i]
      i += 1
    else:
      A[k] = R[j]
      j += 1
  count += right - left

def mergeSort(A, left, right):
  if left + 1 < right:
    mid = (left + right) // 2
    mergeSort(A, left, mid)
    mergeSort(A, mid, right)
    merge(A, left, mid, right)

N = int(input())
A = list(map(int, input().split()))
count = 0
mergeSort(A, 0, N)
print(*A)
print(count)
from collections import Counter
from itertools import combinations

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

v.sort(reverse=True)
v_cum = []
num = 0
for i in range(n):
    num += v[i]
    v_cum.append(num)

print(v_cum[a-1]/a)

if a == n:
    print(1)
else:
    if v[a-1] == v[a]:
        num = v[a-1]
        cf = Counter(v[:a])
        cb = Counter(v[a:])
        n_cf = cf[num]
        n_cb = cb[num]
        if cf[num] != a:
            print(combinations(n_cf+n_cb, n_cf))
        else:
            ans = 0
            for k in range(a, a+n_cb+1):
                ans += combinations(a+n_cb, k)
            print(ans)
    else:
        print(1)

### FIXED CODE ###

from collections import Counter
from scipy.misc import comb

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

v.sort(reverse=True)
v_cum = []
num = 0
for i in range(n):
    num += v[i]
    v_cum.append(num)

print(v_cum[a-1]/a)

if a == n:
    print(1)
else:
    if v[a-1] == v[a]:
        num = v[a-1]
        cf = Counter(v[:a])
        cb = Counter(v[a:])
        n_cf = cf[num]
        n_cb = cb[num]
        if n_cf != a:
            print(comb(n_cf+n_cb, n_cf, exact=True))
        else:
            ans = 0
            for k in range(a, min(b+1, a+n_cb+1)):
                ans += comb(a+n_cb, k, exact=True)
            print(ans)
    else:
        print(1)
import sys
s = sys.argv
weathers = ['Sunny', 'Cloudy', 'Rainy']
for i, weather in enumerate(weathers):
    if s == weather:
        return weathers[(i+1)%3]

### FIXED CODE ###

s = input()
weathers = ['Sunny', 'Cloudy', 'Rainy']
print(weathers[(weathers.index(s)+1)%3])
S = input()
N = len(S)
amari = [0 fot i in range(2019)]
for i in range(N):
    amari[int(S[i : N]) % 2019] += 1
ans = amari[0]
for i in amari:
    if i > 1:
       ans += i * (i - 1) // 2
print(ans)


### FIXED CODE ###

S = input()[::-1]
N = len(S)
amari = [0 for i in range(2019)]
before = int(S[0])
amari[before] += 1
S = S[1::]
keta = 1
for i in S:
    i = int(i)
    keta = (keta * 10) % 2019
    x = (keta * i + before) % 2019
    amari[x] += 1
    before = x
ans = amari[0]
for i in amari:
    ans += i * (i - 1) // 2
print(ans)
N=int(input())
A=list(map(int,input().split()))
B=[0]*(10**9)
for i in range(N):
    if B[A[i]-1]>=1: 
        print("NO")
        exit(0)
    else:
        B[A[i]-1]+=1
print("YES")

### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
list.sort(A)
for i in range(N-1):
    if A[i]-A[i+1]==0:
        print("NO")
        exit(0)
print("YES")
n = int(input())
if n == 1:
    print(0)
else:
    answer = 0
    for factor in factorization(n):
        x = factor[1]
        kouho = int((2*x)**0.5)-1
        if (kouho)*(kouho+1)/2 <=x and x < (kouho+1)*(kouho+2)/2:
            kaisu = kouho
        else:
            kaisu = kouho+1
        answer += kaisu

    print(answer)

### FIXED CODE ###

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

n = int(input())
if n == 1:
    print(0)
else:
    answer = 0
    for factor in factorization(n):
        x = factor[1]
        kouho = int((2*x)**0.5)-1
        if (kouho)*(kouho+1)/2 <=x and x < (kouho+1)*(kouho+2)/2:
            kaisu = kouho
        else:
            kaisu = kouho+1
        answer += kaisu

    print(answer)
from sys import stdin


class DFS():
    def __init__(self,A_B_arr,N,M):
        self.N = N
        self.M = M
        self.route = {i:[] for i in range(N+1)}
        for A, B in A_B_arr:
            self.route[A].append(B)
            self.route[B].append(A)

        self.dp = [[None,self.N] for i in range(N+1)]
        self.dp[1] = [1,0]

    def dfs(self,i,rank):
        for r in self.route[i]:
            if rank<self.dp[r][1]:
                self.dp[r] = [i,rank]
                self.dfs(r,rank+1)
        return


if __name__ == "__main__":
    _in = [_.rstrip() for _ in stdin.readlines()]
    N, M = list(map(int,_in[0].split(' ')))  # type:list(int)
    A_B_arr = []
    for i in range(M):
        _ = list(map(int,_in[i+1].split(' ')))  # type:list(int)
        A_B_arr.append(_)
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    dfs = DFS(A_B_arr,N,M)
    dfs.dfs(1,1)

    #ans = []
    #TF = 'Yes'
    #for (i,_) in enumerate(dfs.dp):
    #    if i>1:
    #        if _[0] == None:
    #            TF = 'No'
    #            break
    #        else:
    #            ans.append(_[0])
    ## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    #if TF == 'Yes':
    #    print(TF)
    #    for _ in ans:
    #        print(_)
    #else:
    #    print(TF)


### FIXED CODE ###

from sys import stdin
from collections import deque


class BFS():
    def __init__(self, con, val=None):
        # 隣接リスト表現
        self.con = con
        self.val = val
        self.N = len(self.con)
        # 1つ前の部屋(1-indexed)
        self.dist = [-1]*self.N
        self.que = deque()

        # 初期条件(0-indexed)
        self.dist[0] = 0
        self.que.append(0)

    def bfs(self):
        while self.que:
            v = self.que.popleft()
            for next_v in self.con[v]:
                if self.dist[next_v] != -1:
                    continue
                self.dist[next_v] = v+1
                self.que.append(next_v)


if __name__ == "__main__":
    _in = [_.rstrip() for _ in stdin.readlines()]
    N, M = list(map(int,_in[0].split(' ')))  # type:list(int)
    A_B_arr = []
    for i in range(M):
        _ = list(map(int,_in[i+1].split(' ')))  # type:list(int)
        A_B_arr.append(_)
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    con = [[] for i in range(N)]
    for A,B in A_B_arr:
        A -= 1
        B -= 1
        con[A].append(B)
        con[B].append(A)

    bfs = BFS(con)
    bfs.bfs()
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    if -1 in bfs.dist[1:]:
        print('No')
    else:
        print('Yes')
        for _ in bfs.dist[1:]:
            print(_)
a,b,c = map(int,input().split())
k = int(input())
ans = max(a,b,c)
for i in range(k):
  ans = ans × 2
print(ans)


### FIXED CODE ###

a,b,c = map(int,input().split())
k = int(input())
ans = max(a,b,c)
for i in range(k):
  ans = ans + ans
print(ans+min(a,b,c)+a+b+c-max(a,b,c)-min(a,b,c))
c = 0

while True:
    x = int(input()) ; c +=1
    
    if x == 0:
        break
   
    print("Case {}: {}.format(c, x))


### FIXED CODE ###

c = 0

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