Problem: You have decided to write a book introducing good restaurants. There are N restaurants that you want to introduce: Restaurant 1, Restaurant 2, ..., Restaurant N. Restaurant i is in city S_i, and your assessment score of that restaurant on a 100-point scale is P_i. No two restaurants have the same score.  You want to introduce the restaurants in the following order:    * The restaurants are arranged in lexicographical order of the names of their cities.   * If there are multiple restaurants in the same city, they are arranged in descending order of score.  Print the identification numbers of the restaurants in the order they are introduced in the book.

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

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

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

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

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


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


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


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


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

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

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

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

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


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

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

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

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


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(0,n):
  print(new2_li[j][0])


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

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


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


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


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(0,n):
  print(new2_li[j][0])


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

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

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

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

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


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

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

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

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


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

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

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

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

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


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

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

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

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


Verdicts: Runtime Error

Runtime Error

Wrong Answer

Wrong Answer

Runtime Error

Wrong Answer

Runtime Error

Wrong Answer

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted