Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

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

is_divided = [0]*n

for i in range(n):
  if is_divided[i]:
    continue
  for j in range(n):
    if j == i:
      continue
    if a[j]%a[i] == 0:
      is_divided[j] = 1
      if a[j] == a[i]:
        is_divided[i] = 1
      
print(n-sum(is_divided))

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
MAX = 10**6+1

is_divided = [0]*MAX 
is_appeared = [0]*MAX

for i in range(n):
  if not is_divided[a[i]]:
    if not is_appeared[a[i]]:
      is_appeared[a[i]] = 1
      k = a[i]*2
      while k < MAX:
        is_divided[k] = 1
        k += a[i]
    else:
      is_divided[a[i]] = 1
      
ans = 0      
for i in range(n):
  if not is_divided[a[i]]:
    ans += 1
print(ans)
### BUGGY CODE ###

import numpy as np
# import math
# import copy
# from collections import deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10000)
from numba import njit


@njit
def make_my_route(route,A,N):
    pre = 1
    for i in range(N):
        now = A[pre-1]
        temp = np.sum(route == now)
        if temp == 1:
            break
        route = np.append(route,now)
        pre = now
    return (route,now)


def main():
    N,K = map(int,input().split())
    A = list(map(int,input().split()))
    A = np.array(A)

    route = np.array([1])

    route,now = make_my_route(route,A,N)
    start = int(np.where(route == now)[0])

    if K < start:
        res = route[K]
    elif start+1 != N:
        K -= start
        loop = route[start:]
        # print(loop,K)
        M = len(loop)
        K %= M
        res = loop[K]
    else:
        res = route[K]

    print(res)



main()


### FIXED CODE ###

# import numpy as np
# import math
# import copy
# from collections import deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10000)
# from numba import njit


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

    s = []
    ord = [-1] * (N+1)
    v = 1

    while ord[v] == -1:
        ord[v] = len(s)
        s.append(v)
        v = A[v-1]

    c = len(s) - ord[v]
    l = ord[v]

    if K < l:
        res = s[K]
    else:
        K -= l
        K %= c
        res = s[l+K]

    print(res)



main()
### BUGGY CODE ###

import sys
sys.setrecursionlimit(100000)

hash_no = 10 ** 9 + 7


def move(x, y, X, Y):
    global counter
    if x > X:
        return
    if y > Y:
        return
    if (x == X) and (y == Y):
        counter += 1
        return
    if Y > 2 * (X - x) + y:
        return
    if Y < (X - x) / 2 + y:
        return

    move(x + 1, y + 2, X, Y)
    move(x + 2, y + 1, X, Y)


def main():
    global counter
    x, y = map(int, input().split())
    counter = 0

    if (x + y) % 3 != 0:
        print(0)
    else:
        move(0, 0, x, y)
        print(counter % hash_no)


if __name__ == '__main__':
    main()

### FIXED CODE ###

# AtCoder Beginner Contest 145 D - Knight
import sys
from math import factorial

mod = 10 ** 9 + 7

X, Y = map(int, sys.stdin.readline().strip().split())

# 合計の移動回数は Total = X + Y / 3 
# 移動方法は A: (i + 1, j + 2)  B: (i + 2, j + 1) の2通り
# 移動回数は A: 2 * Total - X  B: X - Total 

# 到達不可能であるか判断する
if (X + Y) % 3 != 0:
    print(0)
    sys.exit()

if Y > 2 * X or Y < X * 0.5:
    print(0)
    sys.exit()


Total = (X + Y) // 3
A = Total * 2 - X
B = X - Total

# combination の計算
ans = 1
for i in range(1, Total + 1):
    ans *= i
    ans %= mod

ans = ans * pow(factorial(A), mod - 2, mod)
ans = ans * pow(factorial(B), mod - 2, mod)

print(ans % mod)
### BUGGY CODE ###

from collections import defaultdict, Counter
from itertools import combinations
import sys
input = sys.stdin.readline

n = int(input())
s = ["".join(sorted(input().split()[0])) for _ in range(n)]
result = 0
cnt = Counter(s)
for c in cnt:
    result += len(list(combinations([""] * cnt[c], 2)))
print(result)

### FIXED CODE ###

import sys
input = sys.stdin.readline
n = int(input())
s = ["".join(sorted(input().split()[0])) for _ in range(n)]
cnt = {}
result = 0
for si in s:
    if si in cnt:
        result += cnt[si]
        cnt[si] += 1
    else:
        cnt[si] = 1
print(result)
### BUGGY CODE ###

n,m = map(int,input().split())
a = []
z = []
p = 0
for i in range(m):
    x,y = map(int,input().split())
    if x == 1:
        z.append(y)
    elif y == n:
        a.append(x)
        p += 1
    else:
        pass
flg = False
for i in range(p):
    if a[i] in z:
        flg = True
        break
if flg:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

### FIXED CODE ###

n,m = map(int,input().split())
a = [] # 1 → x
z = [] # x → n
an = 0
zn = 0
for i in range(m):
    x,y = map(int,input().split())
    if x == 1:
        zn += 1
        z.append(y)
    elif y == n:
        an += 1
        a.append(x)
    else:
        pass
a.sort()
z.sort()
i = 0
j = 0
while i < an and j < zn:
    if a[i] == z[j]:
        print('POSSIBLE')
        exit(0)
    else:
        if a[i] > z[j]:
            j += 1
        else:
            i += 1
print('IMPOSSIBLE')
### BUGGY CODE ###

# AtCoder Educational DP Contest
# B Frog 2


def main():
    n, k, *h = map(int, open(0).read().split())

    dp = [0 for _ in range(n)]
    l = [0 if i - k < 0 else i - k for i in range(n)]
    for i, (h_now, l_now) in enumerate(zip(h[1:], l[1:]), 1):
        hs = h[l_now:i]
        dps = dp[l_now:i]
        f = lambda x, y: abs(h_now - x) + y
        *tmp, = map(f, hs, dps)
        tmp.sort()
        dp[i] = tmp[0]

    res = dp[-1]
    print(res)


if __name__ == '__main__':
    main()


### FIXED CODE ###

n, k = map(int, input().split())
hs = list(map(int, input().split()))
dp=[0]*n
dp[0]=0
for i, hi in enumerate(hs):
    if i == 0:
        continue
    s = max(0, i-k)
    dp[i] = min([ml + abs(hl - hi) for ml, hl in zip(dp[s:i], hs[s:i])])
print(dp[-1])
### BUGGY CODE ###


import math

A, B, C, D = map(int, input().split())

CN = C
DN = D
while CN != DN:
    if CN < DN:
        CN += C
    else:
        DN += D

CD = CN

#print(CD)

C_count = B//C - (A-1)//C 
D_count = B//D - (A-1)//D
CD_count = B//CD - (A-1)//CD 



#print(C_count, D_count, CD_count)

print(B - A + 1 - C_count - D_count + CD_count)

### FIXED CODE ###


A, B, C, D = map(int, input().split())

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def lcm(a, b):
    return a * b // gcd (a, b)


CD = lcm(C, D)

#print(CD)

C_count = B//C - (A-1)//C 
D_count = B//D - (A-1)//D
CD_count = B//CD - (A-1)//CD 



#print(C_count, D_count, CD_count)

print(B - A + 1 - C_count - D_count + CD_count)
### BUGGY CODE ###

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

l = 0
r = max(A)
for _ in range(100):
    mid = (r + l + 1) // 2
    count = 0
    for log in A:
        if log > mid:
            count += (log + mid - 1) // mid - 1
    if count <= K:
        r = mid
    else:
        l = mid

print(r)


### FIXED CODE ###

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

l = 0
r = max(A)
for _ in range(100):
    mid = (r + l + 1) // 2
    count = 0
    for log in A:
        if log > mid:
            count += (log + mid - 1) // mid - 1
    if count <= K:
        r = mid
    else:
        l = mid

print(r)
### BUGGY CODE ###

def main():
    n = int(input())
    num_list = list(map(int, input().split()))

    num_list_copy = num_list[:]

    num_list.sort()

    s_num_list = num_list[:]

    for i in range(n):
        num_list.remove(num_list_copy[i])
        print(num_list[(n-2)//2])
        num_list = s_num_list[:]

if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    n = int(input())
    num_list = list(map(int, input().split()))

    c_num_list = num_list[:]

    num_list.sort()

    for i in range(n):
        tmp = num_list[n//2]
        if c_num_list[i] >= tmp:
            print(num_list[n//2-1])
        else:
            print(num_list[n//2])
        

if __name__ == '__main__':
    main()
### BUGGY CODE ###

import numpy as np
from scipy.sparse.csgraph import connected_components
from scipy.sparse import csr_matrix

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

for i in range(m):
  _a, _b = map(int, input().split())
  l[_a - 1][_b - 1] = 1

l = np.array(l)
csr = csr_matrix(l)

print(connected_components(csr, return_labels=False) - 1)

### FIXED CODE ###

import numpy as np
from scipy.sparse.csgraph import connected_components
from scipy.sparse import csr_matrix

n, m = map(int, input().split())
data = [1 for i in range(m)]
a = []
b = []

for i in range(m):
  _a, _b = map(int, input().split())
  a.append(_a - 1)
  b.append(_b - 1)

csr = csr_matrix((data, (a, b)), (n, n))

print(connected_components(csr, return_labels=False) - 1)
### BUGGY CODE ###

def main():
	n=int(input())
	a=list(map(int, input().split()))
	count=0
	for i in range(n):
		if a.count(a[i])>1:
			print('NO')
			break
	else:
		print('YES')
main()

### FIXED CODE ###

def main():
	n=int(input())
	a=list(map(int, input().split()))
	a.sort()
	c=0
	for i in range(n-1):
		if a[i] == a[i+1]:
			print('NO')
			c+=1
			break
	if c==0:
		print('YES')
main()
### BUGGY CODE ###

import itertools
import numpy as np
N = int(input())

def prime_factorize(n):
    ans = [1]
    i = 2
    while i * i <= n:
        if n % i == 0:
            n //= i
            ans.append(i)
        else:
            i += 1
    if n != 1:
        ans.append(n)
    
    return ans

primes = prime_factorize(N)
index = [i for i in range(len(primes))]
ans = False

for i in range(1, len(primes) + 1):
    for cmb in itertools.combinations(index, i):
        if i != len(primes):
            i_moved = np.prod(np.array([primes[k] for k in range(len(primes)) if k in cmb])) - 1
            j_moved = np.prod(np.array([primes[k] for k in range(len(primes)) if k not in cmb])) - 1 
        else:
            i_moved = np.prod(np.array(primes)) - 1
            j_moved = 0
        if ans is not False:
            ans = min(ans, i_moved + j_moved)
        else:
            ans = i_moved + j_moved
            
print(ans)

### FIXED CODE ###

N = int(input())
div = []
ans = N - 1
i = 2
while i ** 2 <= N:
    if N % i == 0:
        div.append(i)
    i += 1

for d in div:
    ans = min(ans, d + N // d - 2)

print(ans)
### BUGGY CODE ###

a=int(input())
li = list(map(int,input().split()))
c = 0
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors

for i in range(a-1):
    if len(list(set(li))) != len(li):
        c = 1
        break
    for j in range(i+1,a):
        x = make_divisors(li[j]*li[i])
        if len(x) != len(set(x)):
            c = 1
            break

if c > 0:
    print('NO')
else:
    print('YES')

### FIXED CODE ###

a=int(input())
li = list(map(int,input().split()))
c = 0
if len(li) != len(set(li)):
    print('NO')
else:
    print('YES')
### BUGGY CODE ###


import math

def get_sieve_of_eratosthenes(n):
    if not isinstance(n, int):
        raise TypeError('n is int type.')
    if n < 2:
        raise ValueError('n is more than 2')
    prime = []
    limit = math.sqrt(n)
    data = [i + 1 for i in range(1, n)]
    while True:
        p = data[0]
        if limit <= p:
            return prime + data
        prime.append(p)
        data = [e for e in data if e % p != 0]


# まずは素数表を作る
ten5 = 10**5

x = get_sieve_of_eratosthenes(ten5)
P = [0] * (ten5+1)
for c in x:
    P[c] = 1

Q = int(input())
for _ in range(Q):
    l, r = map(int, input().split())
    count = 0
    for i in range(l, r+1):
        if P[i] == 1 and ( P[(i+1) // 2] == 1 ):
            count += 1

    print(count)


### FIXED CODE ###

import math

def get_sieve_of_eratosthenes(n):
    if not isinstance(n, int):
        raise TypeError('n is int type.')
    if n < 2:
        raise ValueError('n is more than 2')
    prime = []
    limit = math.sqrt(n)
    data = [i + 1 for i in range(1, n)]
    while True:
        p = data[0]
        if limit <= p:
            return prime + data
        prime.append(p)
        data = [e for e in data if e % p != 0]


# まずは素数表を作る
ten5 = 10**5

# x = 素数一覧
x = get_sieve_of_eratosthenes(ten5)

# P = 素数表(1 = 素数)
P = [0] * (ten5+1)

# LIKE = 似た数表
LIKE = [0] * (ten5+1)
for i in x:
    P[i] = 1

    if i == 2:
        LIKE[i] = 1
        continue

    # i は素数
    like = ((i+1)//2)
    LIKE[i] = P[like]

S = [0] * (ten5+1)
S[0] = LIKE[0]
for i in range(1, ten5+1):
    S[i] = S[i-1] + LIKE[i]


Q = int(input())
for _ in range(Q):
    l, r = map(int, input().split())

    ans = S[r]-S[l-1]
    if l <= 1:
        ans -= 1

    print(ans)
### BUGGY CODE ###

n = int(input())
s = input()
count = 0
num_list = [str(i).zfill(3) for i in range(1000)]
for i in range(len(num_list)):
    a = b = -1
    for j in range(len(s)):
        if s[j] == num_list[i][0]:
            a = j
            break
    if a != -1:
        for j in range(a+1,len(s)):
            if s[j] == num_list[i][1]:
                b = j
                break
    if b != -1:
        for j in range(b+1,len(s)):
            if s[j] == num_list[i][2]:
                count += 1
                break
print(count)


### FIXED CODE ###

import bisect
n = int(input())
s = input()
count = 0
num_ind_list = []
for i in range(10):
    num_ind_list.append([0])
for i in range(n):
    num_ind_list[int(s[i])].append(i)
for i in range(10):
    num_ind_list[i].append(30000)
for i in range(10):
    if len(num_ind_list[i]) != 2:
        for j in range(10):
            b = bisect.bisect_right(num_ind_list[j], num_ind_list[i][1])
            if num_ind_list[j][b] != 30000:
                for k in range(10):
                    c = bisect.bisect_right(num_ind_list[k], num_ind_list[j][b])
                    if num_ind_list[k][c] != 30000: count += 1
print(count)
### BUGGY CODE ###

from sys import stdin


if __name__ == "__main__":
    _in = [_.rstrip() for _ in stdin.readlines()]
    S =     _in[0]   # type:str
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    memo = set()
    cnt = 0
    for i in range(len(S)):
        for j in range(i+3,len(S)):
            _ = int(S[i:j+1])
            if _ in memo:
                cnt += 1
            elif _%2019==0:
                cnt += 1
                memo.add(_)
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(cnt)


### FIXED CODE ###

from sys import stdin


def main():
    _in = [_.rstrip() for _ in stdin.readlines()]
    S =     _in[0]   # type:str
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    len_S = len(S)
    cnt = 0
    for i in range(len_S):
        for j in range(i+3,len_S):
            if j == i+3:
                mod = int(S[len_S-j-1:len_S-i])%3
            else:
                mod = (mod+int(S[len_S-j-1]))%3
            if mod == 0:
                _ = int(S[len_S-j-1:len_S-i])
                if _%673==0:
                    cnt += 1
                    break
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(cnt)


if __name__ == "__main__":
    #main()

    _in = [_.rstrip() for _ in stdin.readlines()]
    S =     _in[0]   # type:str
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    cnt = 0
    mod_arr = [0] * 2019
    mod_arr[0] += 1

    num, dec = 0, 1
    for s in S[::-1]:
        num += int(s)*dec
        num %= 2019
        dec *= 10
        dec %= 2019
        mod_arr[num] += 1

    for i in range(2019):
        if mod_arr[i] > 0:
            cnt += mod_arr[i]*(mod_arr[i]-1)//2
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(cnt)
### BUGGY CODE ###

n = int(input())

a=1

for i in range(1, n+1):
  a *= i

print(a%(10**9+7))

### FIXED CODE ###

import math

n = int(input())
a = math.factorial(n) % (10**9 + 7) 

print(a)
### BUGGY CODE ###

N = int(input())
S = []
for i in range(N):
    tmp = list(input())
    tmp.sort()
    S.append(tmp)
cnt = 0

for i in range(N):
    for j in range(i+1,N):
        if S[i]==S[j]:
            cnt += 1

print(cnt)

### FIXED CODE ###

N = int(input())
S = []
for i in range(N):
    tmp = list(input())
    tmp.sort()
    S.append(''.join(tmp))
cnt = 0

mydict = {}

for i in range(N):
    if (S[i] in mydict.keys()) == False:
        mydict[S[i]] = 0
    else:
        cnt += mydict[S[i]]+1
        mydict[S[i]] += 1

print(cnt)
### BUGGY CODE ###

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

for i in range(K):
 sum = A + B + C
 A = sum - A
 B = sum - B
 C = sum - C

if A-B > 10e18 or B-A > 10e18:
 print("Unfair")
else:
 print(A-B)

### FIXED CODE ###

A,B,C,K= map(int, input().split())
 
if (A-B) > 10e18 or (B-A) > 10e18:
 print("Unfair")
elif K % 2 == 1:
 print(B-A)
else:
 print(A-B)
### BUGGY CODE ###

N, M = map(int, input().split())
p_dict = {}
p = [0 for i in range(M)]
y = [0 for i in range(M)]
for i in range(M):
    p[i], y[i] = map(int, input().split())
    if p[i] not in p_dict:
        p_dict[p[i]] = [y[i]]
        continue
    p_dict[p[i]].append(y[i])

for key in p_dict.keys():
    p_dict[key].sort()

for i in range(M):
    print('{:06d}{:06d}'.format(p[i], p_dict[p[i]].index(y[i])+1))


### FIXED CODE ###

import numpy as np
N, M = map(int, input().split())
p_dict = {}
p = [0 for i in range(M)]
y = [0 for i in range(M)]
i_in_p = [0 for i in range(M)]

for i in range(M):
    p[i], y[i] = map(int, input().split())
    if p[i] not in p_dict:
        i_in_p[i] = 0
        p_dict[p[i]] = [y[i]]
        continue
    i_in_p[i] = len(p_dict[p[i]])
    p_dict[p[i]].append(y[i])
for key in p_dict.keys():
    p_dict[key] = np.array(p_dict[key]).argsort().argsort() + 1
for i in range(M):
    print('{:06d}{:06d}'.format(p[i], p_dict[p[i]][i_in_p[i]]))
### BUGGY CODE ###

n=input()
m=0
from itertools import combinations
b=combinations
a=b(map(int,input().split()),2)
for i,j in a:
    k=i*j
    m+=k
MOD = 10 ** 9 + 7
v=m%MOD
print(v)

### FIXED CODE ###

N=int(input())
A=list(map(int, input().split()))
MOD = 10 ** 9 + 7

cumsum = [A[0]]
for i in range(1, N):
    cumsum.append(A[i] + cumsum[i - 1])

ans = 0
for i in range(N):
    ans += (A[i] * (cumsum[-1] - cumsum[i])) % MOD
    ans %= MOD

print(ans)
### BUGGY CODE ###

N=int(input())
S=[]
for i in range(N):
  a=input()
  if(a not in S):
     S.append(a)
print(len(S))

### FIXED CODE ###

N=int(input())
S=[]
for i in range(N):
  S.append(input())

print(len(list(set(S))))
### BUGGY CODE ###

n,m=[int(s) for s in input().split()]
key=[]
for i in range(m):
  cost,b=[int(s) for s in input().split()]
  op=0
  for i in input().split():
    op+=1<<(int(i)-1)
  key.append([cost,op])
N=2**n
dp=[[10**7 for _ in range(N)] for _ in range(m)]
dp[0][key[0][1]]=key[0][0]
dp[0][0]=0
for i in range(1,m):
  ls=[set() for _ in  range(N)]
  for j in range(N):
    ls[j].add(dp[i-1][j])
    ls[j].add(dp[i][j])
    x=j|key[i][1]
    ls[x].add(dp[i-1][j]+key[i][0])
  dp[i]=[min(ls[k]) for k in range(N)]
if dp[m-1][N-1]==10**7:
  print(-1)
else:
  print(dp[m-1][N-1])




      

### FIXED CODE ###

n,m=[int(s) for s in input().split()]
key=[]
for i in range(m):
  cost,b=[int(s) for s in input().split()]
  op=0
  for i in input().split():
    op+=1<<(int(i)-1)
  key.append([cost,op])
N=2**n
dp=[[10**7 for _ in range(N)] for _ in range(m)]
dp[0][key[0][1]]=key[0][0]
dp[0][0]=0
for i in range(1,m):
  for j in range(N):
    dp[i][j]=min([dp[i-1][j],dp[i][j]])
    x=j|key[i][1]
    dp[i][x]=min([dp[i][x],dp[i-1][j]+key[i][0]])
if dp[m-1][N-1]==10**7:
  print(-1)
else:
  print(dp[m-1][N-1])
### BUGGY CODE ###

k, s = map(int, input().split())
ans = 0
for x in range(k+1):
    for y in range(k+1):
        for z in range(k+1):
            if x + y + z == s:
                ans +=1
print(ans)

### FIXED CODE ###

k, s = map(int, input().split())
ans = 0
for x in range(k+1):
    for y in range(k+1):
        if 0 <= (s-x-y) <=k:
                ans +=1
print(ans)
### BUGGY CODE ###

n,k,q=map(int,input().split())

al=[int(input()) for i in range(q)]
pointl=[k for i in range(n)]

for i in range(q):
  pointl=[point-1 for point in pointl]
  pointl[al[i]-1]+=1
  #print(pointl)
#print(pointl)
for p in pointl:
  if p <= 0:
    print("No")
  else :
    print("Yes")

### FIXED CODE ###

n,k,q=map(int,input().split())

#al=[int(input()) for i in range(q)]
d={}
for i in range(q):
  s=int(input())
  if not s in d.keys():
    d[s]=1
  else :
    d[s]+=1
#print(d)

pointl=[k-q for i in range(n)]

for k,v in d.items():
  pointl[k-1]+=v
for p in pointl:
  if p <= 0:
    print("No")
  else :
    print("Yes")
### BUGGY CODE ###

# from math import factorial,sqrt,ceil #,gcd
# from itertools import permutations,combinations,combinations_with_replacement
# from collections import deque,Counter
# import re
# from bisect import bisect_left
# from heapq import heappush,heappop
# from numba import njit
# from functools import lru_cache # 簡単メモ化 @lru_cache(maxsize=1000)
# from fractions import gcd

# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
from networkx import Graph,shortest_path,single_target_shortest_path,astar_path
G = Graph()
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix
# from scipy.special import comb,perm #permはnPk

# slist = "abcdefghijklmnopqrstuvwxyz"
N,M = map(int,input().split())
rows = [list(map(int,input().split())) for _ in range(M)]

G.add_edges_from(rows)

ans = ["Yes"]
for i in range(2,N+1):
    try:
        shortestPath = astar_path(G,source=i,target=1)
        ans.append(shortestPath[1])
    except:
        print("No")
        exit()

print(*ans,sep="\n")
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する
# print("{:.10f}".format(ans))
# print("{:0=10d}".format(ans))


### FIXED CODE ###

# from math import factorial,sqrt,ceil #,gcd
# from itertools import permutations,combinations,combinations_with_replacement
# from collections import deque,Counter
# import re
# from bisect import bisect_left
# from heapq import heappush,heappop
# from numba import njit,jit
# from functools import lru_cache # 簡単メモ化 @lru_cache(maxsize=1000)
# from fractions import gcd

# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
from networkx import Graph
from networkx.algorithms.traversal.breadth_first_search import bfs_predecessors
G = Graph()
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix
# from scipy.special import comb,perm #permはnPk

# slist = "abcdefghijklmnopqrstuvwxyz"
N,M = map(int,input().split())
rows = [list(map(int,input().split())) for _ in range(M)]

G.add_edges_from(rows)

# shortestPath = shortest_path(G,target=1)
preds = bfs_predecessors(G,source=1)
# shortestPath = single_target_shortest_path(G,target=1)
# shortestPathLength,shortestPath = single_source_dijkstra(G,source=1)

preds = dict(preds)
if len(preds)+1 != N:
    print("No")
    exit()

print("Yes")
for i in range(2,N+1):
    print(preds[i])