Problem:


Score : 200 points

Problem Statement

You have decided to write a book introducing good restaurants.
There are N restaurants that you want to introduce: Restaurant 1, Restaurant 2, ..., Restaurant N. Restaurant i is in city S_i, and your assessment score of that restaurant on a 100-point scale is P_i.
No two restaurants have the same score.

You want to introduce the restaurants in the following order:

The restaurants are arranged in lexicographical order of the names of their cities.

If there are multiple restaurants in the same city, they are arranged in descending order of score.

Print the identification numbers of the restaurants in the order they are introduced in the book.

Constraints

1 ≤ N ≤ 100

S is a string of length between 1 and 10 (inclusive) consisting of lowercase English letters.

0 ≤ P_i ≤ 100

P_i is an integer.

P_i ≠ P_j (1 ≤ i < j ≤ N)

Input

Input is given from Standard Input in the following format:

N
S_1 P_1
:
S_N P_N

Output

Print N lines. The i-th line (1 ≤ i ≤ N) should contain the identification number of the restaurant that is introduced i-th in the book.

Sample Input 1

6
khabarovsk 20
moscow 10
kazan 50
kazan 35
moscow 60
khabarovsk 40

Sample Output 1

3
4
6
1
5
2

The lexicographical order of the names of the three cities is kazan < khabarovsk < moscow. For each of these cities, the restaurants in it are introduced in descending order of score. Thus, the restaurants are introduced in the order 3,4,6,1,5,2.

Sample Input 2

10
yakutsk 10
yakutsk 20
yakutsk 30
yakutsk 40
yakutsk 50
yakutsk 60
yakutsk 70
yakutsk 80
yakutsk 90
yakutsk 100

Sample Output 2

10
9
8
7
6
5
4
3
2
1



Sample input:
6
khabarovsk 20
moscow 10
kazan 50
kazan 35
moscow 60
khabarovsk 40


Sample output:
3
4
6
1
5
2

Submission status: Runtime Error

Solution code:
n = int(input())
l = []
for i in  range():
    s, p = input().split()
    l.append([s, int(p), i])
l_sorted = sorted(l, key = lambda x: (x[0], -x[1]))
for j in l_sorted:
    print(j[2]+1)

Submission status: Runtime Error

Solution code:
n = int(input())
l = []
for i in  range():
    s, p = input().split()
    l.append([s, int(p), i])
l_sorted = sorted(l, key = lambda x: (x[0], -x[1]))
for out in l_sorted:
    print(out[2]+1)

Submission status: Runtime Error

Solution code:
あ

Submission status: Runtime Error

Solution code:
N = int(input())


ss = list()
for i in range(N):
    s, p = input().split()
    ss = ss.append([s, int(p), i])

ss_sorted = sorted(ss, key = lambda x:(x[0], -x[1]))

print([out[2] for out in ss_sorted])

Submission status: Runtime Error

Solution code:
from sys import argv

debug = "a" in argv
n = int(input())
ls = []
la = ls.append
for i in range(1, n + 1):
    s = input().split()
    la((i, s[0], int(s[1])))
if debug:
    print(f"ls: {ls}")
ls = sorted(ls, key=lambda x: x[2], reverse=1)
ls = sorted(ls, key=lambda x: x[1])
if debug:
    print(f"ls(sorted): {ls}")
if debug:
    print("debug end")
for x in ls:
    print(x[0])

Submission status: Runtime Error

Solution code:
from collections import deque
N,K = list(map(int,input().split()))
K = deque()
for i in range(M):
    A = deque(map(int,input().split()))
    K.append(A[0])
    A.popleft()
p = list(map(int,input().split()))
ans = 0
for i in range(1 << N):
    f = True
    for j in range(M):
        s = 0
        for k in ks[j][1:]:
            s += (i >> (k - 1)) & 1
            print((i >> (k - 1)) & 1,(i >> (k - 1)))
        if s % 2 != p[j]:
            f = False
    if f:
        ans += 1

Submission status: Runtime Error

Solution code:
a = []
n = int(input())

for i in range(1,n+1):
  name,score = map(int,input().split())
  a.append([name,-int(score),i])
  
a.sort()
for n,s,idx in a:
  print(idx)

Submission status: Runtime Error

Solution code:
n=int(input())
for x in range(n):
  a,b=input().split()
  lists.append([a,int(b),x+1])
lists.sort(key=lambda t:t[1],reverse=True)
lists.sort(key=lambda t:t[0])
for x in range(n):
  print(lists[x][2])

Submission status: Runtime Error

Solution code:
n=int(input())
lists=[list(input().split()) for x in range(n)]
for x in range(n):
  a,b=input().split()
  lists.append([a,int(b),x+1])
lists.sort(key=lambda t:t[1],reverse=True)
lists.sort(key=lambda t:t[0])
for x in range(n):
  print(lists[x][2])

Submission status: Runtime Error

Solution code:
n=int(input())
lists=[list(input().split()) for x in range(n)]
for y in range(n):
  lists[y].append(y+1)
lists.sort(key=lambda t:t[1] reverse=True)
lists.sort(key=lambda t:t[0])
for z in range(n):
  print(lists[z][2])

Submission status: Runtime Error

Solution code:
n=int(input())
lists=[list(input().split()) for x in range(n)]
for x in range(n):
  lists[x].append(x+1)
lists.sort(key=lambda t:t[1] reverse=True)
lists.sort(key=lambda t:t[0])
for x in range(n):
  print(lists[x][2])

Submission status: Runtime Error

Solution code:
n=int(input())
lists=[list(input().split()) for x in range(n)]
for x in range(n):
  lists[x].append(x+1)
lists.sort(key=lambda x:x[1] reverse=True)
lists.sort(key=lambda x:x[0])
for x in range(n):
  print(lists[x][2])

Submission status: Runtime Error

Solution code:
n=int(input())
sp=[]
for i in range(n):
    s,p=map(str(input().split()))
    sp.append([s,int(p),i+1])
sp.sort(key=lambda x: x[1],reverse=True)
sp.sort(key=lambda x: x[0])

for e in sp:
    print(e[2])

Submission status: Runtime Error

Solution code:
N = int(input())
inp = [input() for i in range(N)]

import numpy as np

s_list = []
p_list = []
#sp_list = []
for i in inp:
    s_list.append(i.split()[0])
    p_list.append(int(i.split()[1]))
    #sp_list.append(i.split())
sp_list = []
for i in range(N):
    sp_list.append([s_list[i],p_list[i]])

# 市を辞書順
sort_sp_list = sorted(sp_list)

# 市の種類
s_type = sorted(list(set(s_list)))
tmp_list = []
for type in s_type:
    tmp_list.append(sorted([s for s in sort_sp_list if s[0] == type],reverse=True))
rank_list = np.array(tmp_list).reshape(N,2).tolist()

for i in [i.split() for i in inp]:
    print(rank_list.index(i)+1)

Submission status: Runtime Error

Solution code:
N = int(input())
ls = []
for i in range(N):
  s,p = input().spiit()
  p = int(p)
  ls.append([s,-p,i+1])
ls.sort()
for i in range(len(ls)):
  print(ls[2])

Submission status: Runtime Error

Solution code:
import pandas as pd
N = int(input())
sps = []
for i in range(1, N+1):
    s, p = input().split(' ')
    sps.append({'i': i, 's': s, 'p': int(p)})
ret = pd.DataFrame(sps).sort_values(['s', 'p'], ascending=[True, False]).values.tolist()
for i in range(N):
    print(ret[i][0])

Submission status: Runtime Error

Solution code:
import pandas as pd
N = int(input())
sps = []
for i in range(1, N+1):
    s, p = input().split(' ')
    sps.append({'i': i, 's': s, 'p': p})
ret = pd.DataFrame(sps).sort_values(['s', 'p'], ascending=[True, False]).values.tolist()
for i in range(N):
    print(ret[i][0])

Submission status: Runtime Error

Solution code:
_,*l=open(0).read().split()
[print(i + 1)for i in sorted([*range(len(l)//2)],key=lambda i:(l[i*2],-int(l[i*2+1])))]

Submission status: Runtime Error

Solution code:
n = int(input())
a = []
for i in range(n):
  s, p = list(map(int, input().split()))
  a.append([s,-p,i])
a.sort()
for i in a:
  print(i[-1])

Submission status: Runtime Error

Solution code:
n = int(input())
a = []
for i in range(n):
  s, p = map(int, input().split())
  a.append([s,-p,i])
a.sort()
for i in a:
  print(i[-1])

Submission status: Runtime Error

Solution code:

n = int(input())
sp = [list(input().split())+[i+1] for i in range(n)]
sp = [[s,-int(p),i] for s,p,i in sp]

sp.sort()
print(sp)

for i in sp:
  print(sp[i][2])

"""
from operator import itemgetter

n = int(input())
l = []

for i in range(n):
    s,p = map(str,input().split())
    p = int(p)
    l.append([s,p,i+1])

l.sort(key = itemgetter(0))
l = sorted(l, key = lambda x:(x[1]),reverse = True)
print(l)
"""

Submission status: Runtime Error

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip() 

def resolve():
    N = int(input())
    SP = [input().split() for _ in range(N)]

    SP = enumerate(SP)
    SP = sorted(SP, key=lambda x: (x[1][1], -x[1][0]))
    for i in SP:
        print(i[0])    

if __name__ == '__main__':
    resolve()

Submission status: Runtime Error

Solution code:
# include <bits/stdc++.h>
using namespace std;

int main() {
  int N;
  cin >> N;
  vector<tuple<string, int, int>> Book(N, tuple<string, int, int>());
  
  for (int i = 0; i < N; i++) {
    string s;
    int a;
    cin >> s >> a;
    Book.at(i) = make_tuple(s, 100-a, i);
  }
  
  sort(Book.begin(), Book.end());
  
  for (int i = 0; i < N; i++) {
    cout << get<2>(Book.at(i)) + 1<< endl;
  }
}

Submission status: Runtime Error

Solution code:
n = int(input())

city_list = []
point_list = []
#tmp_list = []
for i in range(n):
    tmp = list(input().split())
    city_list.append(tmp[0])
    point_list.append(int(tmp[1]))
    #tmp_list.append(tmp)

indices = [*range(len(city_list))]
sorted_indices = sorted(indices, key=lambda i: city_list[i])
sorted_city = [city_list[i] for i in sorted_indices]

#print(sorted_city)
#print(sorted_indices)

tmp_list = []
tmp_indices_list = []
ans_indices_list = []
for j in range(n):
    if j == 0:
        tmp_list.append(point_list[int(sorted_indices[j])]) # 同一cityのpointを追加していく
        tmp_indices_list.append(int(sorted_indices[j])) # 同一cityのindicesを追加していく
    else:
        if sorted_city[j] == sorted_city[j-1]:
            tmp_list.append(point_list[int(sorted_indices[j])]) # 同一cityのpointを追加していく
            tmp_indices_list.append(int(sorted_indices[j])) # 同一cityのindicesを追加していく

            if j == n-1:
                indices = [*range(len(tmp_list))]
                sorted_tmp_indices = sorted(indices, key=lambda i: -tmp_list[i])
                sorted_tmp_point = [tmp_list[i] for i in sorted_tmp_indices]
                #print(sorted_tmp_indices)

                for k in sorted_tmp_indices:
                    ans_indices_list.append(tmp_indices_list[k])

        elif sorted_city[j] != sorted_city[j-1]:
            #print(tmp_list)
            indices = [*range(len(tmp_list))]
            sorted_tmp_indices = sorted(indices, key=lambda i: -tmp_list[i])
            sorted_tmp_point = [tmp_list[i] for i in sorted_tmp_indices]
            #print(sorted_tmp_indices)

            for k in sorted_tmp_indices:
                ans_indices_list.append(tmp_indices_list[k])

            if j == n-1:
                ans_indices_list.append(int(sorted_indices[j]))

            tmp_list = []
            tmp_indices_list = []
            tmp_list.append(point_list[int(sorted_indices[j])]) # 同一cityのpointを追加していく
            tmp_indices_list.append(int(sorted_indices[j])) # 同一cityのindicesを追加していく

#print(ans_indices_list)

for ans in ans_indices_list:
    print(str(ans+1))

Submission status: Runtime Error

Solution code:
n = int(input())

city_list = []
point_list = []
#tmp_list = []
for i in range(n):
    tmp = list(input().split())
    city_list.append(tmp[0])
    point_list.append(int(tmp[1]))
    #tmp_list.append(tmp)

indices = [*range(len(city_list))]
sorted_indices = sorted(indices, key=lambda i: city_list[i])
sorted_city = [city_list[i] for i in sorted_indices]

#print(sorted_city)
#print(sorted_indices)

tmp_list = []
tmp_indices_list = []
ans_indices_list = []
for j in range(n):
    if j == 0:
        tmp_list.append(point_list[int(sorted_indices[j])]) # 同一cityのpointを追加していく
        tmp_indices_list.append(int(sorted_indices[j])) # 同一cityのindicesを追加していく
    else:
        if sorted_city[j] == sorted_city[j-1]:
            tmp_list.append(point_list[int(sorted_indices[j])]) # 同一cityのpointを追加していく
            tmp_indices_list.append(int(sorted_indices[j])) # 同一cityのindicesを追加していく

            if j == n-1:
                indices = [*range(len(tmp_list))]
                sorted_tmp_indices = sorted(indices, key=lambda i: -tmp_list[i])
                sorted_tmp_point = [tmp_list[i] for i in sorted_tmp_indices]
                #print(sorted_tmp_indices)

                for k in sorted_tmp_indices:
                    ans_indices_list.append(tmp_indices_list[k])

        elif sorted_city[j] != sorted_city[j-1]:
            #print(tmp_list)
            indices = [*range(len(tmp_list))]
            sorted_tmp_indices = sorted(indices, key=lambda i: -tmp_list[i])
            sorted_tmp_point = [tmp_list[i] for i in sorted_tmp_indices]
            #print(sorted_tmp_indices)

            for k in sorted_tmp_indices:
                ans_indices_list.append(tmp_indices_list[k])

            if j == n-1:
                ans_indices_list.append(int(sorted_indices[j]))

            tmp_list = []
            tmp_indices_list = []
            tmp_list.append(point_list[int(sorted_indices[j])]) # 同一cityのpointを追加していく
            tmp_indices_list.append(int(sorted_indices[j])) # 同一cityのindicesを追加していく

#print(ans_indices_list)

for ans in ans_indices_list:
    print(ans+1)

Submission status: Runtime Error

Solution code:
l = []
for i in range(N):
    s, p = input().split()
    l.append([s, int(p), i + 1])

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

Submission status: Runtime Error

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7

n = INT()
sp = [S_LIST() for _ in range(n)]
for i in range(n):
    sp[i][1] = float(1 / int(sp[i][1]))
    sp[i].append(i + 1)
sp.sort()
for i in range(n):
    print(sp[i][2])

Submission status: Runtime Error

Solution code:
N = int(input())
SP = []
for i in range(N):
  S,P = input().split()
  P = int(P)
  SP.append(S,-P,i+1)
SP.sort()
for a,b,c in SP:
  print(c)

Submission status: Runtime Error

Solution code:
N = int(input())
SP = []
for i in range(N):
  S,P = input().split()
  P = int(P)
  SP.append(S,P,i+1)
SP.sort()
for a,b,c in SP:
  print(c)

Submission status: Runtime Error

Solution code:
N = int(input())
SP = []
for i in range(N):
  S,P = map(int,input().split())
  P = int(P)
  SP.append(S,P,i+1)
SP.sort()
for a,b,c in SP:
  print(c)

Submission status: Runtime Error

Solution code:
N = int(input())
SP = [list(map(int,input().split()))for _ in range(N)]
SP.sort()
for i in SP.values():
  print(i)

Submission status: Runtime Error

Solution code:
N = int(input())
A = []
for x in range(N):
  s, p = input().split()
  A.sppend([s, -int(p), x+1])
  
A.sort()

for i in range(N):
  print(A[i][2])

Submission status: Runtime Error

Solution code:
n = int(input())
spi = []
for i in range(n):
    s, p = map(input().split())
    spi.append((s,-int(p), i))
spi = sorted(spi)
for s, p, i in spi:
    print(i+1)

Submission status: Runtime Error

Solution code:
n = int(input())

d = [input().split() + [i+1] for i in range(N)]
d = sorted(d, key=lambda x:x[1], reverse=True)
d = sorted(d, key=lambda x:x[0], reverse=False)
for s in d:
    print(s[-1])

Submission status: Runtime Error

Solution code:
sp = []
for i in range(n):
    s, p = input().split()
    sp.append((s, int(p), i+1))

sp_sort = sorted(sp, key=lambda x: (x[0], -1 * x[1]))

for i in range(n):
    print(sp_sort[i][2])

Submission status: Runtime Error

Solution code:

N = int(input())
SP = []
for i in range(N):
    s, p = input().split()
    p = int(p)
    SP.append((s, -n, i))
SP.sort()

for s, n, i in SP:
    print(i+1)

Submission status: Runtime Error

Solution code:
n = int(input())

restrunt=[]

for i in range(n):
    a, b = input().split()
    restrunt.append( {"s":a, "t":int(b), "nom":i+1} )

restrunt.sort(key=lambda res:res["p"], reverse=True)
restrunt.sort(key=lambda res: res["s"])
for res in restrunt:
    print(res["nom"])

Submission status: Runtime Error

Solution code:
N=int(input())
rest=[]
for i in range(1,N+1):
    s,p=input().split()
    p=int(p)
    rest.append((s,-p,i))



for i in range(N):
    print(x[i][2])

Submission status: Runtime Error

Solution code:
N=int(input())
rest=[]
for i in range(1,N+1):
    s,p=input().split()
    p=int(p)
    rest.append((s,-p,i))


print(x)
for i in range(N):
    print(x[i][2])

Submission status: Runtime Error

Solution code:
n,m = map(int,input().split())
ls = []
switch = []
for i in range(n):
    switch.append(i+1)
for i in range(m):
    ks = list(map(int,input().split()))
    ls.append(ks)
p = list(map(int,input().split()))


pattern = []
for i in range(2**n):
    pattern.append(list(bin(i)[2:].zfill(n)))

ans = 0

for i in pattern:
    turn = []
    count = 0
    on = 0
    for j in range(n):
        if i[j] == '1':
            turn.append(switch[j])
    for k in range(m):
        for l in range(1,ls[k][0]+1):
            if ls[k][l] in turn:
                count += 1
        if count % 2 == p[k]:
            on += 1
    if on == m:
        ans += 1
            
print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())
review = []
for i in range(n):
    s, p = input().split()
    review.append([s, int(p), i + 1])
rev_sorted = sorted(review, key = lambda x: (x[0], x[1]), reverse = (False, True))
for i in rev_sorted:
    print(i[2])

Submission status: Runtime Error

Solution code:
N = int(input())
list=[]
for i in range(N):
    s, p = input().split()
    list.append([s, int(p)])
A=list
list.sort(key=lambda, list:(list[0], -list[1]))
for i in A:
    print(list.index(i)+1)

Submission status: Runtime Error

Solution code:
N = int(input())
list=[]
for i in range(N):
    s, p = input().split()
    list.append([s, int(p)])
lis=sorted(key=lambda, list:(list[0], -list[1]))
for i in list:
    print(lis.index(i)+1)

Submission status: Runtime Error

Solution code:
N = int(input())
S, P = ['0']*N, [0]*N
SP = []
for i in range(N):
    tmp_s, tmp_p = map(str, input().split())
    S[i], P[i] = tmp_s, tmp_p
    SP.append((tmp_s,int(tmp_p)))

# 点数で逆順ソート
SSP = sorted(SP, key=itemgetter(1), reverse=True)
# 名前で昇順ソート
SSP = sorted(SSP, key=itemgetter(0))

answer = [0]*N
for i in range(N):
    for j in range(N):
        if SSP[i] == SP[j]:
            answer[i] = j+1

for i in answer:
    print(i)

Submission status: Runtime Error

Solution code:
n=int(input())
d=0

for i in range(n):
    s,p=input().split()
    d.append(s,int(100-p),i)

d.sort()
for i in range(n):
    print(d[i][2])

Submission status: Runtime Error

Solution code:
n = int(input())

l = []
for i in range(n):
  x,y = map(str,input().split())
  l.append((x,y, i))


L = []

for i in range(n):
  L.append((l[i][0], int(l[i][1]), l[i][2]))

L.sort(key = lambda L:L[1])

L.sort(key = lambda L:L[0])

for i in range(n):
  print(L[n][2] + 1)

Submission status: Runtime Error

Solution code:
#128 b
n=int(input())
res=[]
for i in range(n):
    a,b=list(input().split())
    b=-1*int(b)
    res.append([a,b,i+1])
res=sorted(res)
for i in n:
    print(x[2])

Submission status: Runtime Error

Solution code:
n=int(input())
L=[]
for i in range(n):
    s,p=input().split()
    L.append(s,-int(p),i+1)
for l in sorted(L):
    print(l[2])

Submission status: Runtime Error

Solution code:
n, m = list(map(int, input().split()))
a = list(map(int, input().split()))

a.sort()

bc = []

for _ in range(m):
  bc.append(list(map(int, input().split())))

print(bc)

Submission status: Runtime Error

Solution code:
import sys
import math

N = int(input())

list = []

for i in range(n):
    S, P = input().split()
    list.append((S, int(P), i+1))

list = sorted(list, key=lambda x:x[1],reverse = True) 
list = sorted(list, key=lambda x:x[0]) 
for j in range(N):
	print(list[j][2])

Submission status: Runtime Error

Solution code:

n = int(input())
a = ""
b = 0
l = []

for i in range(1,n+1):
    a,b = map(str,input().split())
    b = int(b)
    l.append([a,b,i])
l.sort()

pprint.pprint(l)

for i in range(n):
    print(l[i][2])

Submission status: Runtime Error

Solution code:
n = int(input())
w = list(map(int, input().split()))
s = float("inf")
for i in range(1,n):
    x = abs(sum(w[0:i])-sum(w[i:n]))
    if x < s:
        s = x
print(s)

Submission status: Runtime Error

Solution code:
# B - Guidebook
import numpy as np
import pandas as pd 

N = int(input())
A, B = [[], []]

for _ in range(N):
  a, b = [i for i in input().split()]
  A.append(a)
  B.append(int(b))


A = np.array(A)[:, np.newaxis]
B = np.array(B)[:, np.newaxis]
C = np.concatenate([A, B], axis=1)
df = pd.DataFrame(C, index=[i+1 for i in range(N)])
df = df.sort_values([0, 1], ascending=[True, False])

for i in df.index:
  print(i)

Submission status: Runtime Error

Solution code:
# B - Guidebook
import numpy as np
import pandas as pd 

N = int(input())
A, B = [[], []]

for _ in range(N):
  a, b = [i for i in input().split()]
  A.append(a)
  B.append(int(b))


A = np.array(A)[:, np.newaxis]
B = np.array(B)[:, np.newaxis]
C = np.concatenate([A, B], axis=1)
df = pd.DataFrame(C, index=[i+1 for i in range(N)])
df = df.sort_values([0, 1])

for i in df.index:
  print(i)

Submission status: Runtime Error

Solution code:
# B - Guidebook
import numpy as np
import pandas as pd 

N = int(input())
A, B = [[], []]

for _ in range(N):
  a, b = [i for i in input().split()]
  A.append(a)
  B.append(int(b))


A = np.array(A)[:, np.newaxis]
B = np.array(B)[:, np.newaxis]
C = np.concatenate([A, B], axis=1)

print(C)
df = pd.DataFrame(C, index=[i+1 for i in range(N)])
df = df.sort_values([0, 1])
for i in df.index:
  print(i)

Submission status: Runtime Error

Solution code:

n=int(input())
for i in range(n):
	rest=list(input().split())
a=rest
rest.sort()
for i in range(n):
	print(rest.index(a[i]))

Submission status: Runtime Error

Solution code:

n=int(input())
for i in range(n):
	rest=list(input().split())
a=rest
rest.sort()
for i in range(n):
	print(rest.index(a[i])

Submission status: Runtime Error

Solution code:
N=int(input())
SP=[]
for i in range(N):
  S,P=input()
  SP.append([S,int(P),i+1])
  
l=sorted(SP,key = lamda SP : (SP[0],-SP[1]))

for i in l:
  print(SP[2])

Submission status: Runtime Error

Solution code:
n=int(input())
sp=[]
for i in range(n):
    s,p=input().split()
    sp.append([s,int(p),i+1])
    
sort=sorted(sp, key=lambda sp: (sp[0], -sp[1]))

for i in range(sort):
    print(i[2])

Submission status: Runtime Error

Solution code:
n=int(input())
sp=[]
for i in range(n):
    s,p=input().split()
    sp.append([s,int(p),i+1])
    
sort=sorted(sp, key=lambda sp: sp[0], -sp[1])

for i in range(sort):
    print(i[2])

Submission status: Runtime Error

Solution code:
salmonize
n = int(input())
l = []
for i in range(1,n+1):
  s,p = input().split()
  l.append((s,-int(p),i))
l.sort()
for x in l:
  print(x[2])

Submission status: Runtime Error

Solution code:
N=int(input())
p=1
S=[]
A=[]
U=[]
T=[]
L= [list(map(str,input().split())) for i in range(N)]
for j in range(1,N+1):
  L[j-1].append(j)
L.sort(key=lambda x: x[0])
#print(L)
S=L[:]
S.sort(reverse=True,key=lambda x: int(x[1]))
#print(S)
T.append(L[0][0])
for i in range(1,N-1):
  if L[i-1][0]!=L[i][0]:
    T.append(L[i][0])
#print(T)
for j in range(len(T)):
  for k in range(N):
    if S[k][0]==T[j]:
      A.append(S[k][2])
for i in range(N):
  print(A[i])

Submission status: Runtime Error

Solution code:
n=int(input())
l=[]
for i in range(n):
  a,b=input().split
  l.append([a,int(b),i+1])
l.sort(key=lambda x:x[0],reverse=False)
for i in range(n):
    print(l[i][2])

Submission status: Runtime Error

Solution code:
n=int(input())
l=[]
for i in range(n):
	a,b=input().split
	l.append([a,int(b),i+1])
l.sort(key=lambda x:x[0],reverse=False)
for i in range(n):
    print(l[i][2])

Submission status: Runtime Error

Solution code:
n=int(input())
l=[]
for i in range(n):
    a,b=input().split
	l.append([a,int(b),i+1])
l.sort(key=lambda x:x[0],reverse=False)
for i in range(n):
    print(l[i][2])

Submission status: Runtime Error

Solution code:
a

Submission status: Runtime Error

Solution code:
n=int(input())

l=[]
a=[]
b=[]
d={}
s=[]

for i in range(1,n+1):
    t=list(input().split())
    l.append([t[0],int(t[1])])
    if t[0] not in a:
        a.append(t[0])
    b.append(t[0])
c=l.copy()
for e in a:
    d[e]=b.count(e)
c.sort()
i=0
while i<n:
    if d[c[i][0]]==1:
        s.append(l.index(b[i]))
        i+=1
    else:
        for j in range(d[c[i][0]]):
            s.append(l.index(c[i+d[c[i][0]]-1-j])+1)
        i+=d[c[i][0]]

for i in range(n):
    print(s[i])

Submission status: Runtime Error

Solution code:
from operator import itemgetter
n=int(input())
l=[map(int,input().split()) for i in range(n)]
for i in range(n):
  l[i].append(i+1)
l2=sorted(l)
l3=sorted(l2,key=itemgetter(1),reverse=True)
for i in range(n):
  print(l3[i][2])

Submission status: Runtime Error

Solution code:
n=int(input())
sp=[]
for i in range(n):
    s,p=input().split()
    sp.append(s,-int(p),i+1)
sp.sort()
for i in sp:
    print(i[2])

Submission status: Runtime Error

Solution code:
# ABC-128-B
# score_sorted = sorted(score.items(), key=lambda x:x[0])
r_list = []
ans_list = []
N = int(input())
for i in range(1, N+1):
    Si, Pi = input().split()
    r_list.append((Si, int(Pi), i))
    
name_sorted_list = sorted(r_list, key=lambda x:x[0])
while len(name_sorted_list) > 0:
    test_list = []
    list_index = [i for i, x in enumerate(name_sorted_list) if x  == name_sorted_list[1]]
    for i in list_index:
        test_list.append(name_sorted_list[i])
        del name_sorted_list[i]
    test_list = sorted(test_list, key=lambda x:x[1])
    for item in test_list:
        ans_list.append(item)

for item in ans_list:
    print(item[2])

Submission status: Runtime Error

Solution code:
N = int(input())
l = []
for i in range(N):
    a = input().split()
    l.append([a[0], a[1], i + 1])
l.sort()
for i in range(N):
    print(a[i][2])

Submission status: Runtime Error

Solution code:
args = []
while True:
    line = input("put your line")
    if line:
        line_as_list = line.split(" ")
        args.append(line_as_list)
    else:
        break
order = []
for i in args:
    current = 0
    for p in args:
        if i[0] < p[0]:
            current += 1
        elif i[0] > p[0]:
            current -= 1
        elif i[0] == p[0]:
            if i[1] < p[1]:
                current -= 1
            elif i[1] == p[1]:
                current += 1
    order.append(current)
print(order)

Submission status: Runtime Error

Solution code:
import sys
input = sys.stdin.readline
import numpy as np
def print_ans(N, ar):
    """Test Case
    >>> print_ans(6,[["khabarovsk",-20, 1], ["moscow",-10, 2], ["kazan",-50, 3], ["kazan",-35, 4], ["moscow",-60, 5], ["khabarovsk",-40, 6]])
    3
    4
    6
    1
    5
    2
    >>> print_ans(10, [["yakutsk", -10, 1 ], ["yakutsk", -20, 2 ], ["yakutsk", -30, 3 ], ["yakutsk", -40, 4 ], ["yakutsk", -50, 5 ], ["yakutsk", -60, 6 ], ["yakutsk", -70, 7 ], ["yakutsk", -80, 8 ], ["yakutsk", -90, 9 ], ["yakutsk", -100,10]])
    10
    9
    8
    7
    6
    5
    4
    3
    2
    1
    """
    ans = sorted(ar)
    for a in ans:
        print(a[2])

if __name__ == '__main__':
    N = int(input().rstrip())
    ar = []
    for i in range(N):
        s, p = input().rstrip().split()
        n = int(n)
        ar.append([s, -n, i + 1])
    print_ans(N, ar)

Submission status: Runtime Error

Solution code:
import sys
input = sys.stdin.readline
import numpy as np
def print_ans(N, ar):
    """Test Case
    >>> print_ans(6,[["khabarovsk",-20, 1], ["moscow",-10, 2], ["kazan",-50, 3], ["kazan",-35, 4], ["moscow",-60, 5], ["khabarovsk",-40, 6]])
    3
    4
    6
    1
    5
    2
    >>> print_ans(10, [["yakutsk", -10, 1 ], ["yakutsk", -20, 2 ], ["yakutsk", -30, 3 ], ["yakutsk", -40, 4 ], ["yakutsk", -50, 5 ], ["yakutsk", -60, 6 ], ["yakutsk", -70, 7 ], ["yakutsk", -80, 8 ], ["yakutsk", -90, 9 ], ["yakutsk", -100,10]])
    10
    9
    8
    7
    6
    5
    4
    3
    2
    1
    """
    ans = sorted(ar)
    for a in ans:
        print(a[2])

if __name__ == '__main__':
    N = int(input().rstrip())
    ar = []
    for i in range(N):
        s, p = input().rstrip().split()
        n = int(n)
        ar.append((s, -n, i + 1))
    print_ans(N, ar)

Submission status: Runtime Error

Solution code:
from operator import itemgetter

n = int(input())
s = [[x, *(input().split())] for x in range(n)]

s = sorted(s, key = itemgetter(2), reverse=True)
s = sorted(s, key = itemgetter(1))

for i in s:
    print(i[0]+1)

Submission status: Runtime Error

Solution code:
n = int(input())
f = []
s = []
p = []
for i in range(n):
    f += [list(map(str, input().split(" ")))]
    s += [f[i][0]]
    p += [int(f[i][1])]
print(p)
s.sort()
p.sort(reverse=True)
print(p)
ans = [0] * n
count = 0
for i in s:
    for j in p:
        if [i, str(j)] in f:
            ans[count] = f.index([i, str(j)]) + 1
            p[p.index(j)] = 0
            s[s.index(i)] = 0
            count += 1

for i in range(n):
    print(ans[i])

Submission status: Runtime Error

Solution code:
n=int(input())
s,p=list(map(input().split()))
p=int(p)
li=[]

for i in range(0,n):
  li.append((i+1,s[i],p[i]))


new_li=sorted(li,key=lambda x:x[2] , reverse=True)
new2_li=sorted(new_li,key=lambda x:x[1])


for j in range(0,n):
  print(new2_li[j][0])

Submission status: Runtime Error

Solution code:
n=int(input())
s,p=input().split()
p=int(p)
li=[]

for i in range(0,n):
  li.append((i+1,s,p))


new_li=sorted(li,key=lambda x:(x[1],-x[2]))


for j in range(len(new2_li)):
  print(new_li[j][0])

Submission status: Runtime Error

Solution code:
n=int(input())
s,p=input().split()
p=int(p)
li=[]

for i in range(0,n):
  li.append((i+1,s[i],p[i]))

new_li=sorted(li,key=lambda x:x[1])

new2_li=sorted(new_li,key=lambda x:x[2] , reverse=True)

for j in range(0,n):
  print(new2_li[j][0])

Submission status: Runtime Error

Solution code:
n=int(input())
s,p=list(input().split())

li=[]
for i in range(0,n):
  li.append((i+1,s[i],p[i]))

new_li=sorted(li,key=lambda x:x[1])

new2_li=sorted(new_li,key=lambda x:x[2] , reverse=True)

for j in range(0,n):
  print(new2_li[j][0])

Submission status: Runtime Error

Solution code:
n=int(input())
s=str(input().split())
p=int(input().split())
li=[]
for i in range(0,n):
  li.append((i+1,s[i],p[i]))

new_li=sorted(li,key=lambda x:x[1])

new2_li=sorted(new_li,key=lambda x:x[2] , reverse=True)

for j in range(0,n):
  print(new2_li[j][0])

Submission status: Runtime Error

Solution code:
n=int(input())
s,p=int(input().split())
li=[]
for i in range(0,n):
  li.append((i+1,s[i],p[i]))

new_li=sorted(li,key=lambda x:x[1])

new2_li=sorted(new_li,key=lambda x:x[2] reverse=True)

for j in range(0,n):
  print(new2_li[j][0])

Submission status: Runtime Error

Solution code:
n=int(input())
s,p=list(map(int,input().split()))
li=[]
for i in range(0,n):
  li.append((i+1,s[i],p[i]))

new_li=sorted(li,key=lambda x:x[1])
new2_li=sorted(new_li,key=lambda x:x[2])

for j in range(0,n):
  print(new2_li[j][0])

Submission status: Runtime Error

Solution code:
n=int(input())
s,p=list(map(int,input().split()))
li=[]
for i in range(0,n):
  li.append(i+1,s[i],p[i])

new_li=sorted(li,key=lambda x:x[1])
new2_li=sorted(new_li,key=lambda x:x[2])

for j in range(0,n):
  print(new2_li[j][0])