ZhenlongDai/ACPR huggingface dataset:
Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A = [0 for i in range(N)]
for i in range(N):
    A[i] = list(map(str,input().split()))

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

C = sorted(B, key=lambda x: x[0])

for i in range(N):
    print(C[i])

Failing test case input:
10
yakutsk 10
yakutsl 28
yakutsk 30
y`kutsk 0
yakutsk 18
yakutsk 60
yakutsk 70
yakktsu 80
yakutsk 90
yakutsk 100

Expected output:
4
8
10
9
7
6
3
5
1
2


Actual output:
['y`kutsk', '0']
['yakktsu', '80']
['yakutsk', '90']
['yakutsk', '70']
['yakutsk', '60']
['yakutsk', '30']
['yakutsk', '18']
['yakutsk', '100']
['yakutsk', '10']
['yakutsl', '28']


Fixed submission (verdict: Accepted):

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


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

C = sorted(B, key=lambda x: x[0])

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

Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
sp = [input().split() for _ in range(n)]

for i in range(n):
    sp[i][1] = int(sp[i][1])
    sp[i] = sp[i]+[i+1]
    
sp_s0 = sorted(sp, key=lambda x:(x[0], -x[1]), reverse=False)
print(sp_s0)

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

Failing test case input:
6
ksvorabahk 28
onrdwm -1
anz`k 18
`njaz 19
sdlomw 20
ksarnvbahl 1

Expected output:
4
3
6
1
2
5


Actual output:
[['`njaz', 19, 4], ['anz`k', 18, 3], ['ksarnvbahl', 1, 6], ['ksvorabahk', 28, 1], ['onrdwm', -1, 2], ['sdlomw', 20, 5]]
4
3
6
1
2
5


Fixed submission (verdict: Accepted):
n = int(input())
sp = [input().split() for _ in range(n)]

for i in range(n):
    sp[i][1] = int(sp[i][1])
    sp[i] = sp[i]+[i+1]
    
sp_s0 = sorted(sp, key=lambda x:(x[0], -x[1]), reverse=False)

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

Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
X =[]
for i in range(N):
  SS,PP = map(str,input().split())
  X.append([int(i+1), SS, int(PP)])

A = sorted(X, key=lambda X:(X[1],-X[2]))
print (A)

Failing test case input:
6
rgkkbvbtoa 12
eyqooq -1
k^zn` 13
joaay 23
omdwsl -3
jb`qnvtajl 1

Expected output:
2
6
4
3
5
1


Actual output:
[[2, 'eyqooq', -1], [6, 'jb`qnvtajl', 1], [4, 'joaay', 23], [3, 'k^zn`', 13], [5, 'omdwsl', -3], [1, 'rgkkbvbtoa', 12]]


Fixed submission (verdict: Accepted):
N = int(input())
X =[]
for i in range(N):
  SS,PP = map(str,input().split())
  X.append([int(i+1), SS, int(PP)])

A = sorted(X, key=lambda X:(X[1],-X[2]))

for i in range(N):
    print(A[i][0])
Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from operator import itemgetter
N = int(input())
childs = [list(input().split()) for _ in range(N)]

a = sorted(childs, key=itemgetter(1), reverse=True)
b = sorted(a, key=itemgetter(0))

for i in b:
    print(childs.index(i)+1)

Failing test case input:
10
yakutsk 10
yakutsl 28
yakutsk 30
y`kutsk 0
yakvtsk 18
yakutsk 60
yakutsk 70
yakktsu 80
yakutsk 90
yakutsk 100

Expected output:
4
8
10
9
7
6
3
1
2
5


Actual output:
4
8
9
7
6
3
10
1
2
5


Fixed submission (verdict: Accepted):
from operator import itemgetter
N = int(input())
childs = [list(input().split()) for _ in range(N)]
for i in childs:
    i[1] = int(i[1])

a = sorted(childs, key=itemgetter(1), reverse=True)
b = sorted(a, key=itemgetter(0))

for i in b:
    print(childs.index(i)+1)

Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
sp = [input().split() + [i+1] for i in range(n)]
sp.sort(key=(lambda x: x[1]), reverse=True)
sp.sort(key=(lambda x: x[0]))
for i in range(n):
    print(sp[i][2])


Failing test case input:
10
yakutsk 10
yakutsk 20
yakutsk 30
yakutsk 40
yakutsk 50
yakutsk 60
yakutsk 70
yakutsk 80
yakutsk 90
yakutsk 100

Expected output:
10
9
8
7
6
5
4
3
2
1

Actual output:
9
8
7
6
5
4
3
2
10
1


Fixed submission (verdict: Accepted):
n = int(input())
sp = [input().split() + [i+1] for i in range(n)]
sp.sort(key=(lambda x: int(x[1])), reverse=True)
sp.sort(key=(lambda x: x[0]))
for i in range(n):
    print(sp[i][2])

Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
sp=[]
for i in range(n):
    a=list(map(str,input().split()))
    a.append(i+1)
    sp.append(a)


sp=sorted(sp,key=lambda x:x[0])

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

Failing test case input:
10
yakuusk 10
aykstul 53
yakutsk 49
y`kutsk -1
yakvtsk 5
yakutsk 60
yajutsk 70
yakksut 18
kstukay 160
yakutsk 100

Expected output:
2
9
4
7
8
10
6
3
1
5


Actual output:
2
9
4
7
8
3
6
10
1
5


Fixed submission (verdict: Accepted):
n=int(input())
sp=[]
for i in range(n):
    a=list(map(str,input().split()))
    a.append(i+1)
    sp.append(a)

sp=sorted(sp,key=lambda x:int(x[1]),reverse=True)
sp=sorted(sp,key=lambda x:x[0])

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

Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
temp=[0]*n
for i in range(0,n):
  s,p=input().split()
  temp[i]=[i,s,int(p)]
temp=sorted(temp, key=lambda x: (x[1],-x[2]))
for i in range(0,n):
  print(temp[i])



Failing test case input:
10
yakusrl 17
lutsayj 2
zatujsk 125
svlk`ty -1
isvykat 23
skskvax 5
kstujby 147
yvstlbl 001
yauktsk 317
jrsakuy 111

Expected output:
5
10
7
2
6
4
1
9
8
3


Actual output:
[4, 'isvykat', 23]
[9, 'jrsakuy', 111]
[6, 'kstujby', 147]
[1, 'lutsayj', 2]
[5, 'skskvax', 5]
[3, 'svlk`ty', -1]
[0, 'yakusrl', 17]
[8, 'yauktsk', 317]
[7, 'yvstlbl', 1]
[2, 'zatujsk', 125]


Fixed submission (verdict: Accepted):
n=int(input())
temp=[0]*n
for i in range(0,n):
  s,p=input().split()
  temp[i]=[i,s,int(p)]
temp=sorted(temp, key=lambda x: (x[1],-x[2]))
for i in range(0,n):
  print(temp[i][0]+1)
Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())

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

ans = sorted(s,key=lambda x : (x[0],x[1]))

for a in ans:
  print(a[2])

Failing test case input:
10
yakutsk 10
yakutsk 20
yakutsk 30
yakutsk 40
yakutsk 50
yakutsk 60
yakutsk 70
yakutsk 80
yakutsk 90
yakutsk 100

Expected output:
10
9
8
7
6
5
4
3
2
1

Actual output:
1
2
3
4
5
6
7
8
9
10


Fixed submission (verdict: Accepted):
n = int(input())

s = []
for i in range(n):
	S,P=input().split()
	s.append([S,-int(P),i+1])

ans = sorted(s,key=lambda x : (x[0],x[1]))

for a in ans:
  print(a[2])

Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
d=[input().split()+[i+1] for i in range(N)]
d.sort(key=lambda x:(x[0],-int(x[1])))
print(d)
for i in d:
  print(i[2])

Failing test case input:
10
yakutsk 34
lutsayk 63
ysjutak 102
yst`lvk 0
yakvtsj 7
yavktks 60
kstujay 117
tvlskby 61
kstkuay 188
yatuksj 111

Expected output:
9
7
2
8
1
5
10
6
3
4


Actual output:
[['kstkuay', '188', 9], ['kstujay', '117', 7], ['lutsayk', '63', 2], ['tvlskby', '61', 8], ['yakutsk', '34', 1], ['yakvtsj', '7', 5], ['yatuksj', '111', 10], ['yavktks', '60', 6], ['ysjutak', '102', 3], ['yst`lvk', '0', 4]]
9
7
2
8
1
5
10
6
3
4


Fixed submission (verdict: Accepted):
N=int(input())
d=[input().split()+[i+1] for i in range(N)]
d.sort(key=lambda x:(x[0],-int(x[1])))
for i in d:
  print(i[2])

Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
li=[0]*n
for i in range(n):
    a=input().split()
    li[i]=[a[0], -int(a[1]), i+1]

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

Failing test case input:
10
yakutsk 10
yakutsl 28
yakutsk 30
y`kutsk 0
yakutsk 18
yakutsk 60
yakutsk 70
yakktsu 80
yakutsk 90
yakutsk 100

Expected output:
4
8
10
9
7
6
3
5
1
2


Actual output:
[['y`kutsk', 0, 4], ['yakktsu', -80, 8], ['yakutsk', -100, 10], ['yakutsk', -90, 9], ['yakutsk', -70, 7], ['yakutsk', -60, 6], ['yakutsk', -30, 3], ['yakutsk', -18, 5], ['yakutsk', -10, 1], ['yakutsl', -28, 2]]
4
8
10
9
7
6
3
5
1
2


Fixed submission (verdict: Accepted):
n=int(input())
li=[0]*n
for i in range(n):
    a=input().split()
    li[i]=[a[0], -int(a[1]), i+1]

li.sort(key=lambda x:(x[0],int(x[1])))

for i in li:
    print(i[2])
Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
dct=[]
for i in range(n):
  d = input().split()
  name = d[0]
  score = int(d[1])
  dct.append([name,-score,i+1])

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

Failing test case input:
10
lkassry 1
t`xsujl -4
zatvjtj 12
lt`skuy -1
iyvlsat 22
skskvax -1
ycktusk 28
lyltcvu 100
jstjvay 118
kuyasri 101

Expected output:
5
9
10
1
4
8
6
2
7
3


Actual output:
[['iyvlsat', -22, 5], ['jstjvay', -118, 9], ['kuyasri', -101, 10], ['lkassry', -1, 1], ['lt`skuy', 1, 4], ['lyltcvu', -100, 8], ['skskvax', 1, 6], ['t`xsujl', 4, 2], ['ycktusk', -28, 7], ['zatvjtj', -12, 3]]
5
9
10
1
4
8
6
2
7
3


Fixed submission (verdict: Accepted):
n = int(input())
dct=[]
for i in range(n):
  d = input().split()
  name = d[0]
  score = int(d[1])
  dct.append([name,-score,i+1])

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

Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
A=[]
for i in range(N):
    D=list(input().split())
    D.append(i+1)
    A.append(D)
B=sorted(A, key=lambda x: x[1])
B.reverse()
C=sorted(B, key=lambda x: x[0])
for i in range(N):
    print(C[i][2])   

Failing test case input:
10
yakutsk 10
yakutsk 20
yakutsk 30
yakutsk 2
yakutsk 50
yakutsk 60
yakutsk 70
yakktsu 80
yakutsk 90
yakutsk 100

Expected output:
8
10
9
7
6
5
3
2
1
4


Actual output:
8
9
7
6
5
3
2
4
10
1


Fixed submission (verdict: Accepted):
N=int(input())
A=[]
for i in range(N):
    E=list(input().split())
    D=[E[0],int(E[1])]
    D.append(i+1)
    A.append(D)
B=sorted(A, key=lambda x: x[1])
B.reverse()
C=sorted(B, key=lambda x: x[0])
for i in range(N):
    print(C[i][2])

Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n = ii()
l = []
for i in range(n):
    tmp = isl()
    tmp.append(i+1)
    l.append(tmp)

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

l = sorted(l,key=lambda x:x[0])
for j in l:
    print(j[2])

Failing test case input:
10
yakutsk 10
yakutsl 28
yakutsk 30
y`kutsk 0
yakutsk 18
yakutsk 60
yakutsk 70
yakktsu 80
yakutsk 90
yakutsk 100

Expected output:
4
8
10
9
7
6
3
5
1
2


Actual output:
4
8
9
7
6
3
5
10
1
2


Fixed submission (verdict: Accepted):
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n = ii()
l = []
for i in range(n):
    tmp = isl()
    tmp.append(i+1)
    l.append(tmp)

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

l = sorted(l,key=lambda x:x[0])
for j in l:
    print(j[2])
Problem: p03030
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
n = int(input())
l = []
for i in range(n):
    x, y = input().split()
    l.append([i, x, int(y)])
l = sorted(l, key=lambda x:(x[1], x[2]))
for i in l:
    print(i[0])

Failing test case input:
10
yakuusk 18
kyastul 53
yskutak 76
k`kutsy -1
yakvtsk 5
kstkvay 60
yajutsk 70
ybkksut 18
kstukay 160
yakutsk 110

Expected output:
4
6
9
2
7
10
1
5
8
3


Actual output:
3
5
8
1
6
9
0
4
7
2


Fixed submission (verdict: Accepted):
n = int(input())
l = []
for i in range(n):
    x, y = input().split()
    l.append([i+1, x, -int(y)])
l = sorted(l, key=lambda x:(x[1],x[2]))

for i in l:
    print(i[0])

Problem: p03030
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
L=[]
for i in range(n):
  s,p=input().split()
  L.append([s,int(p),i+1])
list.sort(L,reverse=True)
for i in range(n):
  print(L[i][2])


Failing test case input:
10
yakutsl 17
kyastul 49
ysjutak 102
tvl`kty 0
takvysi 11
xavksks 3
kstujby 117
ybstlvk 116
yauktsk 317
jrkutay 111

Expected output:
10
7
2
5
4
6
1
9
8
3


Actual output:
3
8
9
1
6
4
5
2
7
10


Fixed submission (verdict: Accepted):
n = int(input())
L=[]
for i in range(n):
  s,p=input().split()
  L.append([s,-int(p),i+1])
list.sort(L)
for i in range(n):
  print(L[i][2])

Problem: p03030
Buggy submission (Python (3.8.2), verdict: Wrong Answer):

N = int(input())
Shop_List=[]
for i in range(N):
    Temp_List=list(input().split())
    Temp_List[1]=int(Temp_List[1])
    Temp_List.append(i+1)
    Shop_List.append(Temp_List)


Shop_List_Sorted = sorted(Shop_List, key=lambda x:(x[0], x[1]))
for k in range(N):
    print(Shop_List_Sorted[k][2])


Failing test case input:
6
khabarovsk 20
moscow 18
kazan 50
kazan 35
moscow 14
khabarovsk 40

Expected output:
3
4
6
1
2
5


Actual output:
4
3
1
6
5
2


Fixed submission (verdict: Accepted):

N = int(input())
Shop_List=[]
for i in range(N):
    Temp_List=list(input().split())
    Temp_List[1]=int(Temp_List[1])
    Temp_List.append(i+1)
    Shop_List.append(Temp_List)


Shop_List_Sorted = sorted(Shop_List, key=lambda x:(x[0], -x[1]))
for k in range(N):
    print(Shop_List_Sorted[k][2])

Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
r = []
for i in range(n):
    city, score = map(str, input().split())
    score = int(score)
    r.append((city, score, i+1))

r.sort(key=lambda x: x[1], reverse=True)
print(r)
r.sort(key=lambda x: x[0])
print(r)

for x in r:
    print(x[2])


Failing test case input:
6
pgkj`vbto` 3
dymoqn 2
`ny]j -2
ajbyo 1
owensl 2
jb`qnvuajl -9

Expected output:
3
4
2
6
5
1


Actual output:
[('pgkj`vbto`', 3, 1), ('dymoqn', 2, 2), ('owensl', 2, 5), ('ajbyo', 1, 4), ('`ny]j', -2, 3), ('jb`qnvuajl', -9, 6)]
[('`ny]j', -2, 3), ('ajbyo', 1, 4), ('dymoqn', 2, 2), ('jb`qnvuajl', -9, 6), ('owensl', 2, 5), ('pgkj`vbto`', 3, 1)]
3
4
2
6
5
1


Fixed submission (verdict: Accepted):
n = int(input())
r = []
for i in range(n):
    city, score = map(str, input().split())
    score = int(score)
    r.append((city, score, i+1))

r.sort(key=lambda x: x[1], reverse=True)
r.sort(key=lambda x: x[0])

for x in r:
    print(x[2])
Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

import copy

N = int(input())
list = [input().split() for i in range(N)]
list2 = copy.deepcopy(list)
list2.sort(key=lambda x:(x[0],-int(x[1])))
print(list2)

for i in range(N):
    a = list2[i]
    b = list.index(a)
    print(int(b + 1))

Failing test case input:
6
khabarovsk 20
moscow 18
kazan 50
kazan 35
moscow 14
khabarovsk 40

Expected output:
3
4
6
1
2
5


Actual output:
[['kazan', '50'], ['kazan', '35'], ['khabarovsk', '40'], ['khabarovsk', '20'], ['moscow', '18'], ['moscow', '14']]
3
4
6
1
2
5


Fixed submission (verdict: Accepted):

import copy

N = int(input())
list = [input().split() for i in range(N)]
list2 = copy.deepcopy(list)
list2.sort(key=lambda x:(x[0],-int(x[1])))

for i in range(N):
    a = list2[i]
    b = list.index(a)
    print(int(b + 1))

Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
rest = {}
cities = []
for i in range(N):
    k,s = input().split()
    if k not in rest:
        rest[k] = []
        cities.append(k)
    rest[k].append([int(s),i+1])
print(sorted(rest))
for k in cities:
    rest[k].sort(reverse = True)
    for i in rest[k]:
        print(i[1])

Failing test case input:
10
yakuusk 18
kyastul 53
yskutak 76
k`kutsy -1
yakvtsk 5
kstkvay 60
yajutsk 70
yakksut 18
kstukay 160
yakutsk 110

Expected output:
4
6
9
2
7
8
10
1
5
3


Actual output:
['k`kutsy', 'kstkvay', 'kstukay', 'kyastul', 'yajutsk', 'yakksut', 'yakutsk', 'yakuusk', 'yakvtsk', 'yskutak']
1
2
3
4
5
6
7
8
9
10


Fixed submission (verdict: Accepted):
N = int(input())
rest = {}
cities = []
for i in range(N):
    k,s = input().split()
    if k not in rest:
        rest[k] = []
        cities.append(k)
    rest[k].append([int(s),i+1])
cities.sort()
for k in cities:
    rest[k].sort(reverse = True)
    for i in rest[k]:
        print(i[1])

Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())

lists = []
for _ in range (N):
    S = input().split(' ')
    lists.append(S)

list_sorted = lists.copy()
list_sorted.sort()
for result in range(N):
    for sorted in range (N):
        if lists[result] == list_sorted[sorted]:
            print(sorted+1)

Failing test case input:
6
khkrbsbvoa 12
exqooq -4
`_znk 20
kaoaz 18
lswdmo -3
jbaqnvtajl 0

Expected output:
3
2
6
4
1
5


Actual output:
5
2
1
4
6
3


Fixed submission (verdict: Accepted):
N = int(input())

lists = []
for _ in range (N):
    S = input().split(' ')
    lists.append([S[0],int(S[1])])

list_sorted = lists.copy()

list_sorted.sort()
list_sorted.sort(key=lambda x:(x[0],-x[1]),reverse =False)
for sorted in range (N):
    for result in range(N):
        if lists[result] == list_sorted[sorted]:
            print(result+1)
Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from operator import itemgetter

n = int(input())
sp = [input().split() for i in range(n)]

for i in range(n):
  sp[i].append(i+1)

sp = sorted(sp, key=itemgetter(1), reverse=True)
sp = sorted(sp, key=itemgetter(0))

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

Failing test case input:
10
yakuusk 10
aykstul 53
yakutsk 49
y`kutsk -1
yakvtsk 5
yauktsk 60
yajutsk 70
yakksut 18
kstukay 160
yakutsk 100

Expected output:
2
9
4
7
8
10
3
1
5
6


Actual output:
2
9
4
7
8
3
10
1
5
6


Fixed submission (verdict: Accepted):
from operator import itemgetter

n = int(input())
sp = [input().split() for i in range(n)]

for i in range(n):
  sp[i][1] = int(sp[i][1])
  sp[i].append(i+1)

sp = sorted(sp, key=itemgetter(1), reverse=True)
sp = sorted(sp, key=itemgetter(0))

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

Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def main():
    N = int(input())
    SP = []
    for _ in range(N):
        temp = input().split()
        SP.append((temp[0], int(temp[1])))

    sorted_SP = sorted(SP, key=lambda x: x[1], reverse=True)
    sorted_SP = sorted(sorted_SP, key=lambda x: x[0])

    indices = [SP.index(x)+1 for x in sorted_SP]
    
    print(indices)

if __name__ == '__main__':
    main()

Failing test case input:
10
yrssakl 0
t`xsujl -2
zatujtj 54
yt`klus -1
iyvlsat 30
skskvax -1
ycktusk 88
tvctlxl 100
jstjvay 112
kuyasri 111

Expected output:
5
9
10
6
2
8
7
1
4
3


Actual output:
[5, 9, 10, 6, 2, 8, 7, 1, 4, 3]


Fixed submission (verdict: Accepted):
def main():
    N = int(input())
    SP = []
    for _ in range(N):
        temp = input().split()
        SP.append((temp[0], int(temp[1])))

    sorted_SP = sorted(SP, key=lambda x: x[1], reverse=True)
    sorted_SP = sorted(sorted_SP, key=lambda x: x[0])

    indices = [SP.index(x)+1 for x in sorted_SP]
    
    for i in indices:
        print(i)

if __name__ == '__main__':
    main()

Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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])

Failing test case input:
10
yakutsk 10
yakutsl 28
yakutsk 30
y`kutsk 0
yakutsk 18
yakutsk 60
yakutsk 70
yakktsu 80
yakutsk 90
yakutsk 100

Expected output:
4
8
10
9
7
6
3
5
1
2


Actual output:
4
8
9
7
6
3
5
10
1
2


Fixed submission (verdict: Accepted):
n = int(input())

d = [input().split() + [i+1] for i in range(n)]
d = sorted(d, key=lambda x:int(x[1]), reverse=True)
d = sorted(d, key=lambda x:x[0], reverse=False)
for s in d:
    print(s[-1])
Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input().strip())

list = [input() for i in range(N)]
print(list)

from operator import itemgetter
sort1 = sorted(list, key=itemgetter(0))
sort2 = sorted(sort1, key=itemgetter(1), reverse= True)
print(sort2)

for i in range(N):
    print(sort2.index(list[i]) + 1)


Failing test case input:
10
yakuusk 18
kyastul 53
yskutak 76
k`kutsy -1
yakvtsk 5
kstkvay 60
yajutsk 70
yakksut 18
kstukay 160
yakutsk 110

Expected output:
4
6
9
2
7
8
10
1
5
3


Actual output:
['yakuusk 18', 'kyastul 53', 'yskutak 76', 'k`kutsy -1', 'yakvtsk 5', 'kstkvay 60', 'yajutsk 70', 'yakksut 18', 'kstukay 160', 'yakutsk 110']
['kyastul 53', 'kstkvay 60', 'kstukay 160', 'yskutak 76', 'yakuusk 18', 'yakvtsk 5', 'yajutsk 70', 'yakksut 18', 'yakutsk 110', 'k`kutsy -1']
5
1
4
10
6
2
7
8
3
9


Fixed submission (verdict: Accepted):
N = int(input().strip())

list = [input().strip().split() for i in range(N)]

from operator import itemgetter

sort1 = sorted(list, key=lambda x: int(x[1]), reverse=True)
sort2 = sorted(sort1, key=itemgetter(0))

for i in range(N):
    print(list.index(sort2[i]) + 1)

Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
list = [input().split(' ') for i in range(n)]
restaurant = [[n+1, list[n][0], int(list[n][1])] for n in range(n)]

print(restaurant)

restaurant.sort(reverse=True, key=lambda x: x[2])
restaurant.sort(key=lambda x: x[1])
for i,_,_ in restaurant:
    print(i)

Failing test case input:
10
yakutsk 9
kyastul 49
ysjutak 102
yst`lvk 0
yakvtsj 7
yavktks 4
kstujay 117
ybkslvt 82
kstkuay 188
jrkutay 111

Expected output:
10
9
7
2
1
5
6
8
3
4


Actual output:
[[1, 'yakutsk', 9], [2, 'kyastul', 49], [3, 'ysjutak', 102], [4, 'yst`lvk', 0], [5, 'yakvtsj', 7], [6, 'yavktks', 4], [7, 'kstujay', 117], [8, 'ybkslvt', 82], [9, 'kstkuay', 188], [10, 'jrkutay', 111]]
10
9
7
2
1
5
6
8
3
4


Fixed submission (verdict: Accepted):
n = int(input())
list = [input().split(' ') for i in range(n)]
restaurant = [[n+1, list[n][0], int(list[n][1])] for n in range(n)]

restaurant.sort(reverse=True, key=lambda x: x[2])
restaurant.sort(key=lambda x: x[1])
for i,_,_ in restaurant:
    print(i)
Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())

xy = []
for i in range(N):
    x, y = map(str, input().split())
    y = int(y)
    xy.append([x, y])

print(xy)

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

for i in range(N):
    for j in range(N):
        if xy[i][0] == sort_xy[j][0]:
            if xy[i][1] == sort_xy[j][1]:
                print(j + 1)
                

Failing test case input:
10
yakuusk 10
aykstul 53
yakutsk 49
y`kutsk -1
yakvtsk 5
yauktsk 60
yajutsk 70
yakksut 18
kstukay 160
yakutsk 100

Expected output:
2
9
4
7
8
10
3
1
5
6


Actual output:
[['yakuusk', 10], ['aykstul', 53], ['yakutsk', 49], ['y`kutsk', -1], ['yakvtsk', 5], ['yauktsk', 60], ['yajutsk', 70], ['yakksut', 18], ['kstukay', 160], ['yakutsk', 100]]
8
5
6
10
9
4
3
7
1
2


Fixed submission (verdict: Accepted):
N = int(input())

xy = []
for i in range(N):
    x, y = map(str, input().split())
    y = int(y)
    xy.append([x, y])

sort_xy = sorted(sorted(xy), key=lambda x: (x[0],-x[1]))

for i in range(N):
    for j in range(N):
        if sort_xy[i][0] == xy[j][0]:
            if sort_xy[i][1] == xy[j][1]:
                print(j + 1)

Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
B = []
for i in range(N):
    s,p = map(str,input().split())
    tmp = [i+1,s,int(p)]
    B.append(tmp)
B.sort(key=lambda x:x[2],reverse=True)
B.sort(key=lambda x:x[1])
print(B)
for x in B:
    print(x[0])


Failing test case input:
10
yakutsk 9
kyastul 49
ysjutak 102
yst`lvk 0
yakvtsj 7
yavktks 4
kstujay 117
ybkslvt 82
kstkuay 188
jrkutay 111

Expected output:
10
9
7
2
1
5
6
8
3
4


Actual output:
[[10, 'jrkutay', 111], [9, 'kstkuay', 188], [7, 'kstujay', 117], [2, 'kyastul', 49], [1, 'yakutsk', 9], [5, 'yakvtsj', 7], [6, 'yavktks', 4], [8, 'ybkslvt', 82], [3, 'ysjutak', 102], [4, 'yst`lvk', 0]]
10
9
7
2
1
5
6
8
3
4


Fixed submission (verdict: Accepted):
N = int(input())
B = []
for i in range(N):
    s,p = map(str,input().split())
    tmp = [i+1,s,int(p)]
    B.append(tmp)
B.sort(key=lambda x:x[2],reverse=True)
B.sort(key=lambda x:x[1])
for x in B:
    print(x[0])

Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
l=[[i+1] for i in range(n)]
for i in range(n):
    l[i]+=list(input().split(' '))
print(l)
l.sort(key=lambda x:x[2],reverse=True)
l.sort(key=lambda x:x[1])
for i in range(n):
    print(l[i][0])

Failing test case input:
10
yakutsk 9
kyastul 49
ysjutak 102
ytt`lvk 0
takvysj 7
xavktks 4
kstujay 117
ybkslvt 82
kstkuay 188
jrkutay 111

Expected output:
10
9
7
2
5
6
1
8
3
4


Actual output:
[[1, 'yakutsk', '9'], [2, 'kyastul', '49'], [3, 'ysjutak', '102'], [4, 'ytt`lvk', '0'], [5, 'takvysj', '7'], [6, 'xavktks', '4'], [7, 'kstujay', '117'], [8, 'ybkslvt', '82'], [9, 'kstkuay', '188'], [10, 'jrkutay', '111']]
10
9
7
2
5
6
1
8
3
4


Fixed submission (verdict: Accepted):
n=int(input())
l=[[i+1] for i in range(n)]
for i in range(n):
    l[i]+=list(input().split(' '))
    l[i][2]=int(l[i][2])

l.sort(key=lambda x:x[2],reverse=True)
l.sort(key=lambda x:x[1])
for i in range(n):
    print(l[i][0])
Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
a=[]
b=[]


for i in range(n):
    s,p=input().split()
    p=int(p)
    a.append(s)
    b.append(p)

x=list(zip(a,b))

y=sorted(x,key=lambda x:(x[0],-x[1]))
print(y)
for i in range(n):
    print(int(x.index(y[i]))+1)

Failing test case input:
10
yakuusk 18
aykstul 53
yskutak 49
y`kutsk -1
yakvtsk 5
yavktsk 60
yajutsk 70
yakksut 18
kstukay 160
yakutsk 100

Expected output:
2
9
4
7
8
10
1
5
6
3


Actual output:
[('aykstul', 53), ('kstukay', 160), ('y`kutsk', -1), ('yajutsk', 70), ('yakksut', 18), ('yakutsk', 100), ('yakuusk', 18), ('yakvtsk', 5), ('yavktsk', 60), ('yskutak', 49)]
2
9
4
7
8
10
1
5
6
3


Fixed submission (verdict: Accepted):
n=int(input())
a=[]
b=[]


for i in range(n):
    s,p=input().split()
    p=int(p)
    a.append(s)
    b.append(p)

x=list(zip(a,b))

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

for i in range(n):
    print(int(x.index(y[i]))+1)

Problem: p03030
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N = int(input())

SP = {}
for i in range(N):
    city,score = input().split()
    if city in SP:
        SP[city].append([score,i])
    else:
        SP[city] = []
        SP[city].append([score,i])



for city in sorted(SP.keys()):
    score = sorted(SP[city], reverse=True)
    for s in score:
        print(s[1]+1)


Failing test case input:
10
yakutsk 10
yakutsk 20
yakutsk 30
yakutsk 2
yakutsk 50
yakutsk 60
yakutsk 70
yakktsu 80
yakutsk 90
yakutsk 100

Expected output:
8
10
9
7
6
5
3
2
1
4


Actual output:
8
9
7
6
5
3
2
4
10
1


Fixed submission (verdict: Accepted):
N = int(input())

SP = {}
for i in range(N):
    city,score = input().split()
    if city in SP:
        SP[city].append([int(score),i])
    else:
        SP[city] = []
        SP[city].append([int(score),i])



for city in sorted(SP.keys()):

    score = sorted(SP[city], reverse=True)
    for s in score:
        print(s[1]+1)

Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys

def main():
    num = int(sys.stdin.readline())
    
    input = [None] * num

    for i in range(num):
        read = sys.stdin.readline().split()
        input[i] = [i, read[0], int(read[1])]

    input.sort(key=lambda x:(x[1], x[2]))

    for restaurant in input:
        print(restaurant[0])

if __name__ == "__main__":
    main()


Failing test case input:
10
yrssakl 0
t`xsujl -2
zatujtj 54
yt`klus -1
iyvlsat 30
skskvax -1
ycktusk 88
tvctlxl 100
jstjvay 112
kuyasri 111

Expected output:
5
9
10
6
2
8
7
1
4
3


Actual output:
4
8
9
5
1
7
6
0
3
2


Fixed submission (verdict: Accepted):
import sys

def main():
    num = int(sys.stdin.readline())
    
    input = [None] * num

    for i in range(num):
        read = sys.stdin.readline().split()
        input[i] = [i+1, read[0], int(read[1])]

    input.sort(key=lambda x:(x[1], -x[2]))

    for restaurant in input:
        print(restaurant[0])

if __name__ == "__main__":
    main()
Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
lst = [list(input().split())+[i+1] for i in range(n)]



lst = sorted(lst, key= lambda x:(x[0],-int(x[1])))
print(lst)
for i in range(n):
   print(lst[i][2])


Failing test case input:
6
khabarovsk 20
moscow 0
nazak 50
jaz`n 10
wooscm 19
khabarovsk 2

Expected output:
4
1
6
2
3
5


Actual output:
[['jaz`n', '10', 4], ['khabarovsk', '20', 1], ['khabarovsk', '2', 6], ['moscow', '0', 2], ['nazak', '50', 3], ['wooscm', '19', 5]]
4
1
6
2
3
5


Fixed submission (verdict: Accepted):
n = int(input())
lst = [list(input().split())+[i+1] for i in range(n)]


lst = sorted(lst, key= lambda x:(x[0],-int(x[1])))

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

Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
l = [0] * n
for i in range(n):
    l[i] = list(map(str, input().split()))
    l[i][1] = int(l[i][1])
l_sorted = sorted(l, key=lambda l: l[1], reverse=True)
l_sorted = sorted(l_sorted, key=lambda l: l[0])
print(l_sorted)
for i in range(len(l)):
    print(l.index(l_sorted[i]) + 1)

Failing test case input:
6
qgkkavbtoa 3
qooqye -1
`mz]k 3
pybaj 0
owdnsk 0
jb`qnvtajl 1

Expected output:
3
6
5
4
1
2


Actual output:
[['`mz]k', 3], ['jb`qnvtajl', 1], ['owdnsk', 0], ['pybaj', 0], ['qgkkavbtoa', 3], ['qooqye', -1]]
3
6
5
4
1
2


Fixed submission (verdict: Accepted):
n = int(input())
l = [0] * n
for i in range(n):
    l[i] = list(map(str, input().split()))
    l[i][1] = int(l[i][1])
l_sorted = sorted(l, key=lambda l: l[1], reverse=True)
l_sorted = sorted(l_sorted, key=lambda l: l[0])

for i in range(len(l)):
    print(l.index(l_sorted[i]) + 1)

Problem: p03030
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
l = [[i+1]+input().split() for i in range(n) ]


l.sort(key=lambda x: [x[1],-1*x[2]])

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

Failing test case input:
10
yakutsk 10
yakutsk 20
yakutsk 30
yakutsk 40
yakutsk 50
yakutsk 60
yakutsk 70
yakutsk 80
yakutsk 90
yakutsk 100

Expected output:
10
9
8
7
6
5
4
3
2
1

Actual output:
1
2
3
4
5
6
7
8
9
10


Fixed submission (verdict: Accepted):
n = int(input())
l = []
for i in range(n):
    x,y = input().split()
    y = int(y)
    l.append([i+1,x,y])

l.sort(key=lambda x: (x[1],(x[2]*-1)))

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

Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
raw_list = [list(input().split()) for _ in range(N)]

copylist = raw_list[:]
a=sorted(copylist,key=lambda x:x[1],reverse=True) 

b=sorted(a, key=lambda x:x[0]) 



for mise in b:
    
    print(raw_list.index(mise)+1)



Failing test case input:
10
yakutsk 10
yakutsl 28
yakutsk 30
y`kutsk 0
yakvtsk 18
yakutsk 60
yakutsk 70
yakktsu 80
yakutsk 90
yakutsk 100

Expected output:
4
8
10
9
7
6
3
1
2
5


Actual output:
4
8
9
7
6
3
10
1
2
5


Fixed submission (verdict: Accepted):
N = int(input())
raw_list = [list(input().split()) for _ in range(N)]

copylist = raw_list[:]
a=sorted(copylist,key=lambda x:int(x[1]),reverse=True) 

b=sorted(a, key=lambda x:x[0]) 


for mise in b:
    
    print(raw_list.index(mise)+1)
Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
rc = [list(map(str,input().split())) for i in range(n)]

rc = (list(enumerate(rc)))

rc.sort(key=lambda x:x[1][1], reverse=True)
rc.sort(key=lambda x:x[1][0], reverse=False)

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

Failing test case input:
10
lrsukay 17
lutsayj 2
zatujsk 125
yt`llus -1
isvykat 23
skskvax 5
ksuukby 147
yvstlbl 000
yavjtsk 317
jrsakuy 111

Expected output:
5
10
7
1
2
6
9
4
8
3


Actual output:
[(4, ['isvykat', '23']), (9, ['jrsakuy', '111']), (6, ['ksuukby', '147']), (0, ['lrsukay', '17']), (1, ['lutsayj', '2']), (5, ['skskvax', '5']), (8, ['yavjtsk', '317']), (3, ['yt`llus', '-1']), (7, ['yvstlbl', '000']), (2, ['zatujsk', '125'])]
5
10
7
1
2
6
9
4
8
3


Fixed submission (verdict: Accepted):
n = int(input())
rc = []

for i in range(n):
    s,p = input().split()
    rc.append((str(s),int(p)))

rc = (list(enumerate(rc)))

rc.sort(key=lambda x:x[1][1], reverse=True)
rc.sort(key=lambda x:x[1][0], reverse=False)

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

Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
res = {}
for i in range(0, n):
  s, p = [elem for elem in input().split()]
  if not s in res:
    res[s] = [(p, i + 1)]
  else:
    res[s].append((p, i + 1))

for key in sorted(res.keys()):
  for score, idx in sorted(res[key], reverse=-1):
    print(idx)

Failing test case input:
10
yakuusk 10
aykstul 53
yakutsk 49
y`kutsk -1
yakvtsk 5
yauktsk 60
yajutsk 70
yakksut 18
kstukay 160
yakutsk 100

Expected output:
2
9
4
7
8
10
3
1
5
6


Actual output:
2
9
4
7
8
3
10
1
5
6


Fixed submission (verdict: Accepted):
n = int(input())
res = {}
for i in range(0, n):
  s, p = [elem for elem in input().split()]
  if not s in res:
    res[s] = [(int(p), i + 1)]
  else:
    res[s].append((int(p), i + 1))

for key in sorted(res.keys()):
  for score, idx in sorted(res[key], reverse=-1):
    print(idx)

Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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(int(list.index(i))+1)

Failing test case input:
10
yrssakl 0
t`xsujl -2
zatujtj 54
yt`klus -1
iyvlsat 30
skskvax -1
ycktusk 88
cvttlxl 100
jstjvay 112
kuyasri 111

Expected output:
8
5
9
10
6
2
7
1
4
3


Actual output:
1
2
3
4
5
6
7
8
9
10


Fixed submission (verdict: Accepted):
N = int(input())
list=[]
for i in range(N):
    s, p = input().split()
    list.append([s, int(p), i+1])
list.sort(key=lambda list:(list[0], -list[1]))
for i in list:
    print(i[2])
Problem: p03030
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
import math


def main():
    N = int(input())
    SP = [list(input().split()) + [i + 1] for i in range(N)]
    SP.sort(key=lambda x: (x[0], -int(x[1])))

    print(SP)

    for i in map(lambda x: x[2], SP):
        print(i)


if __name__ == '__main__':
    main()


Failing test case input:
10
yakutsk 10
yakstul 28
yakutsk 30
y`kutsk 0
yakvtsk 18
yakutsk 60
yakutsk 70
yakktsu 80
yakutsk 90
yakutsk 100

Expected output:
4
8
2
10
9
7
6
3
1
5


Actual output:
[['y`kutsk', '0', 4], ['yakktsu', '80', 8], ['yakstul', '28', 2], ['yakutsk', '100', 10], ['yakutsk', '90', 9], ['yakutsk', '70', 7], ['yakutsk', '60', 6], ['yakutsk', '30', 3], ['yakutsk', '10', 1], ['yakvtsk', '18', 5]]
4
8
2
10
9
7
6
3
1
5


Fixed submission (verdict: Accepted):
import math


def main():
    N = int(input())
    SP = [list(input().split()) + [i + 1] for i in range(N)]
    SP.sort(key=lambda x: (x[0], -int(x[1])))
    for i in map(lambda x: x[2], SP):
        print(i)


if __name__ == '__main__':
    main()

Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
P = int(input())
res= []
for i in range(P):
  a, b = input().split(' ')
  res.append((a,b,i+1))
res2 = sorted(res, key = lambda x:x[1], reverse = True)
res3 = sorted(res2, key = lambda x:x[0])
for j in range(P):
  print(res3[j][2])

Failing test case input:
10
yakutsk 10
yakutsk 20
yakutsk 30
yakutsk 40
yakutsk 50
yakutsk 60
yakutsk 70
yakktsu 80
yakutsk 90
yakutsk 100

Expected output:
8
10
9
7
6
5
4
3
2
1


Actual output:
8
9
7
6
5
4
3
2
10
1


Fixed submission (verdict: Accepted):
P = int(input())
res= []
for i in range(P):
  a, b = input().split()
  res.append((a,int(b)))
res2 = sorted(res, key = lambda x:x[1], reverse = True)
res3 = sorted(res2, key = lambda x:x[0])
for j in range(P):
  print(str(res.index(res3[j])+1))

Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from operator import itemgetter
n = int(input())
arr_ = [[str(i) for i in input().split()] for _ in range(n)]
for i in range(n):
    arr_[i].append(i+1)
    arr_[i][1] = int(arr_[i][1])

arr_.sort(key=itemgetter(1), reverse=True)
arr_.sort(key=itemgetter(0))
print(arr_)
for i in range(n):
    print(arr_[i][2])

Failing test case input:
10
lkassry 3
mujsx_t -4
yattjvj 38
yuks`tl -1
talsvyi 34
skskvax 0
ycktusk 0
lyltcvv 011
yavjtsj 144
kuxassi 100

Expected output:
10
1
8
2
6
5
3
9
7
4


Actual output:
[['kuxassi', 100, 10], ['lkassry', 3, 1], ['lyltcvv', 11, 8], ['mujsx_t', -4, 2], ['skskvax', 0, 6], ['talsvyi', 34, 5], ['yattjvj', 38, 3], ['yavjtsj', 144, 9], ['ycktusk', 0, 7], ['yuks`tl', -1, 4]]
10
1
8
2
6
5
3
9
7
4


Fixed submission (verdict: Accepted):
from operator import itemgetter
n = int(input())
arr_ = [[str(i) for i in input().split()] for _ in range(n)]
for i in range(n):
    arr_[i].append(i+1)
    arr_[i][1] = int(arr_[i][1])

arr_.sort(key=itemgetter(1), reverse=True)
arr_.sort(key=itemgetter(0))
for i in range(n):
    print(arr_[i][2])
Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
L = []
for Resturant_number in range(1, N+1):
    tmp = [Resturant_number]
    tmp += input().split()
    tmp[2] = int(tmp[2])
    L.append(tmp)
L.sort(reverse=True, key=lambda x:x[1])

for _ in range(len(L)):
    print(L.pop()[0])

Failing test case input:
6
khabarovsk 20
moscow 18
kazan 50
kaz`n 10
wocsom 14
khabarovsk 2

Expected output:
4
3
1
6
2
5


Actual output:
4
3
6
1
2
5


Fixed submission (verdict: Accepted):
N = int(input())
L = []
for Resturant_number in range(1, N+1):
    tmp = [Resturant_number]
    tmp += input().split()
    tmp[2] = int(tmp[2])
    L.append(tmp)
L.sort(key=lambda x:(x[1],-x[2]))
for Restaurant_data in L:
    print(Restaurant_data[0])

Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys

def main():
    num = int(sys.stdin.readline())
    
    input = [None] * num

    for i in range(num):
        read = sys.stdin.readline().split()
        input[i] = [i+1, read[0], int(read[1])]

    input.sort(key=lambda x:(x[1], x[2]))

    for restaurant in input:
        print(restaurant[0])

if __name__ == "__main__":
    main()


Failing test case input:
6
khabarovsk 20
moscow 10
kazan 50
kazan 35
moscow 20
khabarovsk 40

Expected output:
3
4
6
1
5
2


Actual output:
4
3
1
6
2
5


Fixed submission (verdict: Accepted):
import sys

def main():
    num = int(sys.stdin.readline())
    
    input = [None] * num

    for i in range(num):
        read = sys.stdin.readline().split()
        input[i] = [i+1, read[0], int(read[1])]

    input.sort(key=lambda x:(x[1], -x[2]))

    for restaurant in input:
        print(restaurant[0])

if __name__ == "__main__":
    main()

Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from sys import stdin

n = int(stdin.readline().rstrip())
data = [stdin.readline().rstrip().split() for _ in range(n)]

tmp = sorted(data, key=lambda x:x[1], reverse=True)
ans = sorted(tmp, key=lambda x:x[0])
for i in range(n) :print(data.index(ans[i])+1)

Failing test case input:
10
yakutsk 10
yakstul 53
yakutsk 30
y`kutsk 0
yakvtsk 18
yakutsk 60
yakutsk 70
yakktus 23
kstukay 90
yakutsk 100

Expected output:
9
4
8
2
10
7
6
3
1
5


Actual output:
9
4
8
2
7
6
3
10
1
5


Fixed submission (verdict: Accepted):
from sys import stdin

n = int(stdin.readline().rstrip())
data = [stdin.readline().rstrip().split() for _ in range(n)]

tmp = sorted(data, key=lambda x:int(x[1]), reverse=True)
ans = sorted(tmp, key=lambda x:x[0])

for i in range(n) :print(data.index(ans[i])+1)
Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
list = []
for i in range(N):
  line = input().split()
  line = [i] + line
  list.append(line)
list.sort( key=lambda x: (x[1], -int(x[2])) )
for i in range(N):
  print(list[i][0])


Failing test case input:
10
lkassry 3
mujsx_t -4
yattjvj 38
yuks`tl -1
talsvyi 34
skskvax 0
ycktusk 0
lyltcvv 011
yavjtsj 144
kuxassi 100

Expected output:
10
1
8
2
6
5
3
9
7
4


Actual output:
9
0
7
1
5
4
2
8
6
3


Fixed submission (verdict: Accepted):
N = int(input())
list = []
for i in range(N):
  line = input().split()
  line = [i + 1] + line
  list.append(line)
list.sort( key=lambda x: (x[1], -int(x[2])) )
for i in range(N - 1):
  print(list[i][0])
print(list[N-1][0], end="")

Problem: p03030
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
n = int(input())

res = []
for i in range(n):
  city, value = input().split()
  value = int(value)
  res.append([city, value, i])
res_s = sorted(res, key = lambda x: (x[0], x[1]))
for i in range(n):
  res_s[i].append(i+1)
ans = sorted(res_s, key = lambda x: x[2])
for i in range(n):
  print(ans[i][3])

Failing test case input:
10
yakutsk 34
kyastul 53
yskutak 95
yst`kvk 0
yakvtsk 7
yavktks 60
kstujay 117
ybkslvt 19
kstukay 188
yatuksk 110

Expected output:
7
9
2
1
5
10
6
8
3
4


Actual output:
4
3
9
10
5
7
1
8
2
6


Fixed submission (verdict: Accepted):
n = int(input())

res = []
for i in range(n):
  city, value = input().split()
  value = int(value)
  res.append([city, value, i+1])
res_s = sorted(res, key = lambda x: (x[0], -x[1]))
for i in range(n):
  print(res_s[i][2])

Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from operator import itemgetter
N=int(input())
SP = [input().split() for l in range(N)]
SP2 = []
for i in range(N):
    SP[i].append(i+1)
    SP2.append(tuple(SP[i]))
    
SP2 = sorted(SP2, key=itemgetter(1),reverse=True)
SP2 = sorted(SP2, key=itemgetter(0))
for j in range(N):
    print(SP2[j][2])


Failing test case input:
10
yakutsk 10
yakutsl 28
yakutsk 30
y`kutsk 0
yakutsk 50
yakutsk 60
yakutsk 70
yakktsu 80
yakutsk 90
yakutsk 100

Expected output:
4
8
10
9
7
6
5
3
1
2


Actual output:
4
8
9
7
6
5
3
10
1
2


Fixed submission (verdict: Accepted):
from operator import itemgetter
N=int(input())
SP = [input().split() for l in range(N)]
SP2 = []
for i in range(N):
    SP[i][1]=int(SP[i][1])
    SP[i].append(i+1)
    SP2.append(tuple(SP[i]))
    
SP2 = sorted(SP2, key=itemgetter(1),reverse=True)
SP2 = sorted(SP2, key=itemgetter(0))
for j in range(N):
    print(SP2[j][2])

Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
t=[]
for i in range(n):
  a=input().split()
  b=[i+1,a[0],(-1)*a[1]]
  t.append(b)

t.sort(key=lambda x:(x[1],x[0]))
print(t[0])


Failing test case input:
10
lkassry 2
t_xsjum -4
jvjttay 38
yuks`tl -1
iyvslat 34
skskvax 0
ybktusk 0
lyltcvv 011
yavjtsj 144
kuxassi 100

Expected output:
5
3
10
1
8
6
2
9
7
4


Actual output:
5, iyvslat

Fixed submission (verdict: Accepted):
n=int(input())
t=[]
for i in range(n):
  S,P=input().split()
  b=[S,-int(P),i+1]
  t.append(b)

t.sort()
for i in t:
  print(i[2])
Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
L1 = []
for i in range(N):
    L1.append(list(input().split()))

L2 = L1

ans=[]
for i in L1:
    seq = 1
    for j in L2:
        if i[0] > j[0]:
            seq += 1
        elif i[0] == j[0]:
            if i[1] < j[1]:
                seq += 1
    ans.append(seq)

for i in range(N):
    print(ans.index(i+1)+1)
    


Failing test case input:
10
yakuusk 10
aykstul 53
yakutsk 49
y`kutsk -1
yakvtsk 5
yakutsk 60
yajutsk 70
yakksut 18
kstukay 160
yakutsk 100

Expected output:
2
9
4
7
8
10
6
3
1
5


Actual output:
2
9
4
7
8
6
3
10
1
5


Fixed submission (verdict: Accepted):
N = int(input())
L1 = []
for i in range(N):
    L1.append(list(input().split()))

L2 = L1

ans=[]
for i in L1:
    seq = 1
    for j in L2:
        if i[0] > j[0]:
            seq += 1
        elif i[0] == j[0]:
            if int(i[1]) < int(j[1]):
                seq += 1
    ans.append(seq)
    
for i in range(N):
    print(ans.index(i+1)+1)

Problem: p03030
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N=int(input())
L=[list(input().split())+[i+1] for i in range(N)]
L.sort(key=lambda x: x[1],reverse=True)
L.sort(key=lambda x: x[0])
for l in L:
  print(l[2])

Failing test case input:
10
yakutsk 10
yakutsk 20
yakutsk 30
yakutsk 2
yakutsk 50
yakutsk 60
yakutsk 70
yakktsu 80
yakutsk 90
yakutsk 100

Expected output:
8
10
9
7
6
5
3
2
1
4


Actual output:
8
9
7
6
5
3
2
4
10
1


Fixed submission (verdict: Accepted):
N=int(input())
L=[list(input().split())+[i+1] for i in range(N)]
L=[[l[0],int(l[1]),l[2]] for l in L]
L.sort(key=lambda x: x[1],reverse=True)
L.sort(key=lambda x: x[0])
for l in L:
  print(l[2])

Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
number=int(input())
book=[]
for i in range(0,number):
  book.append(input().split())
for i in range(0,len(book)):
    book[i][1]=int(book[i][1])
    book[i].append(i+1)
book1=sorted(book,key=lambda x: -x[1])
book2=sorted(book1,key=lambda x: x[0])
for i in range(0,len(book2)):
  print(book[i][2])

Failing test case input:
10
yrssakl 0
t`xsujl -2
zatujtj 54
yt`klus -1
iyvlsat 30
skskvax -1
ksutkcy 88
cvttlxl 100
jstjvay 112
kuyasri 111

Expected output:
8
5
9
7
10
6
2
1
4
3


Actual output:
1
2
3
4
5
6
7
8
9
10


Fixed submission (verdict: Accepted):
number=int(input())
book=[]
for i in range(0,number):
  book.append(input().split())
for i in range(0,len(book)):
    book[i][1]=int(book[i][1])
    book[i].append(i+1)
book1=sorted(book,key=lambda x: -x[1])
book2=sorted(book1,key=lambda x: x[0])
for i in range(0,len(book2)):
  print(book2[i][2])
Problem: p03030
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
n = int(input())

res = []
for i in range(n):
  city, value = input().split()
  value = int(value)
  res.append([city, value, i])
res_s = sorted(res, key = lambda x: (x[0], x[1]))
for i in range(n):
  res_s[i].append(i)
ans = sorted(res_s, key = lambda x: x[2])
for i in range(n):
  print(ans[i][3])

Failing test case input:
6
`otbvajkgp 3
dynoqm 1
`ny]k -2
ajbyo 1
lsndwo 0
jb`qnvuajl -5

Expected output:
3
1
4
2
6
5


Actual output:
1
3
0
2
5
4


Fixed submission (verdict: Accepted):
n = int(input())

res = []
for i in range(n):
  city, value = input().split()
  value = int(value)
  res.append([city, value, i+1])
res_s = sorted(res, key = lambda x: (x[0], -x[1]))
for i in range(n):
  print(res_s[i][2])

Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
d=[]

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

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

Failing test case input:
10
yakutsk 10
yakutsl 28
yakutsk 30
y`kutsk 0
yakutsk 50
yakutsk 60
yakutsk 70
yakktsu 80
yakutsk 90
yakutsk 100

Expected output:
4
8
10
9
7
6
5
3
1
2


Actual output:
4
8
1
3
5
6
7
9
10
2


Fixed submission (verdict: Accepted):
n = int(input())
d=[]

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

d_ = sorted(d, key=lambda x:(x[0], -x[1]))

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

Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
arr = []

for i in range(n):
	s,p = input().split()
	a = {"i":i+1,"s":s,"p":int(p)}
	arr.append(a)

arr = sorted(arr, key=lambda x:x["p"], reverse=True)
print(arr)
arr = sorted(arr, key=lambda x:x["s"])

for a in arr:
	print(a["i"])


Failing test case input:
10
yakusrl 17
lutsayj 2
zatujsk 125
yt`klvs 0
isyvkat 18
xavksks 5
kstujby 95
lbltsvy 001
yauktsk 317
jrsakuy 111

Expected output:
5
10
7
8
2
6
1
9
4
3


Actual output:
[{'i': 9, 's': 'yauktsk', 'p': 317}, {'i': 3, 's': 'zatujsk', 'p': 125}, {'i': 10, 's': 'jrsakuy', 'p': 111}, {'i': 7, 's': 'kstujby', 'p': 95}, {'i': 5, 's': 'isyvkat', 'p': 18}, {'i': 1, 's': 'yakusrl', 'p': 17}, {'i': 6, 's': 'xavksks', 'p': 5}, {'i': 2, 's': 'lutsayj', 'p': 2}, {'i': 8, 's': 'lbltsvy', 'p': 1}, {'i': 4, 's': 'yt`klvs', 'p': 0}]
5
10
7
8
2
6
1
9
4
3


Fixed submission (verdict: Accepted):
n = int(input())
arr = []

for i in range(n):
	s,p = input().split()
	a = {"i":i+1,"s":s,"p":int(p)}
	arr.append(a)

arr = sorted(arr, key=lambda x:x["p"], reverse=True)

arr = sorted(arr, key=lambda x:x["s"])

for a in arr:
	print(a["i"])