Problem:


Score : 200 points

Problem Statement

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

You want to introduce the restaurants in the following order:

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

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

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

Constraints

1 ≤ N ≤ 100

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

0 ≤ P_i ≤ 100

P_i is an integer.

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

Input

Input is given from Standard Input in the following format:

N
S_1 P_1
:
S_N P_N

Output

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

Sample Input 1

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

Sample Output 1

3
4
6
1
5
2

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

Sample Input 2

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

Sample Output 2

10
9
8
7
6
5
4
3
2
1



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


Sample output:
3
4
6
1
5
2

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
n = int(input())
print(n)
b = [list(map(str,input().split())) for p in [0]*n]
for i in range(n):
	b[i][1] = int(b[i][1])
	b[i].append(i+1)
print(b)
b.sort(key=lambda q:(q[0],-q[1]))
for k in range(n):
	print(b[k][2])

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
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])

Submission status: Wrong Answer

Solution code:
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])

Submission status: Wrong Answer

Solution code:
n = int(input())

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

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

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

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

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# coding: utf-8

# In[4]:


import numpy as np


# In[7]:


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


# In[9]:


data = np.array(list)


# In[29]:


sortedData = data[np.argsort(data[:,1])][::-1]
sortedData = sortedData[np.argsort(sortedData[:,0])]


# In[37]:


for i in range(N):
    print(int(sortedData[i,2])+1)

Submission status: Wrong Answer

Solution code:
n = int(input())
lis = []
li = []
l = []
cou = 0
for i in range(n):
  a,b = map(str,input().split())
  if a not in li:
    lis.append([[b,str(i+1)]])
    li.append(a)
    l.append([a,cou])
    cou += 1
  else:
    lis[li.index(a)].append([b,str(i+1)])
l.sort()
for i in range(len(l)):
  lis[l[i][1]].sort(reverse=True)
  for num,nu in lis[l[i][1]]:
    print(int(nu))

Submission status: Wrong Answer

Solution code:
N = int(input())

l = []

for i in range(N):
    s , p = map(str, input().split())
    p = int(p)
    l.append((s,p))

l_new = sorted(l, key=lambda t: t[0]+str(100-t[1]))

for i in l_new:
    print(l.index(i)+1)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# coding: utf-8

# In[15]:


import sys
#import numpy as np
input = sys.stdin.readline
N = int(input())
l = [input().split()+[i+1] for i in range(N)]


# In[20]:


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


# In[ ]:


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

Submission status: Wrong Answer

Solution code:
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"])

Submission status: Wrong Answer

Solution code:
n = int(input())

hyouka = []
for i in range(n):
    tmpS, tmpP = input().split()
    tmpHyouka = tmpS + str(1000-int(tmpP))
    hyouka.append(tmpHyouka)

ans = sorted(range(len(hyouka)), key=lambda k: hyouka[k])

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

Submission status: Wrong Answer

Solution code:
if __name__ == '__main__':
    N = int(input())
    S = []
    P = []
    num = []
    for i in range(N):
        s = input().rstrip().split(' ')
        S.append(s[0])
        P.append(int(s[1]))
        num.append(i+1)

    Z = list(zip(S,P,num))
    print(Z)

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

    for elem in Z:
        print(elem[2])

Submission status: Wrong Answer

Solution code:
# 行数
N = int(input().strip())

# 2次元配列
grid = []
for i in range(N):
    array = list(input().strip().split())
    grid.append(array)
    grid[i][1]=int(grid[i][1])
    grid[i].append(i+1)
print(grid)
agrid=sorted(grid)
for i in range(N-1):
  if agrid[i][0]==agrid[i+1][0] and agrid[i][1]<agrid[i+1][1]:
    b=agrid[i+1]
    c=agrid[i]
    agrid[i]=b
    agrid[i+1]=c
for i in range(N):
  print(agrid[i][2])

Submission status: Wrong Answer

Solution code:
n=int(input())
rs={}
for rId in range(n):
    s,pt=input().split()
    pt=int(pt)
    if s in rs:
        rs[s].append((rId,pt))
    else:
        rs[s]=[(rId,pt)]
cities=list(rs.keys())
    
def qsort(arr,left,right):
    
    if left<right:
        i=left
        j=right
        pivot = arr[i+int((j-i)/2)]
        while True:
            while arr[i]<pivot:
                i+=1
            while pivot<arr[j]:
                j-=1
            if i>=j:
                break
            tmp = arr[i]
            arr[i]=arr[j]
            arr[j]=tmp
            i+=1
            j-=1
        qsort(arr,left,i-1)
        qsort(arr,j+1,right)

qsort(cities,0,len(cities)-1)

def qsort_tuple(arr,left,right):
    
    if left<right:
        i=left
        j=right
        pivot = arr[i+int((j-i)/2)][1]
        while True:
            while arr[i][1]<pivot:
                i+=1
            while pivot<arr[j][1]:
                j-=1
            if i>=j:
                break
            tmp = arr[i]
            arr[i]=arr[j]
            arr[j]=tmp
            i+=1
            j-=1
        qsort(arr,left,i-1)
        qsort(arr,j+1,right)
for x in range(len(cities)):
    c=rs[cities[x]]
    qsort_tuple(c,0,len(c)-1)
    c.reverse()
    for r in range(len(c)):
        print(c[r][0]+1)

Submission status: Wrong Answer

Solution code:
n = int(input())
ss = []
for i in range(n):
    s, p = input().split()
    ss.append(s+chr(128-int(p)))

sss = ss.copy()
sss.sort()
for s in sss:
    print(ss.index(s)+1)

Submission status: Wrong Answer

Solution code:
from operator import itemgetter

N= int(input())
lst = []
for i in range(N):
    s, p = input().split()
    lst.append([s, int(p), i])
lst = sorted(lst, key=itemgetter(1), reverse=True)
lst = sorted(lst, key=itemgetter(0))
lst = [l + [i] for i, l in enumerate(lst)]
lst = sorted(lst, key=itemgetter(2))
for l in lst:
    print(l[3]+1)

Submission status: Wrong Answer

Solution code:
from operator import itemgetter

N = input()
N = int(N)

X = []
Y = []
for i in range(N):
    S_x,P_x = input().split()
    X.append(S_x)
    X.append(P_x)
    X.append(i+1)
    Y.append(X)
    X = []

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

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

Submission status: Wrong Answer

Solution code:
# coding: utf-8
import numpy as np
from functools import lru_cache
import time

def main(): 
    if True:
        N = int(input())
        SP = np.asarray([])
        for i in range(N):
            SP = np.append(SP,input().split()+[i+1])
    else:
        pass
    SP = SP.reshape((N,3))
    uSP = np.unique(SP[:,0])
    for u in uSP:
        tSP = np.asarray(SP[SP[:,0]==u,1:3],dtype=int)
        ttSP = tSP[np.argsort(tSP[:,0][::-1])]
        for p in ttSP:
            print(p[1])
if __name__ =='__main__':
    main()

Submission status: Wrong Answer

Solution code:
N = int(input())

data=[]
for i in range(N):
    S,P = input().split()
    li = [i,S,int(P)]
    data.append(li)
    
data.sort(key=lambda x: x[1])
data.sort(reverse=True, key=lambda x: x[2])
for i in range(N):
    data[i] = data[i]+[i]

data.sort(key=lambda x: x[0])
for i in range(N):
    print(str(data[i][3]))

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10 ** 5)


def LI(): return [int(x) for x in sys.stdin.readline().split()]


def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]


def LF(): return [float(x) for x in sys.stdin.readline().split()]


def LS(): return sys.stdin.readline().split()


def II(): return int(sys.stdin.readline())


def SI(): return input()


N = int(input())
X = {}
for i in range(1, N+1):
    s, p = input().split()
    if s in X:
        X[s] += [(int(p), i)]
    else:
        X[s] = [(int(p), i)]

X = sorted(X.items())
print(X)
for v in X:
    a = sorted(v[1], reverse=True)
    for i in a:
        print(i[1])

Submission status: Wrong Answer

Solution code:
10
9
8
7
6
5
4
3
2
1

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from collections import OrderedDict

N = int(input())

city = set()

rest = OrderedDict()

for i in range(N):
    sp = input().split()

    if sp[0] in city:
        rest[sp[0]].append([sp[1], i])
    else:
        city.add(sp[0])
        rest[sp[0]] = [[sp[1], i]]

index = sorted(rest)

for i in index:
    for r in sorted(rest[i], reverse=True):
        print(r[1]+1)

Submission status: Wrong Answer

Solution code:
N = int(input())
li = []
for i in range(N):
    si, pi = input().split()
    pi = int(pi)
    li +=[ [i, si, pi]]
li.sort(key=lambda x:x[2], reverse=True)
li.sort(key=lambda x:x[1], reverse=False)
for j in li:
    print(j[0])

Submission status: Wrong Answer

Solution code:
N = int(input())

SP = {}

for n in range(N):
    s, p = input().split()
    p = int(p)
    if s not in SP:
        SP[s] = [(p, n+1)]
    else:
        SP[s].append((p, n+1))

print(SP)

K = sorted(SP)
print(K)

for k in K:
    SP[k].sort(reverse=True)
    for t in SP[k]:
        print(t[1])

Submission status: Wrong Answer

Solution code:
N = int(input())
SP = [input().split() for n in range(N)]

# 得点が高い＝100からの減算値が小さい。文字列を昇順に並べながら得点が高い特徴を並べやすく
# 文字列と入力順番値を辞書型で登録
sp = {s+str(100-int(p)):n for n, (s, p) in enumerate(SP)}

# 昇順文字列に並べ、その文字列に対応する入力順番値を表示する
for n in sorted(sp):
    print(sp[n]+1)

Submission status: Wrong Answer

Solution code:
N = int(input())
# SP = sorted([list(input().split()) for _ in range(N)])
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])
# print(SP)


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

Submission status: Wrong Answer

Solution code:
N = int(input())
info_list = list()
for i in range(N):
    S, P = input().split()
    info_list.append((i + 1, S, int(P)))

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

Submission status: Wrong Answer

Solution code:
N = int(input())
SP = [list(input().split()) for i in range(N)]

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

for i in range(N):
    print(SP.index(SPsort[i]) + 1)

Submission status: Wrong Answer

Solution code:
n = int(input())

hyouka = []
for i in range(n):
    tmpS, tmpP = input().split()
    tmpHyouka = tmpS + str(100-int(tmpP))
    hyouka.append(tmpHyouka)

ans = sorted(range(len(hyouka)), key=lambda k: hyouka[k])

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

Submission status: Wrong Answer

Solution code:
import numpy as np

n = int(input())


splist1 = []
splist2 = []
for i in range(n):
    tmp,tmp2 = input().split()
    tmp2 = int(tmp2)
    splist1.append([tmp,i+1])
    splist2.append([tmp2,i+1])

splist1 = np.array(splist1)
splist2 = np.array(splist2)
splist1 = splist1[np.argsort(splist2[:, 0])[::-1]]

ans = splist1[np.argsort(splist1[:, 0])]

for i in ans:
    print(i[1])

Submission status: Wrong Answer

Solution code:
N = [int(s) for s in input().split(" ")][0]
shops = {}
for i in range(N):
    S, P = [s for s in input().split(" ")]
    P = int(P)
    if S in shops:
        shops[S].append((P, i+1))
    else:
        shops[S] = [(P, i+1)]

shops = sorted(list(shops.items()), key=lambda p: p[0])

print(shops)

for p, o in shops:
    o.sort(key=lambda p: p[0], reverse=True)
    for s, i in o:
        print(i)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

N = int(input())

SP = [input().split() for i in range(N)]
SP = [[sp[0], sp[1], i] for i, sp in enumerate(SP)]
SP.sort(key=lambda x: x[1], reverse=True)
SP.sort(key=lambda x: x[0])
SP = [[sp[0], sp[1], sp[2], i+1] for i, sp in enumerate(SP)]
SP.sort(key=lambda x: x[2])

for sp in SP:
    print(sp[3])

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10 ** 5)


def LI(): return [int(x) for x in sys.stdin.readline().split()]


def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]


def LF(): return [float(x) for x in sys.stdin.readline().split()]


def LS(): return sys.stdin.readline().split()


def II(): return int(sys.stdin.readline())


def SI(): return input()


N = int(input())
X = {}
for i in range(1, N+1):
    s, p = input().split()
    if s in X:
        X[s] += [(int(p), i)]
    else:
        X[s] = [(int(p), i)]

X = sorted(X.items())
for v in X:
    a = sorted(v[1])
    for i in a:
        print(i[1])

Submission status: Wrong Answer

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

for sorted_sp in sorted(sp, key=lambda x: (x[1], -int(x[2]))):
    print(sorted_sp)

Submission status: Wrong Answer

Solution code:
n = int(input())
d = {}
for i in range(n):
    s, p = input().split()
    p = int(p)
    if s not in d:
        d[s] = [[p, i+1]]
    else:
        d[s] += [[p, i+1]]

for v in d.values():
    v.sort(reverse=True)
    for a in v:
        print(a[1])

Submission status: Wrong Answer

Solution code:
import numpy as np
n = int(input())
dict = {}


x =[]
for i in range(n):
    x1, y1 = [i for i in input().split()]
    x.append(x1+str(100-int(y1)))

for i in range(len(x)):
    print(np.argsort(x)[i]+1)

Submission status: Wrong Answer

Solution code:
# 行数
N = int(input().strip())

# 2次元配列
grid = []
for i in range(N):
    array = list(input().strip().split())
    grid.append(array)
    grid[i][1]=int(grid[i][1])
print(grid)
agrid=sorted(grid)
for i in range(N-1):
  if agrid[i][0]==agrid[i+1][0] and agrid[i][1]<agrid[i+1][1]:
    b=agrid[i+1]
    c=agrid[i]
    agrid[i]=b
    agrid[i+1]=c
print(agrid)

Submission status: Wrong Answer

Solution code:
N = int(input())
SP = []
for _ in range(N):
    sp = input().split()
    sp[1] = int(sp[1])
    SP.append(sp)

ssp = sorted(SP, key=lambda x:(x[0], -x[1]))
for sp in SP:
    for i in range(len(ssp)):
        if ssp[i][0] == sp[0] and ssp[i][1] == sp[1]:
            print(i+1)

Submission status: Wrong Answer

Solution code:
N = int(input())
r = []

for i in range(1, N+1):
    name, point = (x for x in input().split())
    r.append([name, point, i])
r.sort(key=lambda x: x[0])
r.sort(key=lambda x: x[1])

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

Submission status: Wrong Answer

Solution code:
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])

Submission status: Wrong Answer

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

R.sort()
print(R)
for i in R:
    print(i[2] + 1)

Submission status: Wrong Answer

Solution code:
N = int(input())
book= []
for i in range(N):
    a = input().split()
    city = a[0]
    score = int(a[1])
    book.append((city, score))
b=sorted(book)
for i in range(N):
    print(b[i][0], b[i][1])

Submission status: Wrong Answer

Solution code:
N = int(input())
SPlist = []
for i in range(N):
    S, P =  input().split(" ")
    au = [S, int(P), i+1]
    SPlist.append(au)
SPlist.sort()

for k in range(N-1):
    if SPlist[k][0] == SPlist[k+1][0]:
        if SPlist[k][1] < SPlist[k+1][1]:
            itizi = SPlist[k]
            SPlist[k] = SPlist[k+1]
            SPlist[k+1] = itizi

for u in range(N):
    print(SPlist[u][2])

Submission status: Wrong Answer

Solution code:
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][1])

Submission status: Wrong Answer

Solution code:
rest = dict()
for i in range(int(input())):
    name, score = input().split(" ")
    rest[i+1] = int(score)
[print(i) for i, j in sorted(rest.items(), key=lambda x: x[1], reverse=True)]

Submission status: Wrong Answer

Solution code:
n = int(input())
L = []
i = 0
while i < n:
    s,p = map(str,input().split(' '))
    L.append((s,p,i))
    i += 1
print(L)
L.sort()
ans = ''
for l in L:
    ans += str(l[2]-1)+'\n'
print(ans[:-1])

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

N = int(input())

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

for i, (name, tup) in enumerate(sorted(city.items())):
    if len(tup) > 1:
        for score, num in sorted(tup, reverse=True):
            print(num)

Submission status: Wrong Answer

Solution code:
from operator import itemgetter

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

s_ = sorted(s_, key=itemgetter(0,1,2), reverse=True)
s_ = sorted(s_, key=itemgetter(0))
for i, j, k in s_:
    print(k)

Submission status: Wrong Answer

Solution code:
n = int(input())
sp = [list(input().split()) for _ in range(n)]
for i in range(len(sp)):
    sp[i][1] = int(sp[i][1])
d = sorted(sp, key=lambda x:(x[0],-x[1]))
for i in range(len(sp)):
    print(sp.index(d[i]))

Submission status: Wrong Answer

Solution code:
from sys import stdin
import numpy as np
# import math
# import random
# import fractions
# import sys
# sys.setrecursionlimit(100000)
# N = int(stdin.readline().rstrip().split()[0])
# A = [int(x) for x in stdin.readline().rstrip().split()]
# N, X = [int(x) for x in stdin.readline().rstrip().split()]
# S = stdin.readline().rstrip().split()[0]
N = int(stdin.readline().rstrip().split()[0])
S=[]
for i in range(N):
  s, p = [x for x in stdin.readline().rstrip().split()]
  S.append(s+str(1000-int(p)))
# print(S)
Sidx=sorted(S)
# print(S)
# print(Sidx)
for i in range(N):
  print(S.index(Sidx[i])+1)

Submission status: Wrong Answer

Solution code:
n=int(input())
l=[]
for i in range(n):
    l.append(list(input().split())+[i+1])
l=sorted(l, key=lambda x: x[0])
s=sorted(set([x[0] for x in l]))
for c in s:
    x=sorted([a for a in l if a[0]==c], key=lambda x: x[1])[::-1]
    for a in x:
        print(a[2])

Submission status: Wrong Answer

Solution code:
n=int(input())
res=[]
city=[]
for i in range(n):
    s,p=map(str,input().split())
    p=int(p)
    res.append([s,p,i+1])
R=sorted(res,key=lambda x : x[1],reverse=True)
Res=sorted(R,key=lambda x : x[0])
print(Res)
for j in Res:
    print(j[2])

Submission status: Wrong Answer

Solution code:
N = int(input())
s = [(lambda x, v: (x, -int(v)))(*input().split()) for i in range(N)]
s2 = s.copy()

s.sort()

print(s)
for i in s:
    print(s2.index(i)+1)

Submission status: Wrong Answer

Solution code:
n = int(input())

sp = [list(input().split()) for i in range(n)]
for index, sp_t in enumerate(sp):
        sp_t.append(index)
sp.sort(key=lambda x:x[1], reverse=True)
sp.sort(key=lambda x:x[0])


for sp_t in sp:
        print(sp_t[2]+1)

Submission status: Wrong Answer

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

for i in range(n):
  a,b=map(str,input().split())
  s.append([a,b,i+1])
  
#s.sort(key=lambda x:(x[0],x[1]))
print(s)

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

Submission status: Wrong Answer

Solution code:
n = int(input())
restaurant = [list(map(str, input().split())) for _ in range(n)]

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

# print(*restaurant)

restaurant.sort(key=lambda q: -q[1])

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

Submission status: Wrong Answer

Solution code:
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])

Submission status: Wrong Answer

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

sorted_bag = sorted(bag, key=lambda x:x[0])
sorted_shi = sorted(list(set(shi)))


dic = {}
for s, p, i in bag:
    if s not in dic.keys():
        dic[s] = [[p, i]]
    else:
        dic[s].append([p, i])

for s in sorted_shi:
    if len(dic[s]) == 1:
        print(dic[s][0][1])
    else:
        so = sorted(dic[s], key=lambda x:x[0])[-1::-1]
        for e in so:
            print(e[1])

Submission status: Wrong Answer

Solution code:
N = int(input())
R = [input().split() + [i+1] for i in range(N)]
print(R)
R.sort(key=lambda x: -int(x[1]))
R.sort(key=lambda x: x[0])
[print(n) for _, _, n in R]

Submission status: Wrong Answer

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

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

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

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

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
inf = float('inf')
mod = 10**9+7


def INT_(n): return int(n)-1


def MI(): return map(int, input().split())


def MF(): return map(float, input().split())


def MI_(): return map(INT_, input().split())


def LI(): return list(MI())


def LI_(): return [int(x) - 1 for x in input().split()]


def LF(): return list(MF())


def LIN(n: int): return [input() for _ in range(n)]


def LLIN(n: int): return [LI() for _ in range(n)]


def LLIN_(n: int): return [LI_() for _ in range(n)]


def LLI(): return [list(map(int, l.split())) for l in input()]


def I(): return int(input())


def F(): return float(input())


def ST(): return input().replace('\n', '')


def main():
    N = I()
    #city = []
    city = set()
    sp = []
    for i in range(N):
        i += 1
        s, p = input().split()
        p = int(p)
        sp.append([s, p, i])
        city.add(s)
    city = list(city)
    city.sort()
    ans = [[] for i in range(len(city))]
    sp.sort(reverse=True, key=lambda x: x[1])
    for s, p, i in sp:
        for j, c in enumerate(city):
            if s == c:
                ans[j].append(i)

    print(city)

    for a in ans:
        print(*a, sep="\n")


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n=int(input())
rows=[input() for i in range(n)] 
print(sorted(rows))

Submission status: Wrong Answer

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

res = sorted(res, key=lambda x: (x[2], x[1]), reverse=True)
for r in res:
    print(r[0])

Submission status: Wrong Answer

Solution code:
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])

Submission status: Wrong Answer

Solution code:
import sys
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def II(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def SI(): return input()
YN = lambda b: print('YES') if b else print('NO')
yn = lambda b: print('Yes') if b else print('No')

def main():
    N = II()
    li = []
    for i in range(N):
        S, P = LS()
        li.append([S, int(P), i])

    li = sorted(li, key= lambda x: (x[0], -x[1]))
    print(li)
    for j in li:
        print(j[2]+1)

main()

Submission status: Wrong Answer

Solution code:
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])

Submission status: Wrong Answer

Solution code:
N = int(input())
SP = sorted([[_ for _ in input().split()] + [i] for i in range(N)],
            key=lambda xs: xs[0] * (100 - int(xs[1])))
[print(_[2] + 1) for _ in SP]

Submission status: Wrong Answer

Solution code:
N = int(input())
Ss, Ps = [ [], [] ]
for i in range(N):
    s, p = input().split(" ")
    Ss.append(s)
    Ps.append(int(p))
rests = list(zip(range(1, N+1), Ss, Ps))
rests.sort(key=lambda x: (x[1], -x[2]))
print(rests)
print('\n'.join([str(i) for i,_,_ in rests]))

Submission status: Wrong Answer

Solution code:
n = int(input())
t = []
for i in range(n):
    tmp = input().split()
    t.append(tuple(tmp))
tmp = sorted(t, key=lambda x: x[1],reverse = True)
res = sorted(tmp, key=lambda x: x[0])
for sp in res:
    print(t.index(sp)+1)

Submission status: Wrong Answer

Solution code:
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])

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sun May 26 20:55:50 2019

@author: Yamazaki Kenichi
"""

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


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

for c in sp:
    print(int(c[2])+1)

Submission status: Wrong Answer

Solution code:
n = int(input())
SP = []
for i in range(n):
    s,p = input().split()
    SP.append([i+1,s,int(p)])
    
from operator import itemgetter

SP.sort(key = itemgetter(2))
SP.sort(key = itemgetter(1))
for j,s,p in SP:
    print(j)

Submission status: Wrong Answer

Solution code:
from operator import itemgetter
n = int(input())
P = []
for i in range(n):
    s, p = input().split()
    P.append((s, p, i+1))

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

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

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**7)
import numpy as np
# n = int(input())
# a, b = map(int, input().split())
# int_list = list(map(int, input().split()))
# l = list(input().split())



def solve():
    s_list = []
    p_list = []
    n = int(input())
    for i in range(n):
        s, p = input().split()
        s_list.append(s)
        p_list.append(int(p))
    s_npa = np.array(s_list, dtype=str)
    p_npq = np.array(p_list, dtype=int)

    argp = np.argsort(p_npq)[::-1]
    # print(argp)
    # print(s_npa[argp])
    args = np.argsort(s_npa[argp])
    idx = np.array(range(n))[argp][args] + 1
    for i in idx:
        print(i)

solve()

Submission status: Wrong Answer

Solution code:
n = int(input())
rs = [input().split() for _ in range(n)]
rs = [(r, int(p)) for r, p in rs]
srs = sorted(sorted(rs, key=lambda p: p[1]), key=lambda p: p[0])

for p in rs:
  print(srs.index(p)+1)

Submission status: Wrong Answer

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

res = sorted(res, key=lambda x: (x[1], x[2]), reverse=True)
for r in res:
    print(r[0])

Submission status: Wrong Answer

Solution code:
import sys
rr = lambda: sys.stdin.readline().strip()
rri = lambda: int(rr())
rrs = lambda: [int(_) for _ in rr().split()]

from operator import itemgetter

N = rri()
data = [[i + 1] + rr().split() for i in range(N)]

data.sort(key=itemgetter(2), reverse=True)
data.sort(key=itemgetter(1))

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

Submission status: Wrong Answer

Solution code:
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])

Submission status: Wrong Answer

Solution code:
N = int(input())
X = [list(input().split()) for _ in range(N)]
X.sort(key=lambda x: (x[0], -int(x[1])))
for a, b in X:
  print(a, b)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
S = []

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

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

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

Submission status: Wrong Answer

Solution code:
N = int(input())
re = []
for i in range(N):
    re.append(list(input().split()) + [i+1])
for i in range(N):
    re[i][1] = int(re[i][1])
re = sorted(re, key = lambda x: x[1], reverse = True)
re = sorted(re, key = lambda x: x[0])
print(re)
for i in range(N):
    print(re[i][2])

Submission status: Wrong Answer

Solution code:
N = int(input())
S = []

for i in range(N):
    ts,tp = input().split()
    ts = str(ts)
    tp = int(tp)
    S.append([ts,tp])

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

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

Submission status: Wrong Answer

Solution code:
n = int(input())
l = []
for i in range(1, n+1):
    k = input().split()
    l.append((k, i))
l.sort()
for ll in l:
    print(ll[1])

Submission status: Wrong Answer

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

Submission status: Accepted

Solution code:
#-*-coding:utf-8-*-
import sys
input=sys.stdin.readline
import numpy as np

def main():
    restaurants=[]
    n = int(input())
    restaurants=[list(input().split()) for _ in range(n)]

    for idx,restaurant in enumerate(restaurants):
        restaurants[idx][1]=int(str(restaurant[1]))
        restaurants[idx].append(idx+1)
    restaurants.sort(key=lambda x:x[1],reverse=True)
    restaurants.sort(key=lambda x:x[0].lower())
    for restaurant in restaurants:
        print(restaurant[2])

if __name__=="__main__":
    main()

Submission status: Accepted

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