ZhenlongDai/ACPR huggingface dataset:
Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
data = []
for i in range(n):
    tw, sc = input().split()
    data.append([tw, int(sc), i+1])

data.sort()

for d in data:
    print (d[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())
data = []
for i in range(n):
    tw, sc = input().split()
    data.append([tw, -int(sc), i+1])

data.sort()

for d in data:
    print (d[2])

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


s.sort(key=lambda x: x[1], reverse=True)
s.sort(key=lambda x: x[0])
for x in s:
    print(x[2])

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:
4
8
2
9
7
6
3
10
1
5


Fixed submission (verdict: Accepted):
N = int(input())
s = []
for i in range(N):
    tmp = input().split()
    tmp .append(i+1)
    tmp[1] = int(tmp[1])
    s.append(tmp)

s.sort(key=lambda x: x[1], reverse=True)
s.sort(key=lambda x: x[0])
for x in s:
    print(x[2])

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


Failing test case input:
10
yakutsk 10
yakstul 53
yakutsk 49
y`kutsk -1
yakvtsk 8
yakutsk 60
yajutsk 70
yakktus 18
kstukay 90
yakutsk 100

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


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


Fixed submission (verdict: Accepted):
N = int(input())
A = []
for i in range(N):
    S, P = input().split()
    A.append([S, int(P), i + 1])
A.sort(key=lambda x:(x[0], -x[1]))
for a in A:
    print(a[2])
Problem: p03030
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n = int(input())

graph = {}
for i in range(1, n+1):
    s, p = input().split(' ')
    newMap = {'number': i, 'score': int(p)}
    if s not in graph:
        graph[s] = [newMap]
    else:
        graph[s].append(newMap)

keys = list(graph.keys())
keys.sort()
for key in keys:
    maps = sorted(graph[key], reverse=True, key=lambda x: x['score'])
    print(maps)
    for map in maps:
        print(map['number'])


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

Expected output:
3
4
1
6
2
5


Actual output:
[{'number': 3, 'score': 50}, {'number': 4, 'score': 10}]
3
4
[{'number': 1, 'score': 20}, {'number': 6, 'score': 2}]
1
6
[{'number': 2, 'score': 18}]
2
[{'number': 5, 'score': 14}]
5


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

graph = {}
for i in range(1, n+1):
    s, p = input().split(' ')
    newMap = {'number': i, 'score': int(p)}
    if s not in graph:
        graph[s] = [newMap]
    else:
        graph[s].append(newMap)

keys = list(graph.keys())
keys.sort()
for key in keys:
    maps = sorted(graph[key], reverse=True, key=lambda x: x['score'])
    for map in maps:
        print(map['number'])

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)

print(ans)

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


Failing test case input:
10
yakuusk 18
kyastul 53
yskutak 76
kvk`tsy 0
yakvtsk 5
yavktsk 60
yajutsk 70
ybkksut 18
kstukay 233
yakutsk 110

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


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


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.4.3), verdict: Wrong Answer):
N=int(input())
grid=[]
for i in range(N):
   S_P=list(input().split())
   S_P.append(i+1)
   grid.append(S_P)

for i in range(N):
   grid[i][1]=int(grid[i][1])

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

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

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

Expected output:
3
4
1
6
2
5


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


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

for i in range(N):
   grid[i][1]=int(grid[i][1])

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

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

Problem: p03030
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
r = []
for i in range(n):
    s,p = input().split()
    p = int(p)
    r.append([s,p])
a = sorted(r)
for i in a:
    print(a.index(i)+1)

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:
1
2
3
4
5
6
7
8
9
10


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

Problem: p03030
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
from operator import itemgetter

n=int(input())
list1=[]
for i in range(n):
    a=list(input().split())
    a.append(i)
    list1.append(a)
 
list1.sort(reverse=True,key=itemgetter(1))
list1.sort(key=itemgetter(0))

for i in range(n):
    print(list1[i][2]+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):
from operator import itemgetter

n=int(input())
list1=[]
for i in range(n):
    a=list(input().split())
    a[1]=int(a[1])
    a.append(i)
    list1.append(a)

    

list1.sort(reverse=True,key=itemgetter(1))
list1.sort(key=itemgetter(0))

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

Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
S = []
cnt = 0
for _ in range(N):
    cnt += 1
    i,p = input().split()
    S.append([i,int(p),cnt+1])

S.sort(reverse = True)

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

Failing test case input:
6
khkrbbsvoa 12
dvqnor -1
k_zn` 20
zao`k 92
wmdosl -1
kbaqnvtail 1

Expected output:
2
3
6
1
5
4


Actual output:
5
6
2
7
4
3


Fixed submission (verdict: Accepted):
N = int(input())
S = []
cnt = 0
for _ in range(N):
    cnt += 1
    i,p = input().split()
    S.append([i,int(p),cnt])

S.sort(key=lambda x:(x[0],-x[1]))

for i in S:
  print(i[2])
Problem: p03030
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
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])
print(l)



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:
2
9
4
7
8
10
1
5
6
3
[[2, 'aykstul', 53], [9, 'kstukay', 160], [4, 'y`kutsk', -1], [7, 'yajutsk', 70], [8, 'yakksut', 18], [10, 'yakutsk', 100], [1, 'yakuusk', 18], [5, 'yakvtsk', 5], [6, 'yavktsk', 60], [3, 'yskutak', 49]]


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())
L = []

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

LS = sorted(L)

for i in range(N):
  print(LS[i][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
1
3
5
6
7
9
10
2


Fixed submission (verdict: Accepted):
N = int(input())
L = []

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

LS = sorted(L)

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

Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
A=[]
for i in range(N):
  a = list(input().split())
  A.append([a[0],int(a[1]),(i+1)])
A.sort(key=lambda x:x[1],reverse=True)  
A.sort(key=lambda x:x[0])  

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:
[['eyqooq', -1, 2], ['jb`qnvtajl', 1, 6], ['joaay', 23, 4], ['k^zn`', 13, 3], ['omdwsl', -3, 5], ['rgkkbvbtoa', 12, 1]]


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

Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
SP = []
for i in range(N):
  s,p = map(str,input().split())
  pint = int(p)
  pint = -pint
  p = str(pint)
  SP.append([s,p,str(i+1)])
SP.sort()
for i in range(N):
  print(int(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:
1
10
2
3
4
5
6
7
8
9


Fixed submission (verdict: Accepted):
N = int(input())
SP = []
for i in range(N):
  s,p = map(str,input().split())
  pint = int(p)
  pint = 100-pint
  SP.append([s,pint,i+1])
SP.sort()
for i in range(N):
  print(SP[i][2])
Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
r = [input().split() for _ in range(n)]
r_sort = r
r_sort.sort(key=lambda x:x[1],reverse=True)
r_sort.sort(key=lambda x:x[0])
for i in range(n):
    print(r_sort.index(r[i]) + 1)

Failing test case input:
6
kharbbsvok 12
dvpnor -1
k_zn` 20
k`oaz 55
wmdosl 0
kbaqnvtail 1

Expected output:
2
3
4
6
1
5


Actual output:
1
2
3
4
5
6


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

Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
S = []
 
for i in range(N):
    ts,tp = input().split()
    ts = str(ts)
    tp = int(tp)
    S.append([ts,tp,N-i])
    
S.sort(key=lambda x:x[0])

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

Failing test case input:
10
lrstaky 17
jyasutl 3
zatujsk 125
yt`mlus -1
isvykat 23
skskvax 7
ksuukby 32
xvstlbm 100
yavjtsk 317
irsakuy 111

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


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


Fixed submission (verdict: Accepted):
N = int(input())
S = []
 
for i in range(N):
    ts,tp = input().split()
    ts = str(ts)
    tp = 100-int(tp)
    S.append([ts,tp,i+1])
    
S.sort(key=lambda x:(x[0],x[1]))

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

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

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

a_point = sorted(a, key = lambda x: int(x[1]), reverse = True)
print(a_point)
a_name = sorted(a_point, key = lambda x: x[0])
print(a_name)
ans = []

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

Failing test case input:
10
yakussl 17
kyastul 49
ysjutak 102
tvl`kty 1
takvysi 11
xavksks 3
kstujby 117
lvltsby 110
yauktsk 317
jrkutay 111

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


Actual output:
[['yauktsk', '317', 9], ['kstujby', '117', 7], ['jrkutay', '111', 10], ['lvltsby', '110', 8], ['ysjutak', '102', 3], ['kyastul', '49', 2], ['yakussl', '17', 1], ['takvysi', '11', 5], ['xavksks', '3', 6], ['tvl`kty', '1', 4]]
[['jrkutay', '111', 10], ['kstujby', '117', 7], ['kyastul', '49', 2], ['lvltsby', '110', 8], ['takvysi', '11', 5], ['tvl`kty', '1', 4], ['xavksks', '3', 6], ['yakussl', '17', 1], ['yauktsk', '317', 9], ['ysjutak', '102', 3]]
10
7
2
8
5
4
6
1
9
3


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

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

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

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

ans = []

for i in a_name:
    print(i[2])
Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())

s = [0]*n
p = [0]*n

list_2d = [[] for _ in range(n)]

for i in range(n):
    s, p = input().split()
    list_2d[i].append(s)
    list_2d[i].append(p)
list_2d_sorted = sorted(list_2d, key = lambda x: (x[0],x[1]))
for i in range(n):
    print(list_2d.index(list_2d_sorted[i])+1)

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:
4
8
2
1
10
3
6
7
9
5


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

s = [0]*n
p = [0]*n

list_2d = [[] for _ in range(n)]

for i in range(n):
    s, p = input().split()
    list_2d[i].append(s)
    list_2d[i].append(p)
list_2d_sorted = sorted(list_2d, key = lambda x: (x[0],-int(x[1])))
for i in range(n):
    print(list_2d.index(list_2d_sorted[i])+1)

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

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

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


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


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

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

Failing test case input:
10
yrssakl 0
`txsujl -1
zatujtj 141
yt`klus -1
isvykat 23
xavksks 7
ksutkcy 62
xvttlbl 101
jstjvay 143
yukasri 111

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


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


Fixed submission (verdict: Accepted):
n = int(input())
r = []
for i in range(n):
    name, point = input().split()
    point = int(point)
    r.append([name, -point, i + 1])
r.sort()
for i in r:
    print(i[2])
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))
cities.sort()
for k in cities:
    rest[k].sort(reverse = True)
    for i in rest[k]:
        print(i[1])

Failing test case input:
10
yrssakl 0
`txsujl -2
zatujtj 54
yt`klus -1
takyvsi 30
skskvax 7
ksutkcy 62
xvttlbl 101
jstjvay 143
kuyasri 111

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


Actual output:
['`txsujl', 'jstjvay', 'ksutkcy', 'kuyasri', 'skskvax', 'takyvsi', 'xvttlbl', 'yrssakl', 'yt`klus', 'zatujtj']
2
9
7
10
6
5
8
1
4
3


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())
A = [input().split() for _ in range(N)]
a = []
for i in range(N):
  a.append([A[i][0], 100 - int(A[i][1])])
A = sorted(a)
print(a)
print(A)

for i in range(N):
  print(a.index(A[i])+1)

Failing test case input:
10
lrstaky 17
jyasutl 3
zatujsk 125
yt`mlus -1
isvykat 23
skskvax 7
ksuukby 32
xvstlbm 100
yavjtsk 317
irsakuy 111

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


Actual output:
[['lrstaky', 83], ['jyasutl', 97], ['zatujsk', -25], ['yt`mlus', 101], ['isvykat', 77], ['skskvax', 93], ['ksuukby', 68], ['xvstlbm', 0], ['yavjtsk', -217], ['irsakuy', -11]]
[['irsakuy', -11], ['isvykat', 77], ['jyasutl', 97], ['ksuukby', 68], ['lrstaky', 83], ['skskvax', 93], ['xvstlbm', 0], ['yavjtsk', -217], ['yt`mlus', 101], ['zatujsk', -25]]
10
5
2
7
1
6
8
9
4
3


Fixed submission (verdict: Accepted):
N = int(input())
A = [input().split() for _ in range(N)]
a = []
for i in range(N):
  a.append([A[i][0], 100 - int(A[i][1])])
A = sorted(a)

for i in range(N):
  print(a.index(A[i])+1)

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



N = int(input())

sp_list = []

for i in range(N):
    
    sp = input().split(" ")
    sp.append(str(i+1))
    sp_list.append(sp)



sp_list.sort(key = lambda x: x[0])
sp_list.sort(key = lambda x: x[1])

for i in sp_list:
    print(int(i[2]))

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
10
7
9
8
1
2
6
5
3


Fixed submission (verdict: Accepted):



N = int(input())

sp_list = []

for i in range(N):
    
    sp = input().split(" ")
    sp.append(str(i+1))
    sp_list.append(sp)



sp_list.sort(key = lambda x: -int(x[1]))
sp_list.sort(key = lambda x: x[0])

for i in sp_list:

    print(int(i[2]))
Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

N = int(input())
R_list = []
for i in range(N):
    S, P=map(str, input().split())
    R_list.append([S , int(P)*-1 , i])
R_list.sort()
for i in range(N):
    R_list[i].append(i+1)
R_list.sort(key=lambda x:x[2])
for i in range(N):
    print(R_list[i][3])

    

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:
7
4
10
1
8
2
5
9
3
6


Fixed submission (verdict: Accepted):

N = int(input())
R_list = []
for i in range(N):
    S, P=map(str, input().split())
    R_list.append([S , int(P)*-1 , i+1])
R_list.sort()
for i in range(N):
    R_list[i].append(i+1)
R_list.sort(key=lambda x:x[3])
for i in range(N):
    print(R_list[i][2])

Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import defaultdict

N = int(input())

D = defaultdict(list)
for i in range(N):
    s,p = input().split()
    D[s].append((i+1,p))
    
for k in sorted(D.keys()):
    for v in sorted(D[k],key=lambda x:x[1],reverse=True):
        print(v[0])

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 collections import defaultdict

N = int(input())

D = defaultdict(list)
for i in range(N):
    s,p = input().split()
    D[s].append((i+1,int(p)))
    
for k in sorted(D.keys()):
    for v in sorted(D[k],key=lambda x:x[1],reverse=True):
        print(v[0])

Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
X = []
for i in range(N):
	s, p = input().split()
	X.append([s, -int(p),  i+1])
X.sort()
for i in range(N):
	print(-X[i][2])

Failing test case input:
6
rgkkavbtoa 3
qooqye -1
`nz^k 2
jpbay 32
owdnsl 0
jb`qnvtajl 1

Expected output:
3
6
4
5
2
1


Actual output:
-3
-6
-4
-5
-2
-1


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

Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
l = list(list(input().split()) for i in range(n))
a = sorted(l)
print(a)
for i in range(n-1):
  if a[i][0]==a[i+1][0]:
    x = a[i][1]
    a[i][1] = a[i+1][1]
    a[i+1][1]= x
print(a)

Failing test case input:
6
pgkt`vbjo` 2
nqomxd 2
`ny]j -2
ajbyo 1
owensl 2
jb`qnvuajl -9

Expected output:
3
4
6
2
5
1


Actual output:
[['`ny]j', '-2'], ['ajbyo', '1'], ['jb`qnvuajl', '-9'], ['nqomxd', '2'], ['owensl', '2'], ['pgkt`vbjo`', '2']]
[['`ny]j', '-2'], ['ajbyo', '1'], ['jb`qnvuajl', '-9'], ['nqomxd', '2'], ['owensl', '2'], ['pgkt`vbjo`', '2']]


Fixed submission (verdict: Accepted):
n = int(input())
l = list(list(input().split()) for i in range(n))
a = sorted(l)
for i in range(n):
  l[i][1]= -int(l[i][1])
a = sorted(l)
for i in range(n):
  l[i][1]= -int(l[i][1])
for q in a:
  print(l.index(q)+1)
Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
listA=[]
for i in range(N):
    lis=input().split()
    listA.append([lis[0],int(lis[1]),i])
sort=sorted(listA,key=lambda x:(x[0],-x[1]))
for i in range(N):
    sort[i].append(i+1)
sort=sorted(sort,key=lambda x:x[2])
for disp in sort:
    print(disp[3])

Failing test case input:
10
yrssakl 0
`txsujl -1
zatujtj 141
yt`klus -1
isvykat 30
xavksks 7
ksutkcy 62
xvttlbl 101
jstjvay 143
kuyasri 111

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


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


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

Problem: p03030
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n=int(input())
s=[]
for i in range(n):
    tmp=input().split()
    tmp[1]=100-int(tmp[1])
    s.append(tmp+[str(i+1)])
print(s)
s=sorted(s)
print(s)

for i in range(n):
    print(s[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:
[['qgkkavbtoa', 97, '1'], ['qooqye', 101, '2'], ['`mz]k', 97, '3'], ['pybaj', 100, '4'], ['owdnsk', 100, '5'], ['jb`qnvtajl', 99, '6']]
[['`mz]k', 97, '3'], ['jb`qnvtajl', 99, '6'], ['owdnsk', 100, '5'], ['pybaj', 100, '4'], ['qgkkavbtoa', 97, '1'], ['qooqye', 101, '2']]
3
6
5
4
1
2


Fixed submission (verdict: Accepted):
n=int(input())
s=[]
for i in range(n):
    tmp=input().split()
    tmp[1]=100-int(tmp[1])
    s.append(tmp+[str(i+1)])
s=sorted(s)

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

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(' '))

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 10
yakutsl 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
1
4
2


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


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.8.2), verdict: Wrong Answer):
n=int(input())
rec=[]
for i in range(n):
    a,b=input().split()
    rec.append([a,int(b),i+1])
rec.sort()
for i in rec:
    print(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):
n=int(input())
rec=[]
for i in range(n):
    a,b=input().split()
    rec.append([a,int(b),i+1])
rec=sorted(rec, reverse=True, key=lambda x: x[1]) 
rec=sorted(rec, key=lambda x: x[0]) 
for i in rec:
    print(i[2])
Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

from operator import itemgetter

n = int(input())

X = []
for i in range(n):
    tmp = input().split(' ')
    X.append((tmp[0], -int(tmp[1])))

Y = sorted(X, key=itemgetter(0,1))
for x in X:
    print(Y.index(x)+1)


Failing test case input:
10
yakuusk 18
kyastul 53
yskutak 76
kvk`tsy 0
yakvtsk 5
yavktsk 60
yajutsk 70
ybkksut 18
kstukay 233
yatuksk 110

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


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


Fixed submission (verdict: Accepted):

from operator import itemgetter

n = int(input())

X = []
for i in range(n):
    tmp = input().split(' ')
    X.append((i+1, tmp[0], -int(tmp[1])))
X.sort(key=itemgetter(1, 2))

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

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

for e in sp:
    print(e[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):
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])

Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A = []
for i in range(1,N+1):
    S,P = input().split()
    A.append((S,P,i))
A = sorted(A,key=lambda x:x[1],reverse=True)
A = sorted(A,key=lambda x:x[0])
for x in A:
    print(x[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):
N = int(input())
A = []
for i in range(1,N+1):
    S,P = input().split()
    P = int(P)
    A.append((S,P,i))
A = sorted(A,key=lambda x:x[1],reverse=True)
A = sorted(A,key=lambda x:x[0])
for x in A:
    print(x[2])

Problem: p03030
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
import copy
n = int(input())
r = []
for _ in range(n):
    city, x = input().split()
    x = int(x)
    r.append((city, x))

d = copy.deepcopy(r)
d = sorted(d, key=lambda x: -x[1])
d = sorted(d, key=lambda x: x[0])

print(d)
for k in d:
    print(r.index(k) + 1)


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

Expected output:
3
6
5
4
2
1


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


Fixed submission (verdict: Accepted):
import copy
n = int(input())
r = []
for _ in range(n):
    city, x = input().split()
    x = int(x)
    r.append((city, x))

d = copy.deepcopy(r)
d = sorted(d, key=lambda x: -x[1])
d = sorted(d, key=lambda x: x[0])

for k in d:
    print(r.index(k) + 1)
Problem: p03030
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n=int(input())

lista=[]

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

	
lista.sort(key=lambda x:x[1])


lista.sort(key=lambda x:x[0])


ans=0
list_ans=[]
for i in range(n):
	ans=lista[i][2]
	list_ans.append(ans)
print(list_ans)
	

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

Expected output:
3
6
5
4
2
1


Actual output:
[3, 6, 5, 4, 2, 1]


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

lista=[]

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

	
lista.sort(key=lambda x:-x[1])


lista.sort(key=lambda x:x[0])


ans=0
list_ans=[]
for i in range(n):
	ans=lista[i][2]
	list_ans.append(ans)

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

Problem: p03030
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n = int(input())
res = []
for i in range(n):
    s,p = input().split()
    p = int(p)
    res.append((s,-p,i+1))
res.sort
for i in range(n):
    print(res[i][2])

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

Expected output:
3
4
6
1
5
2

Actual output:
1
2
3
4
5
6


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

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


Failing test case input:
10
lkassry 1
t`xsujm -4
yatvjtj 19
lt`skuy 0
iyvlsat 22
skskvax -1
ycktusk 10
lyltcvu 100
jstjvay 144
kuyasri 101

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


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


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

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

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


for i in range(N):
    ans=A.index(S[i])+1
    print(ans)


Failing test case input:
10
yakussl 17
kyastul 49
ksjutay 102
tvl`kty 0
takvysi 11
xavksks 3
kstujby 117
lvltsby 110
yauktsk 317
jrkutay 111

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


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


Fixed submission (verdict: Accepted):


N=int(input())
S=[list(map(str,input().split())) for i in range(N)]

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

for i in range(N):
    ans=S.index(B[i])+1
    print(ans)
Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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[2] , reverse=True)
new2_li=sorted(new_li,key=lambda x:x[1])


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


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
2
3
4
5
6


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

li=[]

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


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])

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

lis.sort(key=lambda k: k[1], reverse=True)
lis.sort(key=lambda k: k[0])

for j in lis:
    print(j[2])


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:
4
8
2
9
7
6
3
10
1
5


Fixed submission (verdict: Accepted):
N = int(input())
lis = [(input() + " " + str(i+1)).split() for i in range(N)]

lis = [k for k in lis]

lis.sort(key=lambda k: int(k[1]), reverse=True)
lis.sort(key=lambda k: k[0])


for j in lis:
    print(j[2])

Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
lis = []
for i in range(n):
    s,p = map(str,input().split())
    lis.append([s,100 - int(p)])
liss = lis.copy()
lis.sort()
print(liss)
for i in range(n):
    print(liss.index(lis[i]) + 1)

Failing test case input:
6
khkrbbsvoa 12
dvqoor -1
knz_` 20
zaoak 18
wmdosl -2
kbaqnvtail 1

Expected output:
2
6
1
3
5
4


Actual output:
[['khkrbbsvoa', 88], ['dvqoor', 101], ['knz_`', 80], ['zaoak', 82], ['wmdosl', 102], ['kbaqnvtail', 99]]
2
6
1
3
5
4


Fixed submission (verdict: Accepted):
n = int(input())
lis = []
for i in range(n):
    s,p = map(str,input().split())
    lis.append([s,100 - int(p)])
liss = lis.copy()
lis.sort()
for i in range(n):
    print(liss.index(lis[i]) + 1)

Problem: p03030
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
res_list = []
for i in range(n):
    a,b=input().split()
    res_list.append((a,int(b)))
psorted_res_list = sorted(res_list, key=lambda x: x[1], reverse=True)
sorted_res_list = sorted(psorted_res_list, key=lambda x: x[0])
for i in range(n):
    print(sorted_res_list.index(res_list[i]) + 1)

Failing test case input:
10
lkassry 1
t`xsujm -4
yatvjtj 19
lt`skuy 0
iyvlsat 22
skskvax -1
ycktusk 10
lyltcvu 100
jstjvay 144
kuyasri 101

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


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


Fixed submission (verdict: Accepted):
n = int(input())
res_list = []
for i in range(n):
    a,b=input().split()
    res_list.append((a,int(b)))
psorted_res_list = sorted(res_list, key=lambda x: x[1], reverse=True)
sorted_res_list = sorted(psorted_res_list, key=lambda x: x[0])
for i in range(n):
    print(res_list.index(sorted_res_list[i]) + 1)
Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
SP = []
a = 1
for i in range(N):
    SP.append(input().split())
for i in SP:
    i.append(a)
    a += 1
SP.sort(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
yakutsl 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
1
4
2


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


Fixed submission (verdict: Accepted):
N = int(input())
SP = []
a = 1
for i in range(N):
    SP.append(input().split())
for i in SP:
    i.append(a)
    a += 1
for i in range(N):
    SP[i][1] = int(SP[i][1])
SP.sort(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())
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)
    

print(ans)

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


Failing test case input:
10
lrstaky 17
jyasutl 3
zatujsk 125
yt`mlus -1
isvykat 23
skskvax 7
ksuukby 32
xvstlbm 100
yavjtsk 317
irsakuy 111

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


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


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.4.3), verdict: Wrong Answer):
N = int(input())
l = []
for i in range(N):
    S, P = input().split()
    P = int(P)
    l.append([S, -P, i+1])
l.sort
for l_ in l:
    print(l_[2])

Failing test case input:
10
lkassry 1
t`xsujm -4
yatvjtj 19
yuks`tl 0
iyvlsat 22
skskvax -1
ycktusk 10
lyltcvu 100
jstjvay 144
kuyasri 101

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


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):
    S, P = input().split()
    P = int(P)
    l.append([S, -P, i+1])
l.sort()
for l_ in l:
    print(l_[2])
Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
li = []
for i in range(n):
    li.append(list(input().split()))
    li[i].append(i + 1)
li.sort(key=lambda x: x[1], reverse = True)
li.sort(key=lambda x: x[0])
for i in range(n):
    print(li[i][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):
n = int(input())
li = []
for i in range(n):
    li.append(list(input().split()))
    li[i].append(i + 1)
    li[i][1] = int(li[i][1])
li.sort(key=lambda x: x[1], reverse = True)
li.sort(key=lambda x: x[0])
for i in li:
    print(i[2])

Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
book= []
for i in range(N):
    a = input().split()
    city = a[0]
    score = (100-int(a[1]))
    book.append((city, score))
b=sorted(book)
print(book)
print(b)

for i in b:
    ans =  1
    for j in book:
        if i == j:
            print(ans)
        else:
            ans += 1

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:
[('yakusrl', 83), ('lutsayj', 98), ('zatujsk', -25), ('yt`klvs', 100), ('isyvkat', 82), ('xavksks', 95), ('kstujby', 5), ('lbltsvy', 99), ('yauktsk', -217), ('jrsakuy', -11)]
[('isyvkat', 82), ('jrsakuy', -11), ('kstujby', 5), ('lbltsvy', 99), ('lutsayj', 98), ('xavksks', 95), ('yakusrl', 83), ('yauktsk', -217), ('yt`klvs', 100), ('zatujsk', -25)]
5
10
7
8
2
6
1
9
4
3


Fixed submission (verdict: Accepted):
N = int(input())
book= []
for i in range(N):
    a = input().split()
    city = a[0]
    score = (100-int(a[1]))
    book.append((city, score))
b=sorted(book)

for i in b:
    ans =  1
    for j in book:
        if i == j:
            print(ans)
        else:
            ans += 1

Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
restaurant = [[n+1]+input().split(' ') 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)

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())
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):
from operator import itemgetter

n = int(input())
 

data = []
for i in range(n):
    city, point = input().split()
    data.append([city, point, i+1])

data = sorted(data, key=itemgetter(1), reverse=True)
data = sorted(data, key=itemgetter(0), reverse=False)

for i in range(n):
    print(data[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):
from operator import itemgetter

n = int(input())
 
data = []
for i in range(n):
    city, point = input().split()
    data.append([city, int(point), i+1])

data = sorted(data, key=itemgetter(1), reverse=True)
data = sorted(data, key=itemgetter(0), reverse=False)

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

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


N = int(input())
di = []
tmp =[]

for i in range(N):
    tmp = input().split()
    tmp.append(i)
    di.append(tmp)

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

for i in range(N):
    print(di[i][2]+1)



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):


N = int(input())
di = []
tmp =[]

for i in range(N):
    si, pi = input().split()
    pi = int(pi) * (-1)
    tmp = [si, pi, i]
    di.append(tmp)
di = sorted(di, key=lambda x: (x[0], x[1]))    

for i in range(N):
    print(di[i][2]+1)

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


tmp = sorted(a,key=lambda a: a[1], reverse=True)
a = sorted(tmp, key=lambda a: a[0])
for i in a:
    print(i[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):
n= int(input())
a= []
for i in range(n):
    s,p=input().split()
    a.append([s,int(p),i+1])
tmp = sorted(a,key=lambda a: a[1], reverse=True)
a = sorted(tmp, key=lambda a: a[0])
for i in a:
    print(i[2])
Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())

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

Failing test case input:
10
lkassry 2
mujsx_t -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
2
6
9
7
4


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


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

cities.reverse()

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

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

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

for i in range(n):
  s,p = input().split()
  num = 100 - int(p)
  num_zero = str(num).zfill(3)
  s2 = s + num_zero + str(i+1)
  array.append(s2)
  
array.sort()

for i in range(n):
  print(array[i][-1])

Failing test case input:
10
yrssakl 0
xtasujl -1
zatujtj 141
yt`klus -1
isvykat 23
xavksks 7
ksutkcy 62
xvttlbl 101
jstjvay 143
yukasri 111

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


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


Fixed submission (verdict: Accepted):
n = int(input())
dic = {}

for i in range(n):
  s,p = input().split()
  num = 100 - int(p)
  num_zero = str(num).zfill(3)
  s2 = s + num_zero
  dic[s2] = i + 1
  
array = sorted(dic.keys())

for s in array:
  print(dic[s])

Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
L = []
i = 0
while i < n:
    s,p = map(str,input().split(' '))
    p = int(p)
    L.append((s,p,i))
    i += 1
L.sort()
ans = ''
for l in L:
    ans += str(l[2]-1)+'\n'
print(ans[:-1])

Failing test case input:
6
kgarabsvok 12
dwpnor -1
k_zn` 20
`okaz 33
wmdosl 0
kbaqnvtail 1

Expected output:
4
2
3
6
1
5


Actual output:
2
0
1
4
-1
3


Fixed submission (verdict: Accepted):
n = int(input())
L = []
i = 0
while i < n:
    s,p = map(str,input().split(' '))
    p = -1*int(p)
    L.append((s,p,i))
    i += 1
L.sort()
ans = ''
for l in L:
    ans += str(l[2]+1)+'\n'
print(ans[:-1])
Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N= int(input())
li = list()

for i in range(N):
  res,score = input().split()
  score = int(score)
  li.append([res,score,i+1])
  
li.sort()

for i in li:
  print(i[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())
li = list()

for i in range(N):
  res,score = input().split()
  score = int(score)
  li.append([res,-score,i+1])
  
li.sort()

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

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


Failing test case input:
6
khkrbbsvoa 12
dwqoor -2
knz_` 20
kaoaz 18
omdwsl -2
kbaqnvtail 0

Expected output:
2
4
6
1
3
5


Actual output:
[['dwqoor', -2, 2], ['kaoaz', 18, 4], ['kbaqnvtail', 0, 6], ['khkrbbsvoa', 12, 1], ['knz_`', 20, 3], ['omdwsl', -2, 5]]
2
4
6
1
3
5


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

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

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):
N = int(input())
SP = []
for i in range(N):
  c, p = input().split()
  SP.append([i+1, c, int(p)])
SP = sorted(SP, key=lambda x:x[2], reverse=True)
SP = sorted(SP, key=lambda x:x[1])
for s in SP:
  print(s[0])

Problem: p03030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
s = [0]*n
p = [0]*n
l = [[] for i in range(n)]

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

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

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

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):
n = int(input())
s = [0]*n
p = [0]*n
l = [[] for i in range(n)]

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

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

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