Harryxun/stf_run huggingface dataset:
A , op , B = map(int,input().split())
if op == "+":
	print(int(A) + int(B))
else:
	print(int(A) - int(B))

### FIXED CODE ###

A , op , B = input().split()
if op == "+":
	print(int(A) + int(B))
else:
	print(int(A) - int(B))
import sys
import math 
ni = lambda: int(ns())
na = lambda: list(map(int, input().split()))
ns = lambda: input()
N,M = na()
MOD=1000000007
#壊れいている段の数
a=[]
if M>0:
    p=ni()
    a.append(p)
tmp=0
for i in range(M-1):
    tmp=ni()
    if(tmp-1==p):
        #a.append(tmp)
        print(0)
        exit()
    else:
        a.append(tmp)
dp = [0]*(N+1)
dp[0]=1
dp[1]=1
j=0
if(a[0]==0):
    j+=1
    dp[0]=0
if(a[0]==1):
    j+=1
    dp[1]=0
if(N==1):
    t= 1 if M>0 else 0
    print(t)
    exit()
if(N==2):
    for i in a:
        dp[i]=0
    print(dp[0]+dp[1])
    exit()


flag=True
for i in range(2,N+1):
    dp[i]=dp[i-1]+dp[i-2]
    dp[i]%=MOD
    if a[-1]<i or j>=len(a):
        flag=False
    if(flag and a[j]==i):
        dp[i]=0
        j+=1
    
#print(dp,a)
#print(dp)
print(dp[N])

### FIXED CODE ###

import sys
import math 
ni = lambda: int(ns())
na = lambda: list(map(int, input().split()))
ns = lambda: input()
N,M = na()
MOD=1000000007
#壊れいている段の数
a=[]
dp = [0]*(N+1)
dp[0]=1
a = [ni() for i in range(M)]
isbro = [1]*(N+1)
for i in range(M):
    isbro[a[i]]=0
#print(isbro)
for i in range(N):
    if(i-1>=0):
        dp[i+1] = dp[i]*isbro[i] + dp[i-1]*isbro[i-1]
    else:
        dp[i+1] = dp[i]*isbro[i]
    dp[i+1]%=MOD
#print(dp)
print(dp[N])
t=input()
result=''
for i in range(len(t)):
    if t[i]=='?':
        if result[i-1]=='P':
            result+='D'
        else:
            result+='P'
    else:
        result+=t[i]
print(result)

### FIXED CODE ###

t=input()
result=''
for i in range(len(t)-1):
    if t[i]=='?':
        try:
            if result[i-1]=='P':
                result+='D'
            else:
                if t[i+1]=='P':
                    result+='D'
                else:
                    result+='P'
        except:
            if t[i+1]=='P':
                result+='D'
            else:
                result+='P'
    else:
        result+=t[i]
if t[len(t)-1]=='?' or  t[len(t)-1]=='D':
    print(result+'D')
else:
    print(result+'P')
a,b,t=map(int,input.split())
if t >= a:print(b*(t//a))
else:print(0)

### FIXED CODE ###

a,b,t=map(int,input().split())
print(b*(t//a))
"""
切り捨て除算なので場合分けはいらない
input()にしなかった私が悪うございました(￣^￣)
"""
N,M,X = map(int,input().split())
A = list(map(int,input().split()))

print(min(sum(A[:X],sum(A[X:]))))

### FIXED CODE ###

N,M,X = map(int,input().split())
A = list(map(int,input().split()))
import bisect
id = bisect.bisect_left(A,X)
print(min(len(A[:id]),len(A[id:])))
N = int(input())
h = list(map(int, input().split()))

ans = 0
while max(h):
    current_hight = 0
    for i in range(len(h)):
        if not h[i]:
            if not current_hight:
                continue
            else:
                break
        elif h[i] < current_hight:
            break
        else:
            current_hight = h[i]
            h[i] -= 1
    ans += 1
    if ans == 75:

print(ans)

### FIXED CODE ###

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

ans = 0
while max(h):
    current_hight = 0
    for i in range(len(h)):
        if not h[i]:
            if not current_hight:
                continue
            else:
                break
        elif h[i] < current_hight:
            break
        else:
            current_hight = h[i]
            h[i] -= 1
    ans += 1

print(ans)
import collections
ans=0
N = int(input())
A=[]
for i In range(N):
    x=collections.Counter(list(input()))
    for s in A:
        if x==s:
            ans+=1
        else:
            A.append(x)
print(ans)

### FIXED CODE ###

N = int(input())
dic = {}
ans = 0
for i in range(N):
    tmp = "".join(sorted(input()))
    if tmp in dic:
        ans += dic[tmp]
        dic[tmp] += 1
    else:
        dic[tmp] = 1
print(ans)
n=int(input())
ans=[0]*(10000)
for i in range(1,101):
  for j in range(1,101):
    for k in range(1,101):
      ans[i**2+j**2+k**2+i*j+j*k+i*k]+=1
for i in range(n+1):
  print(ans[i])

### FIXED CODE ###

n=int(input())
ans=[0]*(10001)
for i in range(1,101):
  for j in range(1,101):
    for k in range(1,101):
      index=i**2+j**2+k**2+i*j+j*k+i*k
      if index<=10000:
        ans[index]+=1
     
for i in range(1,n+1):
  print(ans[i])
from collections import defaultdict

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

a0 = A[0]
c = A[1]
b = a0 ^ a1

f = True

for i in range(3, N):
    if i % 3 == 0 and a != A[i]:
        f = False
    elif i % 3 == 1 and b != A[i]:
        f = False
    elif i % 3 == 2 and c != A[i]:
        f = False

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


### FIXED CODE ###

from collections import defaultdict

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

dic = defaultdict(int)


# 3の倍数個
if N % 3 == 0:
    
    for a in A:
        dic[a] += 1

    n_kind = len(dic.keys())
    values = list(dic.keys())
    cnts = list(dic.values())
        
    # 整数の種類数で分岐
    if n_kind == 3:
        is_xor = False    
        # 3つの整数で xorの関係を作れるか判定
        for i in range(n_kind-2):
            for j in range(i+1, n_kind-1):
                for k in range(j+1, n_kind):
                    if values[i] ^ values[j] ^ values[k] == 0:
                        is_xor = True

        
        # 3つの整数がそれぞれ N/3個であるか判定
        is_n_valid = True
        for cnt in cnts:
            if cnt != N/3:
                is_n_valid = False

            
        if is_xor and is_n_valid:
            print('Yes')
        else:
            print('No')
    
    elif n_kind == 2:
        
        # 2つの整数がそれぞれ 2N/3個であり、0がN/3子であるか判定
        is_n_valid = True
        if 0 in values:
            for k, v in dic.items():
                if k == 0:
                    if v != N/3:
                        is_n_valid = False
                else:
                    if v != N * (2/3):
                        is_n_valid = False
        else:
            is_n_valid = False

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


    elif n_kind == 1:
        all_zero = True
        for a in A:
            if a != 0:
                all_zero = False

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

    else:
        print('No')

# 3の倍数個以外の場合は、全て0である必要がある
else:
    all_zero = True
    for a in A:
        if a != 0:
            all_zero = False

    if all_zero:
        print('Yes')
    else:
        print('No')
s = input()
a = s.split()
count = 0
j = len(s)
for i in range(j):
  if i<j:
  	if a[i] != a[j-i-1]:
    	count += 1 
print(count)

### FIXED CODE ###

s = input()
n = len(s)
count = 0
for i in range(n//2):
  if s[i] != s[n - 1 - i]:
    count += 1 
print(count)
from collections import defaultdict
import sys
def inpl(): return [int(i) for i in input().split()]
H, W, N = inpl()
if not N:
    print(W)
    sys.exit()
A = []
B = defaultdict(lambda: [])
C = defaultdict(lambda: W)
for _ in range(N):
    x, y = inpl()
    A.append((x,y))
    B[y].append(x)
T = [0]*(H+1)
T[1] = 2
for i in range(1,H):
    if not B[i+1]:
        T[i+1] = min(W,T[i] + 1)
        continue
    ctr = T[i]
    while True:
        if ctr in B[i+1]:
            ctr += 1
            continue
        break
    T[i+1] = min(ctr+1, W)
for x,y in A:
    if x >= T[y]:
        C[y] = min(C[y], x)
print(min([i-1 for i in C.values()]+[W]))

### FIXED CODE ###

from collections import defaultdict
import sys
def inpl(): return [int(i) for i in input().split()]
H, W, N = inpl()
if not N:
    print(H)
    sys.exit()
A = []
B = defaultdict(lambda: [])
C = defaultdict(lambda: H+1)
for _ in range(N):
    x, y = inpl()
    A.append((x,y))
    B[y].append(x)
T = [0]*(W+1)
T[1] = 2
for i in range(1,W):
    if not B[i+1]:
        T[i+1] = T[i] + 1
        continue
    ctr = T[i]
    while True:
        if ctr in B[i+1]:
            ctr += 1
            continue
        break
    T[i+1] = min(ctr+1, H+1)
for x,y in A:
    if x >= T[y]:
        C[y] = min(C[y], x)
print(min([i-1 for i in C.values()]+[H]))
from collections import deque
n, m = map(int, input().split())
A = [0] * m
B = [0] * m
for i in range(m):
    A[i], B[i] = map(int, input().split())

next_queue = deque()
sign = [-1] * n

next_queue.append(1)

while next_queue:
    current_number = next_queue.popleft()
    for i, _ in reversed(list(enumerate(A))):
        if A[i] == current_number:
            if sign[B[i] - 1] == -1:
                sign[B[i] - 1] = current_number
                if B[i] != 1:
                    next_queue.append(B[i])
                A.pop(i)
                B.pop(i)
        if B[i] == current_number:
            if sign[A[i] - 1] == -1:
                sign[A[i] - 1] = current_number
                if A[i] != 1:
                    next_queue.append(A[i])
                A.pop(i)
                B.pop(i)
print("Yes")
for i in range(1, n):
    print(sign[i])




### FIXED CODE ###

from collections import deque
n, m = map(int, input().split())
route = [[] for i in range(n)]

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

next_queue = deque()
sign = [-1 for i in range(n)]
sign[0] = 999

next_queue.append(0)

while next_queue:
    current_number = next_queue.popleft()
    for room in route[current_number]:
        if sign[room] == -1:
            sign[room] = current_number
            next_queue.append(room)
print("Yes")
for i in range(1, n):
    print(sign[i] + 1)
H,W,M = map(int,input().split())
P = [0]*(H+1)
Q = [0]*(M+1)
A = [[0 for j in range(W+1)] for i in range(H+1)]
for k in range(M):
  a,b = map(int,input().split())
  P[a] += 1
  Q[b] += 1
  A[a][b] = 1
Pmax = max(P)
Qmax = max(Q)
ans = Pmax+Qmax-1
Pindex = [i for i, v in enumerate(P) if v == Pmax]
Qindex = [i for i, v in enumerate(Q) if v == Qmax]
key = 0
for x in Pindex:
  for y in Qindex:
    if A[x][y] == 0:
      ans += 1
      key = 1
      break
  if key == 1:
    break
print(ans)

### FIXED CODE ###

H,W,M = map(int,input().split())
P = [0]*(H+1)
Q = [0]*(W+1)
A = set()
for k in range(M):
    a,b = map(int,input().split())
    P[a] += 1
    Q[b] += 1
    A.add((a,b))
Pmax = max(P)
Qmax = max(Q)
Pindex = []
Qindex = []
for i in range(H+1):
    if P[i] == Pmax:
        Pindex.append(i)
for i in range(W+1):
    if Q[i] == Qmax:
        Qindex.append(i)
ans = Pmax+Qmax-1
key = 0
for x in Pindex:
  for y in Qindex:
    if (x,y) not in A:
      ans += 1
      key = 1
      break
  if key == 1:
    break
print(ans)
N = int(input())
A = map(int, input().split())
 
L = [abs((N-1) - 2*i) for i in range(N)]
 
L.sort(); A.sort()
 
print(pow(2, (N-N%2)//2, 10**9+7) if L == A else 0)

### FIXED CODE ###

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

L = [abs((N-1) - 2*i) for i in range(N)]

L.sort(); A.sort()

print(pow(2, (N-N%2)//2, 10**9+7) if L == A else 0)
while True:
	a,b=sort(map(int(input().split())))
	break if ((a==0) and (b==0))
	print(a,b)


### FIXED CODE ###

while True:
	a,b=map(int,input().split())
	if (a==0) and (b==0):
		break
	if a > b :
		a,b = b,a
	print(a,b)
class TreeNode:
    def __init__(self):
        self.val = 0
        self.vertex = []


def make_trees(n, A, B):
    trees = []
    for i in range(n):
        trees.append(TreeNode())
    for i in range(len(A)):
        a = A[i]-1
        b = B[i]-1
        trees[a].vertex.append(b)
    return trees

def dfs(node: TreeNode, carry: int, trees):
    if node:
        node.val += carry
        for i in node.vertex:
            dfs(trees[i], node.val, trees)

def dfs2(carry, i, trees, values):
    values[i] += carry
    for j in trees[i]:
        dfs2(values[i], j, trees, values)

def sol(n, q, A, B, P, X):
    trees = make_trees(n, A, B)
    for i in range(len(P)):
        p = P[i]-1
        x = X[i]
        t = trees[p]
        # dfs, give point x
        t.val += x
    # accmulative run
    dfs(trees[0], 0, trees)
    #
    return " ".join([str(t.val) for t in trees])
    #return n, q, A, B, P, X



do_submit = True
#do_submit = False

def input_parse(input_str):
    lines = [x.strip() for x in input_str.split("\n") if x.strip()]
    parsed_lines = [list(map(str, line.split())) for line in lines]
    print(parsed_lines)
    n = int(parsed_lines[0][0])
    q = int(parsed_lines[0][1])
    A = []
    B = []
    P = []
    X = []
    for i in range(1, n-1+1):
        a = int(parsed_lines[i][0])
        b = int(parsed_lines[i][1])
        A.append(a)
        B.append(b)
    for i in range(n, 1+n+q-1):
        p = int(parsed_lines[i][0])
        x = int(parsed_lines[i][1])
        P.append(p)
        X.append(x)

    # S = parsed_lines[1][0]
    # return n, k, S
    return n, q, A, B, P, X


if not do_submit:
    n, q, A, B, P, X = input_parse("""
    4 3
    1 2
    2 3
    2 4
    2 10
    1 100
    3 1
    """)
    print(sol(n, q, A, B, P, X))

    n, q, A, B, P, X = input_parse("""
        6 2
        1 2
        1 3
        2 4
        3 6
        2 5
        1 10
        1 10
    """)
    print(sol(n, q, A, B, P, X))

    n, q, A, B, P, X = input_parse("""
        10 5
        1 2
        1 3
        1 4
        2 5
        2 6
        3 7
        4 8
        4 9
        7 10
        7 3
        3 100
        1 2
        5 10
        4 11
    """)
    print(sol(n, q, A, B, P, X))

else:
    n, q = list(map(int, input().split()))
    trees =  [ [] for i in range(n) ]
    values = [ 0 for i in range(n) ]
    for i in range(n-1):
        a, b = list(map(int, input().split()))
        trees[a-1].append(b-1)
    for i in range(q):
        p, x = list(map(int, input().split()))
        # dfs, give point x
        values[p-1] = values[p-1] + x
    # accmulative run
    dfs2(0, 0, trees, values)
    #
    print(values)


### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
n, q = map(int, input().split())
 
ki = [[] for i in range(n + 1)]
for i in range(n - 1):
    a, b = map(int, input().split())
    ki[a].append(b)
    ki[b].append(a)
# print(ki)
 
cnt = [0] * (n + 1)
for i in range(q):
    p, x = map(int, input().split())
    cnt[p] += x
 
 
# print(cnt)
 
 
def d(y, parent):
    for i in ki[y]:
        if i == parent:
            continue
        cnt[i] += cnt[y]
        d(i, y)
 
 
d(1, -1)
print(*cnt[1:])
N,A,B=input().split()
ANS=int(N)//(int(A)+int(B))
ANS=ANS*int(A)
if((int(N)%(int(A)+int(B))<=int(A)):
   ANS=ANS+(int(N)%(int(A)+int(B)))
else:
   ANS=ANS+int(A)
print(ANS)

### FIXED CODE ###

N,A,B=input().split()
ANS=int(N)//(int(A)+int(B))
ANS=ANS*int(A)
if(int(N)%(int(A)+int(B))<=int(A)):
   ANS=ANS+(int(N)%(int(A)+int(B)))
else:
   ANS=ANS+int(A)
print(ANS)
import sys
input = sys.stdin.readline
import math
import numpy as np
def print_ans(A, B):
    """Test Case
    >>> print_ans(2, 3)
    6
    >>> print_ans(123, 456)
    18696
    >>> print_ans(100000, 99999)
    9999900000
    """
    def lcm(a, b):
        g = math.gcd(a, b)
        c = a * b
        return c//g
    print(lcm(A, B))
if __name__ == '__main__':
    A, B = map(int, input().rstrip().split())
    print_ans(A, B)


### FIXED CODE ###

import sys
input = sys.stdin.readline
def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a
def print_ans(A, B):
    """Test Case
    >>> print_ans(2, 3)
    6
    >>> print_ans(123, 456)
    18696
    >>> print_ans(100000, 99999)
    9999900000
    """
    print(A * B // gcd(A, B))
if __name__ == '__main__':
    # test
    A, B = map(int, input().rstrip().split())
    print_ans(A, B)
n=int(input())
a=list(map(int,input().split()))
m=int(input())
sum_a=sum(a)
for i in range(m):
  s,t=map(int,input().split())
  print(sum_a+t-a[s])

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
m=int(input())
sum_a=sum(a)
for i in range(m):
  s,t=map(int,input().split())
  print(sum_a+t-a[s-1])
N = int(input())
a = list(map(int,input().split()))
Q = int(input())
bc = [[int(i) for i in input().split()] for j in range(Q)]

counter = [0] * 100000
for i in a:
    counter[i] += 1

ans = sum(a)

for _ in bc:
    ans = ans + counter[_[0]] * _[1] - counter[_[0]] * _[0]
    counter[_[1]] += counter[_[0]]
    counter[_[0]] = 0
    print(ans)


### FIXED CODE ###

N = int(input())
a = list(map(int,input().split()))
Q = int(input())
bc = [[int(i) for i in input().split()] for j in range(Q)]
 
counter = [0] * 1000000
for i in a:
    counter[i] += 1

ans = sum(a)
 
for _ in bc:
    ans = ans + counter[_[0]] * _[1] - counter[_[0]] * _[0]
    counter[_[1]] += counter[_[0]]
    counter[_[0]] = 0
    print(ans)
N,M,C = map(int,input().split())
B = [int(x) for x in input().split()]

count = 0
for i in range(N):
  temp = [int(x) for x in input().split()]
  total = [B[i]*temp[i] for i in range(M)]
  if(total > 0 ):
    count+=1
  
  


### FIXED CODE ###

N,M,C = map(int,input().split())
B = [int(x) for x in input().split()]
 
count = 0
for i in range(N):
  temp = [int(x) for x in input().split()]
  total = [B[i]*temp[i] for i in range(M)]
  if((sum(total) + C) > 0 ):
    count+=1
print(count)
N,M = map(int,input().split())
s = [list(map(int,input().split()[1:])) for _ in range(M)]
p = list(map(int,input().split()))
ret = 0
for b in range(1 << N):
    if all(sum((b >> (i-1))) & 1 for i in s[j] % 2 == p[j] for j in range(M)):
        ret += 1
print(ret)

### FIXED CODE ###

import sys
import math
from collections import deque
import itertools
import copy
import bisect

MOD = 10 ** 9 + 7
INF = 10 ** 18 + 7
input = lambda: sys.stdin.readline().strip()
ans = 0
N, M = map(int, input().split())
ks = [tuple(map(int, input().split())) for _ in range(M)]
p = list(map(int, input().split()))
t = []
for i in range(N):
    tt = list(itertools.combinations(range(1, N+1), i+1))
    for l in tt:
        t.append(l)
t.append(tuple())
for i in range(len(t)):
    pp = 0
    for l in range(M):
        if len(set(ks[l][1:]) & set(t[i])) % 2 == p[l]:
            pp += 1
    if pp == M:
        ans += 1
print(ans)
n = input()
if n%9==0:
  print('Yes')
else:
  print('No')


### FIXED CODE ###

n = int(input())
if n%9==0:
  print('Yes')
else:
  print('No')
a, b = map(int, input().split())
print(max(a+b, a-b, a*b)

### FIXED CODE ###

a, b = map(int, input().split())
print(max(a+b, a-b, a*b))
from itertools import accumulate

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

A.sort(reverse=True)
d = [0] * (A[0] * 2 + 1)
for i in range(N):
    d[A[i]] += 1
d = list(accumulate(d[::-1]))[::-1]
b = list(accumulate(A))

left = 0
right = A[0] * 2 + 1
while right - left > 1:
    mid = (left + right) // 2
    m = 0
    for i in range(N):
        m += d[max(0, mid - A[i])]
    if m >= M:
        left = mid
    else:
        right = mid

ans = 0
m = 0
for i in range(N):
    t = min(d[max(0, left - A[i])], M - m)
    ans += b[t] + A[i] * t
    m += t
print(ans)


### FIXED CODE ###

from itertools import accumulate

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

A.sort(reverse=True)
d = [0] * (A[0] * 2 + 1)
for i in range(N):
    d[A[i]] += 1
d = list(accumulate(d[::-1]))[::-1]
S = list(accumulate([0] + A))

left = 0
right = A[0] * 2 + 1
while right - left > 1:
    mid = (left + right) // 2
    m = 0
    for i in range(N):
        m += d[max(0, mid - A[i])]
    if m >= M:
        left = mid
    else:
        right = mid

ans = 0
m = 0
for i in range(N):
    t = min(d[max(0, right - A[i])], M - m)
    ans += S[t] + A[i] * t
    m += t
ans += left * (M - m)
print(ans)
s = input()

l=['K','I','H','B','R']
i=0
ans="YES"
seq=False
for c in s:
	if i<len(l) and c=="A":
		if not seq:
			seq=True
			continue
		else:
			ans="NO"
			break
	else:
                seq=False
		if i<len(l) and c==l[i]:
			i+=1
		else:
			ans="NO"
			break
print(ans)


### FIXED CODE ###

s = input()

r = "AKIHABARA"
r2 = "KIHBR"
ans = "YES"
if not 5 <= len(s) <= len(r):
    ans = "NO"
if "AA" in s:
    ans = "NO"
if not "KIH" in s:
    ans = "NO"
else:
    rem_A = ""
    for c in s:
        if c != "A":
            rem_A += c
    if not rem_A == r2:
        ans = "NO"
print(ans)
import sys

N, s = sys.stdin.read().split('\n')

red_hat_counter = 0
blue_hat_counter = 0

for s_char in s:
  if s_char == "R":
    red_hat_counter += 1
  else:
    blue_hat_counter += 1

if red_hat_counter > blue_hat_counter :
  print("Yes")
else:
  print("No")

### FIXED CODE ###

import sys
input_list = sys.stdin.readlines() 
N, s = map(str.strip, input_list)
red_hat_counter = 0
for s_str in s:
  if s_str == "R":
    red_hat_counter += 1
if red_hat_counter > (int(N)/2):
  print "Yes"
else:
  print "No"
s = input()
if s[2] == s[3] and s[4] == s[5]:
  print('Yes')
else:
  print('No)

### FIXED CODE ###

s = input()
if s[2] == s[3] and s[4] == s[5]:
  print('Yes')
else:
  print('No')
def main():

    N = int(input())
    if 0 > N or N > 100:
        print("input N error")
        exit()
        
    a = []
    for i in range(N):
        b = input().split()
        if len(b[0]) > 10 or len(b[0]) < 1:
            print("input S error")
            exit()

        if int(b[1]) < 0 or int(b[1]) > 100:
            print("input P error")
            exit()

        b.append(i + 1)
        a.append(b)
        
    a.sort()
    c = []
    answer = []
    
    for i in range(len(a) - 1):
        c.append(a[i])
        
        if a[i][0] != a[i+1][0] and i != len(a) - 2:
            c.sort(key=lambda x: int(x[1]), reverse=True)
            answer += c
            c = []

        elif a[i][0] != a[i+1][0] and i == len(a) - 2:
            c.sort(key=lambda x: int(x[1]), reverse=True)
            answer += c
            answer += a[i + 1]

        elif a[i][0] == a[i+1][0] and i == len(a) - 2:
            c.append(a[i + 1])
            c.sort(key=lambda x: int(x[1]), reverse=True)
            answer += c
            break
            
    for i in range(len(answer)):
        print(answer[i][2])
        
        
if __name__ == '__main__':

    main()

    


### FIXED CODE ###

def main():

    N = int(input())
    if 0 > N or N > 100:
        print("input N error")
        exit()
        
    answer = []
    for i in range(N):
        s, p = input().split()
        answer.append([s, -int(p), i+1])

    answer.sort()
    for i in range(len(answer)):
        print(answer[i][2])
        
        
if __name__ == '__main__':

    main()
n,M = list(map(int,input().split()))
m = [[0]*n for _ in range(M)]
dp = [0]*n

for _ in range(M):
  a,b = list(map(int,input().split()))
  m[a-1][b-1] = 1
  m[b-1][a-1] = 1

from collections import deque
que = deque()
for i in range(n):
  if m[0][i] == 1:
    que.append(i)
    dp[i] = 1

while que:
  c = que.popleft()
  for i in range(n):
    cn = dp[c]
    if m[c][i] == 1 and dp[i] == 0 :
      dp[i] = c+1
      que.append(i)
      if cn == 1 and i == 0:dp[0] = 0

for i in range(1,n):
  if dp[i] == 0:exit(print('No'))


print('Yes')
for i in range(1,n):
  print(dp[i])



### FIXED CODE ###

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

m = [[] for _ in range(n)]
dp = [0]*n
from collections import deque
que = deque()
for _ in range(M):
  a,b = map(int,input().split())
  a -= 1
  b -= 1
  m[a].append(b)
  m[b].append(a)
  if a == 0:
    que.append(b)
    dp[b] = 1
  if b == 0:
    que.append(a)
    dp[a] = 1

while que:
  c = que.popleft()
  for i in m[c]:
    if dp[i] == 0 :
      dp[i] = c+1
      que.append(i)

#[exit(print('No')) for i in range(1,n)  if dp[i] == 0]

print('Yes')
[print(dp[i]) for i in range(1,n)]