Harryxun/stf_run huggingface dataset:
a= list(map(int, input().split()))
if a[0]<10:
	print(a[1]-100*(10-a[0])
else:
	print(a[1])

### FIXED CODE ###

a = list(map(int, input().split()))
if a[0]< 10:
    print (a[1]+100*(10-a[0]))
else:
    print (a[1])
import math
from functools import reduce

n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
print(reduce(math.gcd, a))

### FIXED CODE ###

import fractions
from functools import reduce

n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
print(reduce(fractions.gcd, a))
n=input()
print(n*n*n)

### FIXED CODE ###

n=int(input())
print(n*n*n)
a=int(input())
b=int(input())
c=a*b
d=2*a+2*b
print"c d

### FIXED CODE ###

a,b = map(int, raw_input().split())
c = a*b
d = 2*(a+b)
print'%d %d'%(c,d)
W, H, r, x ,y = list(map(int,input().split()))
if 0 <= x - r <= x + r = W and 0 <= y - r <= y + r = H:
 print('yes')
else:
 print('no')

### FIXED CODE ###

W, H, x, y, r = list(map(int, input().split()))
print('Yes' if 0 <= x - r <= x + r <= W and 0 <= y - r <= y + r <= H else 'No')
N, T = map(int, input().split())
A = []
B = []
for i in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
    i += 1
if T >= min(B):
    for j in range(len(A)-1):
        if B[j] > T:
            A.pop(j)
            B.pop(j)
        else:
            pass
    print(min(A))
else:
    print("TLE")

### FIXED CODE ###

N, T = map(int, input().split())
ans = "TLE"
x = 1001
for i in range(N):
    c, t = map(int, input().split())
    if c <= x and t <= T:
        x = c
        ans = c
    else:
        pass
print(ans)
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())

if(A+V*T>=B+W*T):
    print("YES")
elif(A>=B):
    print("YES")
else:
    print("NO")

### FIXED CODE ###

S = input()
print(S[:3])
from bisect import insort

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

#print(a)
for i in range(m):
    a.sort()
    b,c = map(int,input().split())

    for j in range(b+1):        
        if a[j] < c:
            a.remove(a[j])
            insort(a,c)

sum = 0
for v in a:
    sum += v

print(sum)

### FIXED CODE ###

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

d = []

bc = []
for i in range(m):
    b,c = map(int,input().split())
    bc.append([b,c])

bc = sorted(bc,key=lambda x:x[1],reverse=True)

for elm in bc:
    for i in range(elm[0]):
        d.append(elm[1])
        if len(d) >= n:
            break
    if len(d) >= n:
        break

d.sort()
d.reverse()

#print(a)
#print(d)

sum = 0
ln = len(d)
for i in range(n):
    if i < ln:
        if a[i] < d[i]:
            sum += d[i]
        else:
            sum += a[i]
    else:
        sum += a[i]

print(sum)
import sys
input = sys.stdin.readline
n = int(input())
vw = [[0,0]]+[list(map(int,input().split())) for i in range(n)]
q = int(input())
query = [list(map(int,input().split())) for i in range(q)]
border = 10
knapls = [[] for i in range(2**border)]
knapls[0].append((0,0))
for i in range(1,2**border):
  ls = []
  if i > n:
    break
  ls.extend(knapls[i//2])
  v,w = vw[i]
  l = len(ls)
  for j in range(l):
    vp,wp = ls[j]
    if wp+w > 10**5:
      continue
    ls.append((vp+v,wp+w))
  ls.sort(key = lambda x:x[1])
  knapls[i].append((0,0))

  for j in range(len(ls)):
    vn,wn = ls[j]
    vp,wp = knapls[i][-1]
    if wp <= wn and vp >= vn:
      continue
    knapls[i].append(ls[j])
for v,L in query:
  if v >= 2**border:
    anc = v
    ls = [(0,0)]
    while anc >= 2**border:
      vn,wn = vw[anc]
      l = len(ls)
      for i in range(l):
        vp,wp = ls[i]
        if wp+wn > L:
          continue
        ls.append((vp+vn,wp+wn))
      anc //= 2
    ans = 0
    l = len(ls)
    for i in range(l):
      vn,wn = ls[i]
      rest = L-wn
      left = 0
      right = len(knapls[anc])
      while left+1 < right:
        mid = (left+right)//2
        if knapls[anc][mid][1] > rest:
          right = mid
        else:
          left = mid
      ans = max(knapls[anc][left][0]+vn,ans)
    print(ans)
  else:
    ans = 0
    left = 0
    right = len(knapls[v])
    while left+1 < right:
      mid = (left+right)//2
      if knapls[v][mid][1] > L:
        right = mid
      else:
        left = mid
    ans = knapls[v][left][0]
    print(ans)

### FIXED CODE ###

s = input()
print(s[:3])
n,m = map(int,input().split())
if m ==0:
    print(0,0)
    exit()
p = [0] * m 
s = [0] * m
w_count = 0
a_count = 0

for i in range(m):
    p[i],s[i] = input().split()

p = sorted(set(p))
i = int(p[0])
j = 0

while i != int(p[-1]) + 1:
    if s[j] == 'WA':
        w_count += 1
    elif s[j] == 'AC':
        a_count += 1
        i += 1
    j += 1

print(a_count,w_count)

        


### FIXED CODE ###

n, m = map(int,input().split())
a = [input().split() for i in range(m)]
p = [int(i[0]) for i in a]
q = [j[1] for j in a]

ac = 0
wa = 0
wa_c = [0] * n
ac_c = [False] * n

for t in range(m):
    if ac_c[p[t]-1]:
        continue
    if q[t] == 'AC':
        ac += 1
        ac_c[p[t]-1] = True
        wa += wa_c[p[t]-1]
    else:
        wa_c[p[t]-1] += 1
print(ac,wa)
def submit():
    a, b = map(int, input().split())
    s = min(a, b)
    l = max(a, b)

    # 公約数を求める
    divisors = []
    for x in range(2, math.ceil(math.sqrt(s)) + 1):
        if x >= s:
            break

        if s % x == 0 and l % x == 0:
            divisors.append(x)
    if l % s == 0:
        divisors.append(s)

    # ふるいにかけて素数のみ数える
    ans = 0
    lst = divisors[-1]
    unprime = set()
    for d in divisors:
        if d == 1:
            continue 

        if d not in unprime:
            ans += 1
            c = 2*d
            while c <= lst:
                unprime.add(c)
                c += d
    print(ans + 1)

        
if __name__ == "__main__":
    submit()    

### FIXED CODE ###


import math


def gcd(x, y):
    if y == 0:
        return x
    return gcd(y, x % y)


def prime_fact(x):
    prime_pow = {}
    check_ceil = math.ceil(math.sqrt(x))
    for p in range(2, check_ceil + 1):
        p_cnt = 0
        while x % p == 0:
            x //= p
            p_cnt += 1
        if p_cnt:
            prime_pow[p] = p_cnt
    if x > 1:
        prime_pow[x] = 1
    return prime_pow


def submit():
    a, b = map(int, input().split())
    g = gcd(a, b)
    # gcdの素因数分解して素因数の数を求める
    p = prime_fact(g)
    print(len(p) + 1)


if __name__ == "__main__":
    submit()
M, K = map(int, input().split())
try:
    assert M <= 17
except:
    print(-1)
    exit()
tmp = 0
X = list(range(K)) + list(range(K+1, 2**M))

if M == 1:
    if K == 0:
        print("1 1 0 0")
    else:
        print(-1)
elif 2**M > K:
    ans = " ".join(map(str, X + [K] + X[::-1] + [K]))
    print(ans)
else:
    print(-1)

### FIXED CODE ###

M, K = map(int, input().split())

if M == 1:
    if K == 0:
        print("1 1 0 0")
    else:
        print(-1)
elif 2**M > K:
    X = list(range(K)) + list(range(K+1, 2**M))
    ans = " ".join(map(str, X + [K] + X[::-1] + [K]))
    print(ans)
else:
    print(-1)
n=input()

if n[-1]!='s':

	print(n+'s')elif n[-1]=='s':

	print(n+'es')

### FIXED CODE ###

n=input()
if n[-1]!='s':
	print(n+'s')
elif n[-1]=='s':
	print(n+'es')
x, n = map(int, input().split())
lst = [int(input()) for _ in range(n)]
a = 100
b = 0

for i in range(1, 102):
  if i in lst:
    continue

  if a > abs(x-i):
    a = abs(x-i)
    b = i

print(i)

### FIXED CODE ###

x, n = map(int, input().split())
lst = []
if n > 0:
  lst = list(map(int, input().split()))
a = 100
b = 0

for i in range(0, 102):
  if i in lst:
    continue

  if a > abs(x-i):
    a = abs(x-i)
    b = i

print(b)
N, T = map(int, input().split())
t = list(map(int, input().split()))

lst = [0]*(t[N-1]+T)

for i in range(N):
    for j in range(T):
        lst[t[i]+j] += 1

ans = len(lst) - lst.count(0)
print(ans)


### FIXED CODE ###

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

ans = T

for i in range(N-1):
    if t[i+1] - t[i] >= T:
        ans += T
    else: # t[i+1]-t[i]<T
        ans += t[i+1] - t[i]

print(ans)
from itertools import combinations
def dis(xi, xj, yi, yj):
    return abs(xi - xj) + abs(yi - yj)
n = int(input())
coords = []
grids = [(i, j) for i in range(101) for j in range(101)]
grids_set = set(grids)
for i in range(n):
    coords.append(tuple(map(int, input().split())))
xr, yr, hr = coords[0]
for i, j in combinations(coords, 2):
    xi, yi, hi = i
    xj, yj, hj = j
    for grid in grids:
        x, y = grid
        if dis(xi, x, yi, y) + hi != dis(xj, x, yj, y) + hj:
            grids_set.remove(grid)
    grids = list(grids_set)
x, y = grids[0]
print(x, y, dis(x, xr, y, yr)+hr)


### FIXED CODE ###

def dis(xi, xj, yi, yj):
    return abs(xi - xj) + abs(yi - yj)
n = int(input())
coords = [tuple(map(int, input().split())) for _ in range(n)]
grids = [(i, j) for i in range(101) for j in range(101)]
for x, y, h in coords:
    if h > 0:
        break    
for xj, yj in grids:
    flag = True
    base = dis(x, xj, y, yj) + h
    for xi, yi, hi in coords:
        if hi != max(base-abs(xi-xj)-abs(yi-yj), 0):
            flag = False
    if flag:
        break
print(xj, yj, dis(x, xj, y, yj) + h)
X = int(input())

max = 1
for i in range(1,X+1):
    for j in range(2,i+1):
        for k in range(2,j+1):
            if j ** k == i:
                max = i
            if j ** k > i:
                break

print(max)


### FIXED CODE ###

input_lines = input().split()
a = int(input_lines[0])
b = int(input_lines[1])
c = int(input_lines[2])
d = int(input_lines[3])

flag = 0
if abs(c - a) > d:
    if abs(b - a) > d or abs(c - b) > d:
        flag = 1

if flag == 0:
    print("Yes")
else:
    print("No")
a, b = int(input())
if a<8 and b< 8:
  print("Yay!")
else:
  print(":(")

### FIXED CODE ###

a, b = list(map(int, input().rstrip().split()))
if a<= 8 and b <= 8:
    print("Yay!")
else:
    print(":(")
from functools import lru_cache
import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__
# do magic here
n = int(input())
heights = [int(x) for x in input().split()]

MAX = 10000000

@lru_cache(MAX)
def solve(x):
    if x==0:
        return 0
    if x < 0:
        return MAX
    a = abs(heights[x-1] - heights[x]) + solve(x-1)
    b = abs(heights[x-2] - heights[x]) + solve(x-2)
    return min(a,b)

print(solve(n-1))


### FIXED CODE ###

n = int(input())
h = [int(x) for x in input().split()]

def abs(x):
    if x >= 0:
        return x
    return -x

c = [0]
c.append(abs(h[1] - h[0]))
for k in range(2, n):
    cnext = min(c[k-2] + abs(h[k]-h[k-2]), c[k-1] + abs(h[k] - h[k-1]))
    c.append(cnext)

print(c[-1])
H,N = map(int,input().split())
Magic =[]
A =[]
E =[]
for i in range(N):
    a,b = map(int,input().split())
    Magic.append((a,b))
    A.append(a)
    E.append(a/b)
MAX_A = H+max(A)
E_MIN = min(E)
WORST = int(MAX_A/E_MIN) +2
#print(Magic)
#print(MAX_A)
#print(WORST)
DP = [[WORST] * (MAX_A+1) for i in range(N)]
for i in range(N):
    if i == 0:
        for j in range(1,MAX_A//Magic[0][0]+1):
            DP[0][j*Magic[0][0]] = Magic[0][1]*j
    else:
        for j in range(1,(MAX_A+1)):
#            KARI = []
            DP[i][j]=DP[i-1][j]
            if j % Magic[i][0] == 0:
                DP[i][j]=min(DP[i][j],((j//Magic[i][0]) * Magic[i][1]))
            r = j // Magic[i][0]
            for k in range(r):
                DP[i][j]=min(DP[i][j],(DP[i-1][j-k*Magic[i][0]]+k*Magic[i][1]))
print(min(DP[N-1][H:MAX_A]))

                
            
        


### FIXED CODE ###

H,A = map(int,input().split())
X = int(H // A)
if (H%A)!=0:
    X += 1
print(X)
S = input()

a = len(S) / 2
x = 0

if b == 0:
  for i in range(1, int(a+1)):
    if S[i-1]!=S[-i]:
      x += 1
else:
  for i in range(1, int(a+1)):
    if S[i-1]!=S[-i]:
      x += 1

print(x)

### FIXED CODE ###

S = input()

a = len(S) / 2
b = len(S) % 2
x = 0

if b == 0:
  for i in range(1, int(a+1)):
    if S[i-1]!=S[-i]:
      x += 1
else:
  for i in range(1, int(a+1)):
    if S[i-1]!=S[-i]:
      x += 1

print(x)
alphabet = [0]*26
i = 0;
for j in range(97,123):
	alphabet[i] = chr(j)
	i += 1
al_count = [0]*26
while True :
	words = raw_input().lower().split()
	for k in words :
		for l in list(k):
			if l=='a':
				al_count[0] += 1
			elif l=='b':
				al_count[1] += 1
			elif l=='c':
				al_count[2]+=1	
			elif l=='d':
				al_count[3] += 1
			elif l=='e':
				al_count[4]+=1
			elif l=='f':
				al_count[5] += 1
			elif l=='g':
				al_count[6]+=1
			elif l=='h':
				al_count[7] += 1
			elif l=='i':
				al_count[8]+=1
			elif l=='j':
				al_count[9] += 1
			elif l=='k':
				al_count[10]+=1	
			elif l=='l':
				al_count[11] += 1
			elif l=='m':
				al_count[12]+=1	
			elif l=='n':
				al_count[13] += 1
			elif l=='o':
				al_count[14]+=1
			elif l=='p':
				al_count[15] += 1
			elif l=='q':
				al_count[16]+=1
			elif l=='r':
				al_count[17] += 1
			elif l=='s':
				al_count[18]+=1
			elif l=='t':
				al_count[19] += 1
			elif l=='u':
				al_count[20]+=1
			elif l=='v':
				al_count[21]+=1
			elif l=='w':
				al_count[22] += 1
			elif l=='x':
				al_count[23]+=1
			elif l=='y':
				al_count[24] += 1
			elif l=='z':
				al_count[25]+=1
	if list(words[-1])[-1]=='.':
		break
for i in range(26):
	print '%c : %d' %(alphabet[i],al_count[i])

### FIXED CODE ###


alphabet = [0]*26
i = 0;
for j in range(97,123):
	alphabet[i] = chr(j)
	i += 1
al_count = [0]*26
while True :
	try :
		words = raw_input().lower().split()
		for k in words :
			for l in list(k):
				if l=='a':
					al_count[0] += 1
				elif l=='b':
					al_count[1] += 1
				elif l=='c':
					al_count[2]+=1	
				elif l=='d':
					al_count[3] += 1
				elif l=='e':
					al_count[4]+=1
				elif l=='f':
					al_count[5] += 1
				elif l=='g':
					al_count[6]+=1
				elif l=='h':
					al_count[7] += 1
				elif l=='i':
					al_count[8]+=1
				elif l=='j':
					al_count[9] += 1
				elif l=='k':
					al_count[10]+=1	
				elif l=='l':
					al_count[11] += 1
				elif l=='m':
					al_count[12]+=1	
				elif l=='n':
					al_count[13] += 1
				elif l=='o':
					al_count[14]+=1
				elif l=='p':
					al_count[15] += 1
				elif l=='q':
					al_count[16]+=1
				elif l=='r':
					al_count[17] += 1
				elif l=='s':
					al_count[18]+=1
				elif l=='t':
					al_count[19] += 1
				elif l=='u':
					al_count[20]+=1
				elif l=='v':
					al_count[21]+=1
				elif l=='w':
					al_count[22] += 1
				elif l=='x':
					al_count[23]+=1
				elif l=='y':
					al_count[24] += 1
				elif l=='z':
					al_count[25]+=1
	except :
		break
for i in range(26):
	print '%c : %d' %(alphabet[i],al_count[i])
n, k = map(int, input().split())

d = [0] * n
a = []
snuk = [False] * n
for i in range(k):
    d[i] = int(input())
    a = list(map(int, input().split()))
    for j in a:
        snuk[j - 1] = True
    

ans = 0
for i in range(n):
    if snuk[i] == False:
        ans += 1


print(ans)

### FIXED CODE ###

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

d = [0] * k
a = []
snuk = [False] * n
for i in range(k):
    d[i] = int(input())
    a = list(map(int, input().split()))
    for j in a:
        snuk[j - 1] = True
    

ans = 0
for i in range(n):
    if snuk[i] == False:
        ans += 1


print(ans)
a,b,c = map(raw_input().split())
d,e,f = map(raw_input().split())
if a==f and b==e and c==d :
	print "YES" 
else :
	print "NO"

### FIXED CODE ###

a = raw_input()
b = raw_input()
if a[0]==b[2] and a[1]==b[1] and a[2]==b[0]:
	print 'YES' 
else:
	print 'NO'
N,M = map(int,input().split())

T = (1900*M)+(100*(N-M))
C = [pow(2,M),pow(2,M)-1]

if M==4: M_set[1]=3

ans = T*C[0]//C[1] if ans%C[1]==0 else T*C[0]
    
print(ans)

### FIXED CODE ###

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

T = (1900*M)+(100*(N-M))
C = [pow(2,M),pow(2,M)-1]

print(T*C[0])
for i in range(int(raw_input())):
    n = [int(x) for x in raw_input().split()]
    n.sort(reverse=True)
    if n[0]**2 == n[1]**2 + n[2]**2:
        print "

### FIXED CODE ###

for i in range(int(raw_input())):
    n = [int(x) for x in raw_input().split()]
    n.sort(reverse=True)
    if n[0]**2 == n[1]**2 + n[2]**2:
        print "YES"
    else:
        print "NO"
A,B,C,D=map(int,input().split())
print((A+B)//2)

### FIXED CODE ###

A,B=map(int,input().split())
if (A+B)%2!=0:
  print((A+B)//2+1)
else:
  print((A+B)//2)
n=int(input())
a=list(map(int,input().split()))
def ans(a,x):
  b=0
  c=a[:x]+a[x+1:]
  d=list(set(c))
  for i in range(len(d)):
    if c.count(d[i])>1:
      b=b+(c.count(d[i])*(c.count(d[i])-1))/2
      return b
for k in range(n):
  print(int(ans(a,k)))

### FIXED CODE ###

from collections import Counter
n=int(input())
a=list(map(int,input().split()))
s=Counter(a)
res=0
for i in s.values():
    res+=i*(i-1)//2
ans=0
for j in range(n):
    if s[a[j]]==1:
        print(res)
    else:
        ans=res-s[a[j]]+1
        print(ans)
n, x = map(int, input().split())
l = [int(i) for i in input().split()]
d = 0
i = 0
while (d <= x) and (i <= n):
    d += l[i]
    i += 1
print(i)

### FIXED CODE ###

n, x = map(int, input().split())
l = [int(i) for i in input().split()]
l.insert(0, 0)
d = 0
i = 0
while True:
    d += l[i]
    if d > x:
        break
    i += 1
    if i > n:
        break
print(i)
if S.isalpha()=True and 1<=len(S)<=10 and T.isalpha()=True:
  print("Yes")
  else:
    print("No")

### FIXED CODE ###

S=input()
T=input()
if S==T[:-1]:
  print("Yes")
else:
  print("No")
import heapq

n, m = [int(i) for i in input().split()]
inf = 10**10
path = [[0] * n for _ in range(n)]
Q = [[inf] * n for _ in range(n)]
ans = 0
pathnum = []
ctr = 0

for i in range(m):
    a, b, c = map(lambda x: int(x)-1 ,input().split())    
    path[a][b] = path[b][a] = c+1
    pathnum.append((a,b))

for i in range(n):
    decided = [False for _ in range(n)]
    H = []
    Q[i][i] = 0
    heapq.heappush(H,(0,i))
    while ctr != n:
        while True:
            k = heapq.heappop(H)
            k = k[1]
            if not decided[k]:
                decided[k] = True
                ctr += 1
                break
        for j in range(n):
            if path[k][j] == 0:
                continue
            if decided[j]:
                continue
            Q[i][j] = min(Q[i][k] + path[k][j], Q[i][j])
            heapq.heappush(H,(Q[i][j],j))

for i in pathnum:
    if Q[i[0]][i[1]] == inf:
        continue
    elif Q[i[0]][i[1]] != path[i[0]][i[1]]:
        ans += 1
print(ans)
    

### FIXED CODE ###

print(input().replace(',',' '))
a = input()
print("Yes" if a[0]=a[1]=a[2] or a[1]=a[2]=a[3] else "No")

### FIXED CODE ###

a = input()
print("Yes" if a[0]==a[1]==a[2] or a[1]==a[2]==a[3] else "No")
X = input()
print((X//500)*1000+((X-X//500)//5)*5)

### FIXED CODE ###

m = int(input())
print(1000*(m//500)+5*((m%500)//5))
a,b=map(int ,input().split())
x=int(pow(b,1/a))
x+=1
while x>=1:
    if b%(x**a)==0:
        print(x)
        exit()
    x-=1



### FIXED CODE ###

a,b=map(int ,input().split())
x=int(pow(b,1/a)+0.00001)
while x>=1:
    if b%(x**a)==0:
        print(x)
        exit()
    x-=1
import numpy as np

# N, K = map(int, input().split())
# # N, K = 3, 2
# di = np.zeros((K), dtype='int64')
# Ai = np.ones((N),  dtype='int8')

# for i in range(K):
#     di[i] = int(input())
#     Sunuke = map(int, input().split())
#     for s in Sunuke:
#         Ai[int(s)-1] = 0
        
# print (Ai.sum())
    
N, M = map(int, input().split())
Hi = list(map(int,input().split(" ")))
path = [list() for _ in range(M+1)]

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

goodT = 0
T = range(M+1)

for i, p in zip(T, path):
    good = 1
    if p == []:
        goodT += good
    else:
        for t in p:
            if Hi[i] <= Hi[t]:
                good = 0
        goodT +=good
        
print (goodT)
        

### FIXED CODE ###

N, M = map(int, input().split())
Hi = list(map(int,input().split(" ")))
#path = [list() for _ in range(M+1)]

Tallest = [0]*N

for i in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    Tallest[a] = max(Tallest[a], Hi[b])
    Tallest[b] = max(Tallest[b], Hi[a])

goodT = 0

for i in range(N):
    if Hi[i]>Tallest[i]:
        goodT +=1
    
print (goodT)
import sys
sys.setrecursionlimit(100000)

def dfs(v,s):
  score=s
  if v in dic_score:
    score+=dic_score[v]
    
  ans_list[v]+=score
  for vv in tree_list[v]:
    dfs(vv,score)

N,Q=map(int,input().split())

tree_list=[]
for i in range(N+1):
  tree_list.append([])

for i in range(N-1):
  a,b=map(int,input().split())
  tree_list[a].append(b)
  
dic_score={}
for i in range(Q):
  p,x=map(int,input().split())
  if p in dic_score:
    dic_score[p]+=x
  else:
    dic_score[p]=x

#print(tree_list)
ans_list=[0]*(N+1)

dfs(1,0)
#print(ans_list)

ans_list_str=[]
for i in range(1,N+1):
  ans_list_str.append(str(ans_list[i]))

print(" ".join(ans_list_str))

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**9)
input=sys.stdin.readline

def dfs(u,par):
  ans_list[u]+=ans_list[par]  
  for v in tree_list[u]:
    if v!=par:
      dfs(v,u)      
  return

N,Q=map(int,input().split())

tree_list=[[] for _ in range(N+1)]
for i in range(N-1):
  a,b=map(int,input().split())
  tree_list[a].append(b)
  tree_list[b].append(a)
#print(tree_list)

ans_list=[0]*(N+1)
for i in range(Q):
  p,x=map(int,input().split())
  ans_list[p]+=x

dfs(1,0)

print(*ans_list[1:])
# encoding: utf-8


import sys


def solve(a, b, h):
    return (a + b) * h / 2.


def main():
    a = sys.stdin.readline().rstrip()
    int(a)
    b = sys.stdin.readline().rstrip()
    int(b)
    h = sys.stdin.readline().rstrip()
    int(h)
    print solve(a, b, h)


if __name__ == "__main__":
    main()


### FIXED CODE ###

def solve(a, b, h):
    return (a + b) * h / 2


a = raw_input()
a = int(a)
b = raw_input()
b = int(b)
h = raw_input()
h = int(h)
ans = solve(a, b, h)
print ans
n,a,b,c,d = map(int,input().split())
s = input()
if c < d:
    #最後まで動かす
    flg = True
else:#c>d
    if '...' in s[a:]:
        flg = True
        if not(c-d==2 and '...' in s[:d]):
            flg = False
if '##' in s:
    flg = False
if flg:
    print('Yes')
else:
    print('No')



### FIXED CODE ###

n,a,b,c,d = map(int,input().split())
s = input()
flg = False
if c < d:
    #最後まで動かす
    flg = True
else:#c>d
    if '...' in s[b-2:d+1]:
        flg = True
if '##' in s[a-1:max(d,c)-1]:
    flg = False
if flg:
    print('Yes')
else:
    print('No')
k,x=map(int,input().split())
for i in range(x-k+1,x+K):
  print(i, end=' ')

### FIXED CODE ###

k,x=map(int,input().split())
for i in range(x-k+1,x+k):
  print(i, end=' ')
W,H,x,y=map(int,input().split())
if x/W==y/H or x/W==(H-y)/H:
    print(W*H/2,1)
elif x and y:
    print(max(min(x*H,(W-x)*H),min(y*W,(H-y)*W)),0)
else:
    print(max(min(x*H,(W-x)*H),min(y*W,(H-y)*W),min(H*H*x/y,H*W-H*H*x/y),min(W*W*y/x,H*W-W*W*y/x)),0)


### FIXED CODE ###

W,H,x,y=map(int,input().split())
if x==W/2 and y==H/2:
    print(W*H/2,1)
elif not x or not y:
    print(W*H/2,0)
elif x/W==y/H or x/W==(H-y)/H:
    print(W*H/2,0)
else:
    print(W*H/2,0)
# -*- coding: utf-8 -*-
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N = i2n()
    L = [0] * N
    for i in range(N):
        s, p = i2s().split()
        L[i] = (s, inr(p), i)

    L.sort(key=lambda x: (x[0], -x[1])
    for l in L:
        print(l[2])

main()


### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N = i2n()
    r = {}
    for i in range(N):
        s, p = i2s().split()
        p = int(p)
        if s in r.keys():
            r[s] += [(p, i)]
        else:
            r[s] = [(p, i)]

    rname = list(r.keys())
    rname.sort()
    # print(rname)
    for n in rname:
        out = [x[1] for x in sorted(r[n], reverse=True)]
        for m in out:
            print(m + 1)

main()