peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
import sys


def input():
    return sys.stdin.readline().rstrip()


def main():
    D,T,S =map(int,input().split())

    if D <=T*S:
        print("Yes")
    else:
        print("No")



if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
n,p=map(int,input().split())
A=[i%2 for i in map(int,input().split())]
A0=A.count(0)
A1=A.count(1)
if p==1 and A1==0:
    print(0)
elif p==1 and A1==0:
    print(2**A0)
else:
    print((2**A0)*(2**A1)//2)
# Judge status: Wrong Answer
def CutandCount(n , s):

    ans = 0

    for i in range(1 , n + 1):
        count = 0
        for w in range(ord('a'), ord('z') + 1):
            if s[:i] in chr(w) and s[i:] in chr(w):
                count += 1

        ans = max(ans , count)

    return ans

def main():
    n = int(input())
    s = str(input())
    print(CutandCount(n , s))

if __name__ == '__main__':
    main()
# Judge status: Accepted
n=int(input())
l=[list(map(int,input().split()))for _ in range(2)]
a=0
for i in range(n):
    a=max(a,sum(l[0][:i+1])+sum(l[1][i:]))
print(a)
# Judge status: Accepted
n,m=map(int,input().split())
j = 0
if n % 2 == 1:
  for i in range(m):
    print(1+i, n-i-j)
else:
  for i in range(m):
    if 2*((n-i) - (1+i)) - n >= 2:
      print(1+i, n-i-j)
    else:
      j = 1
      print(1+i, n-i-j)
# Judge status: Accepted
from collections import *
n = int(input())
a = []
for i in range(n):
	a.append(input())
c = Counter(a)
for i in ['AC', 'WA', 'TLE', 'RE']:
	if(i not in c): c[i] = 0
	print(i,'x',c[i])
# Judge status: Accepted
import math
a,b=input().split()
n=int(a+b)
if math.sqrt(n)==math.sqrt(n)//1:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
import sys
def I(): return int(sys.stdin.readline().rstrip())

N = I()
if N < 105:
    print(0)
elif N < 135:
    print(1)
elif N < 165:
    print(2)
elif N < 189:
    print(3)
elif N < 195:
    print(4)
else:
    print(5)
# Judge status: Wrong Answer
# にぶたん　二分探索
n, k = map(int, input().split())
A = list(map(int, input().split()))

ok = 1
ng = max(A)

while abs(ok - ng) > 1:
  mid = (ok + ng) // 2
  cnt = 0
  for a in A:
    cnt += (a - 1) // mid
  if cnt <= k:
    ng = mid
  else:
    ok = mid

print(ng)
# Judge status: Accepted
n = int(input())
k = int(input())
x = int(input())
y = int(input())
if k <= n:
  print(k*x+(n-k)*y)
else:
  print(n*x)
# Judge status: Accepted
a,b,c,d,e = map(int,input().split())
kis = a * 60 + b
nel = c * 60 + d
print(nel - e - kis)
# Judge status: Wrong Answer
n=int(input())
dp={}
l1=list(map(int,input().split()))
dp[1]=[max(l1),l1.index(max(l1))+1]

for val in range(2,n+1):
    dp[val]=[0,4]
for val2 in range(2,n+1):
    l=list(map(int,input().split()))
    l[dp[val2-1][1]-1]=0
    dp[val2]=[max(dp[val2][0],dp[val2-1][0]+max(l)),l.index(max(l))+1]
print(dp[n][0])
# Judge status: Accepted
a, b = map(int, input().split())

if a > b:
  print(a - 1)
elif a <= b:
  print(a)
# Judge status: Accepted
n,l=map(int,input().split())
aji = []
m = 100000
flg = 0
for i in range(n):
  aji.append((l+i))
  if abs(aji[i]) <= m:
    m = abs(aji[i])
    if aji[i] <= 0:
      flg = 1
    else:
      flg = 0
print(sum(aji)- m if flg==0 else sum(aji) +m)
# Judge status: Accepted
s = list(input())
k = int(input())
n = len(s)
for i in range(n):
    if k <= 0 or s[i] == 'a':
        continue
    if 123 - ord(s[i]) <= k:
        k -= 123 - ord(s[i])
        s[i] = 'a'
# print(k)
# print(s)
k %= 26
# print(ord(s[-1])+k)
if ord(s[-1])+k > 122:
    s[-1] = chr(97+(122-ord(s[-1])+k))
else:
    s[-1] = chr(ord(s[-1])+k)
# print(k)
print(*s, sep='')
# Judge status: Accepted
n = input()
k = len(n)
a = 9 * (k - 1) + int(n[0]) - 1
b = 0
for i in range(k):
  b += int(n[i])
c = 0
m = ''
if k > 2 and n[-2] != '0':
  m = str(int(n))[:k - 2] + str(int(n[-2]) - 1) + '9'
elif k > 2 and n[-2] == '0':
  m = str(int(n) - (int(n[-1]) + 1))
for i in range(len(m)):
  c += int(m[i])
ans = max(a, b, c)
print(ans)
# Judge status: Accepted
w, h, x, y = map(int, input().split())

area = w * h / 2

if x == w / 2 and y == h / 2:
    print(area, 1)
else:
    print(area, 0)
# Judge status: Wrong Answer
N, M = map(int, input().split())

A = []
for i in range(N):
    A.append(list(map(int, input().split())))

s = set(A[0])
for i in range(1,N):
    _s = set(A[i])
    s &= _s
print(len(s)-1)
# Judge status: Wrong Answer
c = input()
if c in "aeiou":
    print("vowel")
else:
    print("constant")
# Judge status: Accepted
N=int(input())
s=0

for k in range(1,N):
    s+=(N-1)//k
    k+=1

print(s)
# Judge status: Accepted
n = int(input())
a = [int(input()) for _ in range(n)]

ans = 0
for i in range(n):
    if i > 0:
        if a[i-1] == 1 and a[i] > 0:
            ans += 1
            a[i] -= 1

    ans += a[i] // 2
    a[i] %= 2

print(ans)
# Judge status: Accepted
N=int(input())
table=list(map(int,input().split()))
alice_num=0
bob_num=0
table=sorted(table)
for i in range(N-1,-1,-1):
    if N%2==0:
        if i%2==1:
            alice_num+=table[i]
        else:
            bob_num+=table[i]
    else:
        if i%2==1:
            bob_num+=table[i]
        else:
            alice_num+=table[i]

print((alice_num)-(bob_num))
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
s = sum(a)
x = [0 for _ in range(10**5+1)]
for ai in a:
  x[ai] += 1
q = int(input())
for _ in range(q):
  b,c = map(int,input().split())
  xb = x[b]
  x[b] = 0
  s+= xb*(c-b)
  x[c] += xb
  print(s)
# Judge status: Accepted
def resolve():
    sx, sy, tx, ty = list(map(int, input().split()))
    dx = tx - sx
    dy = ty - sy
    res = "U"*dy+"R"*dx+"D"*dy+"L"*dx+"L"+"U"*(dy+1)+"R"*(dx+1)+"D"+"R"+"D"*(dy+1)+"L"*(dx+1)+"U"
    print(res)


if '__main__' == __name__:
    resolve()
# Judge status: Accepted
f = int(input()) / 3.0
print("{:.9f}".format(f * f * f))
# Judge status: Accepted
import math

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

gcd = (c * d) // math.gcd(c, d)

r = b // c + b // d - b // gcd
l = (a - 1) // c + (a - 1) // d - (a - 1) // gcd

print((b - a) - (r - l) + 1)
# Judge status: Wrong Answer
import math
import collections
import fractions
import itertools

def solve():
    n = int(input())
    s = [input() for i in range(n)]
    print(len(s))
    return 0

if __name__ == '__main__':
    solve()
# Judge status: Accepted
url = "https://atcoder.jp/contests/abc046/tasks/abc046_a"

def main():
    li = list(input().split())
    print(len(set(li)))
if __name__ == '__main__':
    main()
# Judge status: Accepted
S = input()
S1 = int(S[:2])
S2 = int(S[2:])

if 1<=S1<=12 and 1<=S2<=12:
    print('AMBIGUOUS')
elif 1<=S1<=12:
    print('MMYY')
elif 1<=S2<=12:
    print('YYMM')
else:
    print('NA')
# Judge status: Accepted
N=int(input())
flag = 0
for i in range(N):
  d1,d2 = map(int,input().split())
  if d1==d2:
    if flag<2:
      flag+=1
    else:
      print("Yes")
      exit()
  else:
    flag = 0
print("No")
# Judge status: Accepted
from bisect import bisect_left
from collections import deque

n = int(input())
ans = []
ans.append(int(input()))
ans = deque(ans)
for i in range(n-1):  
  temp = int(input())
  if temp <= ans[0]:
    ans.appendleft(temp)
  else:
    ans[bisect_left(ans, temp)-1]=temp
print(len(ans))
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))

from collections import Counter
c = Counter(A)

x = 0
y = 0
for k, v in sorted(c.items(), key=lambda x: -x[0]):
    if v >= 2:
        if x == 0:
            x = k
        elif y == 0:
            y = k

print(x*y)
# Judge status: Accepted
a = str(input())
b = str(input())
res = 0
for i in range(len(a)) :
    if a[i] != b[i] :
        res += 1
print(res)
# Judge status: Accepted
n, m = map(int, input().split(' '))
print((n * (n - 1) + m * (m - 1)) // 2)
# Judge status: Wrong Answer
A, B, T = map(int, input().split())

print(int(((B/A)*T)))
# Judge status: Accepted
N = int(input())
A = [int(a) for a in input().split()]
s = 0
for a in A:
    s ^= a
print(*[a^s for a in A])
# Judge status: Accepted
A,B,M = map(int,input().split())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
XYC = [[int(i) for i in input().split()] for j in range(M)]

res = 10**9
for x,y,c in XYC:
    res = min(res,a[x-1]+b[y-1]-c)
res = min(res,min(a)+min(b))
print(res)
# Judge status: Wrong Answer
#coding: utf-8

sx, sy, tx, ty = map(int,input().split())
ans = ''
for i in range(tx-sx):
    ans += 'R'
for i in range(ty-tx):
    ans += 'U'
for i in range(tx-sx):
    ans += 'L'
for i in range(ty-tx):
    ans += 'D'

ans += 'D'
for i in range(tx-sx+1):
    ans += 'R'
for i in range(ty-tx+1):
    ans += 'U'
ans += 'L'

ans += 'U'
for i in range(tx-sx+1):
    ans += 'L'
for i in range(ty-tx+1):
    ans += 'D'
ans += 'R'

print(ans)
# Judge status: Wrong Answer
N = int(input())

double = 1

for i in range(1, N):
  double = double*i
  
print(double%(10**9+7))
# Judge status: Accepted
def solve(s, t):

    length = len(t)
    ans = []
    i = 0
    flg = False
    while i < len(s):
        tmp = s[i:i+length]
        count = len([i for i, j in zip(tmp, t) if i == j or i == "?"])
        if length == count:
            a = s[:i] + t + s[i+length:]
            ans.append(a.replace("?", "a"))

        i += 1

    return min(ans) if len(ans) > 0 else "UNRESTORABLE"

if __name__ == "__main__":
    s = input()
    t = input()
    print(solve(s, t))
# Judge status: Wrong Answer
n=int(input())
a=input()
l=[a]
ans="Yes"
for i in range(n-1):
    w=input()
    a=w
    if (a[-1]!=w[0]) or (w in l ):
        ans="No"
    l.append(w)
print(ans)
# Judge status: Wrong Answer
N,K=map(int,input().split())
a=[list(map(int,input().split()))for i in range(2*K)]
sunuke=[]
for i in range(2*K):
    if i%2==1:
        d=sum(a[i-1])
        for n in range(d):
            sunuke.append(a[i][n])
print(sunuke)
sunuke=set(sunuke)
print(N-len(sunuke))
# Judge status: Accepted
n,k=map(int,input().split())
ab=[]
for _ in range(n):
  a,b=map(int,input().split())
  ab.append((a,b))
ab.sort()
for i,j in ab:
  k-=j
  if k<=0:
    print(i)
    exit()
# Judge status: Wrong Answer
N = int(input())

def Main(N):
    B = 41
    ans = [0]*(6*B*B+1)
    for i in range(1, B+1):
        for j in range(1, B+1):
            for k in range(1, B+1):
                a = i*i+j*j+k*k+i*j+j*k+k*i
                ans[a] += 1
    return ans

            
        
                    
out = Main(N)
for i in range(1, N+1):
    print(out[i])
# Judge status: Wrong Answer
print("Chistmas"+" Eve"*(25-int(input())))
# Judge status: Wrong Answer
s=int(input())

cnt=0
while True:
  cnt+=1
  if s==4:
    print(cnt+3)
    break
  if s%2==0:
    s=s//2
    
  else:
    s=3*s+1
# Judge status: Wrong Answer
h1,m1,h2,m2,k = map(int,input().split())
t1 = h1*60+m1
t2 = h2*60+m1
d = t2-t1
print(d-k)
# Judge status: Accepted
a, b = map(int, input().split())


if abs(a - b) > 0:
    m = max(a, b)
    ans = m + m - 1
else:
    ans = a + b

print(ans)
# Judge status: Wrong Answer
K=int(input())
A=[1,2,3,4,5,6,7,8,9]
I=0
while I<=K:
    if not A[I]%10==0:
        A.append(A[I]%10+10*A[I]-1)
    A.append(A[I]%10+10*A[I])
    if not A[I]%10==9:
        A.append(A[I]%10+10*A[I]+1)
    I+=1
    if len(A)>=K:
      break
print(A[I])
# Judge status: Accepted
N, K = map(int, input().split(' '))
S = input()
happy = sum([1 for i in range(N - 1) if S[i] == S[i + 1]])
print(min(N - 1, happy + 2 * K))
# Judge status: Accepted
s=input()
o=["R","U","D"]
e=["L","U","D"]
for i in range(len(s)):
  if i%2==0:
    if s[i] in o:
      pass
    else:
      print("No")
      break
  else:
    if s[i] in e:
      pass
    else:
      print("No")
      break
else:
  print("Yes")
# Judge status: Accepted
island, fune = map(int, input().split(" "))
route = []
for i in range(fune):
    route.append(list(map(int, input().split(" "))))
temp = []
for i in range(fune):
    if route[i][0] == 1:
        temp.append(route[i][1])
for j in range(fune):
    if route[j][1] == island:
        temp.append(route[j][0])
 
 
print("POSSIBLE") if len(temp) != len(list(set(temp))) else print("IMPOSSIBLE")
# Judge status: Wrong Answer
# n, m, l = map(int, input().split())

# list_n = list(map(int, input().split()))

# n = input()
# list = [input() for i in range(N)

# list = [[i for i in range(N)] for _ in range(M)]

import sys
input = sys.stdin.readline

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

ans = 0
if C % 2 != 0:
    ans = A * B
elif B % 2 != 0:
    ans = A * C
elif A % 2 != 0:
    ans = B * C
print(ans)
# Judge status: Wrong Answer
A,B,C=map(int,input().split())
for i in range(1,10**5):
  if (B*i+C)%A==0:
    print('Yes')
    break
else:
  print('No')
# Judge status: Accepted
n = int(input())
i = 1
while i ** 2 <= n:
    i += 1
print((i - 1) ** 2)
# Judge status: Wrong Answer
s=int(input())
if s+1<=10**9:
  b=str(s+1)
  a=['0','0',b,'1','1','1']
else:
  x2=int(s**(1/2))
  y3=int(s**(1/2))+1
  if x2*y3<s:
    x2+=1
  x2=str(x2)
  y3=str(y3)
  
  y2=str(1)
  x3=str(int(x2)*int(y3)-s)
  x1=str(0)
  y1=str(0)
  a=[x1,y1,x2,y2,x3,y3]
print((' ').join(a))
# Judge status: Wrong Answer
n,k=map(int,input().split())

if (n-1)%(k-1)==0:
    print((n-1)/(k-1))
else:
    print((n-1)//(k-1)+1)
# Judge status: Accepted
S = input()
T = input()
ans = 0
for i in range(len(S)):
  if S[i]!=T[i]:
    ans+=1
print(ans)
# Judge status: Accepted
n = int(input())
a = map(int,input().split())

if len(set(a)) == n:
  print("YES")
else:
  print("NO")
# Judge status: Accepted
N,M = map(int,input().split())
ans = 0
if N == 1 and M == 1:
    ans = 1
elif N == 1:
    ans = M-2
elif M == 1:
    ans = N-2
else:
    ans = (N-2)*(M-2)
print(ans)
# Judge status: Accepted
# ABC070_B
A,B,C,D = map(int, input().split())
f = []
s = []
# 先にボタンを押し始めたほうをfに格納する
if A <= C:
    f = [A, B]
    s = [C, D]
else:
    s = [A, B]
    f = [C, D]

ans = 0
if f[1] <= s[0]:
    ans = 0
elif s[1] <= f[1]:
    ans = s[1] - s[0]
elif f[1] <= s[1]:
    ans = f[1] - s[0]

print(ans)
# Judge status: Accepted
n, m = map(int, input().split())
p_y = []
for i in range(m):
    p, y = map(int, input().split())
    p_y.append([p, y, i])

p_y_sorted = sorted(p_y)
li_id = []
prev_p = -1
cnt = 1

for i in p_y_sorted:
    if(prev_p != i[0]):
        prev_p = i[0]
        cnt = 1
    id = str(i[0]).zfill(6) + str(cnt).zfill(6)
    li_id.append([i[2], id])
    cnt += 1

li_id_sorted = sorted(li_id)

for i in li_id_sorted:
    print(i[1])
# Judge status: Accepted
import math

x, y, z = map(int, input().split(" "))

ans = math.floor((x - z) / (y + z))

print(ans)
# Judge status: Accepted
# coding: utf-8

H = int(input())
W = int(input())
N = int(input())

cnt = 0
painted = 0

while painted < N:
    if H < W:
        painted += W
        cnt += 1
        H -= 1
    else:
        painted += H
        cnt += 1
        W -= 1

print(cnt)
# Judge status: Accepted
import heapq
N,M = map(int,input().split())
AB = sorted([list(map(int,input().split())) for _ in range(N)])

option = []
ans = 0
j = 0
for i in range(1,M+1):
    while j != N and AB[j][0] <= i: 
        heapq.heappush(option,-AB[j][1])
        j += 1
    if len(option) != 0:
        ans -= heapq.heappop(option)
print(ans)
# Judge status: Accepted
from collections import deque

n=int(input())
d=deque(list(input()))
#print(d)
r=0
while n>1:
  #print(d)
  tempr=False
  n-=1
  if d.pop()=="W":
    pass
  else:
    while n>0:
      n-=1
      if d.popleft()=="R":
        pass
      else:
        r+=1
        break
  #print(d,r)
print(r)
# Judge status: Accepted
s=0
for i in range(1,int(input())):
    s+=i
print(s)
# Judge status: Wrong Answer
a=int(input())
s=str(input())

if a>=3200:
  print('red')
else:
  print(s)
# Judge status: Accepted
n = int(input())
a = True
for i in range(n//4+1):
    if (n-i*4)%7==0:
        print('Yes')
        a = False
        break
if a:
    print('No')
# Judge status: Wrong Answer
n, d = map(int, input().split())
i = 0
if((2 *(d + i) + 1) * 2 >= n):
  i += 0
else:
  while((2 * (d + i) + 1) * 2 >= n):
    i += 1
print(i + 1)
# Judge status: Accepted
p=10**9+7

n=int(input())

print((pow(10,n,p)-2*pow(9,n,p)+pow(8,n,p))%p)
# Judge status: Wrong Answer
N=int(input())
H=list(map(int,input().split()))
cnt=0
ans=0
for i in range(1,N):
  if H[i-1]>=H[i]:
    cnt=cnt+1
  else:
    ans=cnt
    cnt=0
  
  
if ans>cnt:
  print(ans)
else:
  print(cnt)
# Judge status: Accepted
A,B= map(int,input().split())

if A>=13:
    print(B)
elif (A<=12) & (A>=6):
    print(int(B/2))
elif A<=5:
    print(int(0))
else:
    pass
# Judge status: Accepted
s=input()
n=len(s)
def isk(S):
  l=len(S)
  f=1
  for i in range(l//2+1):
    if S[i]==S[l-i-1]:
      f*=1
    else:
      f=0
  if f:
    return True
  else:
    return False
  
if isk(s) and isk(s[:(n-1)//2]) and isk(s[(n+1)//2:]):
  print('Yes')
else:
  print('No')
# Judge status: Accepted
import math
X = int(input())
list1 = []

for i in range(2,X+1):
  for j in range(2,int((X + 1)/2)):
    a = math.log10(i)/math.log10(j)
    if a.is_integer():
      list1.append(i)
if list1 == []:
  print(1)
else:
  print(max(list1))
# Judge status: Wrong Answer
import fractions
import math
n = int(input())
a = list(map(int, input().split()))
MOD = 10**9 + 7
ans = 0

lcm = a[0]
for i in range(1, n):
    lcm = lcm * a[i] // fractions.gcd(lcm, a[i])
    #lcm = lcm * a[i] // math.gcd(lcm, a[i])\
lcm %= MOD
for i in range(n):
    ans += lcm * pow(a[i] , MOD-2, MOD)
#     ans %= MOD
print(ans)
# Judge status: Accepted
from itertools import accumulate
n = int(input())
a = list(map(int, input().split()))
ac = list(accumulate(a))
total = ac[-1]
ans = float('inf')
for i in range(n-1):
    l, r = ac[i], total - ac[i]
    ans = min(ans, abs(l-r))
print(ans)
# Judge status: Accepted
n = int(input())
p = list(map(int,input().split()))
c = 0
for i in range(n-1):
    if p[i] == i+1:
        p[i],p[i+1] = p[i+1],p[i]
        c += 1
if p[n-1] == n:
    c += 1
print(c)
# Judge status: Accepted
n = int(input())
a =  list(map(int,input().split()))
v = 1

for i in range(n):
  if a[i] == v:
    v += 1

if v == 1:
  print(-1)
else:
  print(n - (v-1))
# Judge status: Accepted
N, K = map(int, input().split())
now = 0
ab = [list(map(int, input().split())) for _ in range(N)]
ab = sorted(ab)
for a, b in ab:
  if now < K <= now+b:
    print(a)
    exit()
  now += b
# Judge status: Wrong Answer
import heapq

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

a = [-int(x) for x in input().split()]

heapq.heapify(a)

num = 0
hq = 1

while num <= M and hq != 0:
    hq = -heapq.heappop(a)//2
    heapq.heappush(a, -hq)
    num += 1

print(-sum(a))
# Judge status: Wrong Answer
K = int(input())
data = []
C = 0
num = 0
def runrun(a):
	if len(str(a)) == 1:
		return True
	else:
		for i in range(len(str(a))-1):
			difference_digit = int(str(a)[i+1])-int(str(a)[i])
			if difference_digit**2 <= 1:
				return True
while C < K:
	num += 1
	if runrun(num):
		data.append(num)
		C += 1
print(data[-1])
# Judge status: Accepted
N,K,S = map(int,input().split())
if S == 10**9:
    A = [S]*K + [S-1]*(N-K)
else:
    A = [S]*K + [S+1]*(N-K)
print(*A)
# Judge status: Accepted
n = int(input())

grid = []
ans = []

for i in range(2):
    grid.append(list(map(int, input().split())))

for i in range(n):
    anst = 0
    for _ in range(n):
        anst = sum(grid[0][:i+1])
        anst += sum(grid[1][i:n])
    ans.append(anst)

print(max(ans))
# Judge status: Wrong Answer
N = int(input())
H = list(map(int, input().split())) + [0] * 100
dp = [10**5] * (N+10)
dp[0] = 0

for i in range(0, N):
    dp[i+1] = min(dp[i+1], dp[i] + abs(H[i]-H[i+1]))
    dp[i+2] = min(dp[i+2], dp[i] + abs(H[i]-H[i+2]))

# print(dp)
print(dp[N-1])
# Judge status: Accepted
N,M = map(int,input().split())
min = 0
max = N

for _ in range(M):
    L_i,R_i = map(int,input().split())
    if L_i > min:
        min = L_i
    if R_i < max:
        max = R_i

if min > max:
    print(0)
else:
    print(max - min + 1)
# Judge status: Wrong Answer
A, B, C = map(int,input().split())
X =A//B
if X >= C:
    print(C)
else:
    print(X)
# Judge status: Accepted
n = int(input().strip())
res = []
for i in range(1, n + 1):
    res.append(input().strip().split() + [i])
    res[-1][1] = int(res[-1][1])
    
res.sort(key=lambda s: (s[0], -s[1]))
for i in res:
    print(i[-1])
# Judge status: Accepted
n = int(input())

a,b = 2,1
for i in range(n-1):
    a,b = b,a+b
print(b)
# Judge status: Accepted
from fractions import gcd
from functools import reduce, partial
import sys


def input():
    return sys.stdin.readline()[:-1]

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

def func(a, b, l):
	mod = 10**9 + 7
	return (a +  l*modinv(b, mod)) % mod

def modinv(a, b):
	return pow(a,b-2,b)

def main():
	mod = 10**9 + 7
	N = int(input())
	A = tuple(map(int, input().split()))

	l = reduce(lcm, A) % mod
	A = (0,) + A
	
	ans = reduce(partial(func, l=l), A)
	print(ans)
	

if __name__ == "__main__":
	main()
# Judge status: Wrong Answer
import collections
import sys

N, x = map(int, input().split())
A_lis = list(map(int, input().split()))
A_q = collections.deque(A_lis)

sys.setrecursionlimit(10 ** 9)

con = 0
tmp1 = A_q.popleft()
for i in range(N-1):
    tmp2 = A_q.popleft()
    if tmp1 + tmp2 > x:
        con += (tmp1 + tmp2) - x
        tmp1 = max(0, tmp1 - x)
    else:
        tmp1 = tmp2

print(con)
# Judge status: Wrong Answer
x, y = map(int, input().split())
al = []
a = x
al.append(a)
for i in range(1, int(x)):
  a *= 2
  if a > y:
    break
  al.append(a)
print(len(al))
# Judge status: Wrong Answer
N,K=map(int,input().split())
p=[int(x) for x in input().split()]
T=[0 if x=='r' else (1 if x=='s' else 2) for x in input()]
B=[-1]*K

s=0
for i in range(N):
  v=(T[i]+2)%3
  if v!=B[i%K]:
    s+=p[v]
    B[i%K]=v
  else:
    B[i%K]=T[i]

print(s)
# Judge status: Wrong Answer
from heapq import heappop, heapify, heappush


x, y, a, b, c = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
AB = A[:x] + (B[:y])

heapify(AB)
heapify(C)
ans = 0
for _ in range(len(C)):
    c = heappop(C)
    ab = heappop(AB)
    if ab > c:
        heappush(AB, ab)
        break
    heappush(AB, c)
ans = sum(AB)
print(ans)
# Judge status: Accepted
s = input()

num = len(s)

for i in range (num):
    print('x', end="")
# Judge status: Wrong Answer
import math

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

d = 10 ** 9 + 7

fn = math.factorial(n) % d
fm = math.factorial(m) % d

if abs(n - m) > 2:
	print(0)
elif abs(n - m) == 1:
	print((fn * fm) % d)
elif abs(n - m) == 0:
	print((2 * fn * fm) % d)
# Judge status: Wrong Answer
import numpy as np
a, b, x = map(int, input().split())

ans = np.rad2deg(np.arctan2(2 * (b - x/a**2), a))
print('{:.10f}'.format(ans))
# Judge status: Wrong Answer
n,d=input().split()
a=[]
for x in range(int(n)):
    x,y=input().split()
    if (((int(x)**2)+(int(y)**2))**0.5)==float(int(d)):
        a.append(1)
print(len(a))
# Judge status: Wrong Answer
a, b = map(int,input().split())
print(min(a,b))
# Judge status: Accepted
import bisect
N = int(input())

num_list = list(map(int,input().split()))
num_list.sort()
res = 0

for a in range(N-2):
    for b in range(a+1,N-1):
        k = bisect.bisect_left(num_list,num_list[a]+num_list[b])
        res += max(k-(b+1),0)
print(res)
# Judge status: Accepted
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
 
def div_ceil(x, y): return (x + y - 1) // y
 
N, M = map(int, input().split())
*A, = map(int, input().split())
A = list(set([a // 2 for a in A]))
L = A[0]
for a in A[1:]:
    L *= a // gcd(L, a)
for a in A:
    if (L // a) % 2 == 0:
        ans = 0
        break
else:
    ans = div_ceil(M // L, 2)
print(ans)
# Judge status: Accepted
A, B, N = map(int, input().split())
from math import floor

if B <= N:
    x = B - 1
else:
    x = N
cand = floor(A*x/B) - A * floor(x/B)
print(cand)
# Judge status: Accepted
def resolve():
    S = str(input())
    n = S.count('N')
    s = S.count('S')
    w = S.count('W')
    e = S.count('E')
    if n > 0 and s == 0:
        print('No')
        return
    if n == 0 and s > 0:
        print('No')
        return
    if w > 0 and e == 0:
        print('No')
        return
    if w == 0 and e > 0:
        print('No')
        return
    print('Yes')

    return


resolve()
# Judge status: Accepted
n = int(input())
a = 10 - n // 200
print(a)
# Judge status: Accepted
a, b = map(int, input().split())
if a % 2 ==0 or b % 2 ==0:
  print('Even')
else:
  print('Odd')