qyliang/CodeNanoFix huggingface dataset:
Buggy code:
N=int(input())

SP=[]
for i in range(N):
    SP.append(input().split())
    SP[i][1] = int(SP[i][1])
    SP[i].append(i)
    print(SP)

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

for j in range(N):
    print(SP[j][2]+1)


Fixed code:
N=int(input())

SP=[]
for i in range(N):
    SP.append(input().split())
    SP[i][1] = int(SP[i][1])
    SP[i].append(i)
    #print(SP)

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

for j in range(N):
    print(SP[j][2]+1)
Buggy code:
n = int(input())
SP = []
for i in range(n):
    s,p = input().split()
    sp = (i,s,int(p))
    SP.append(sp)

newSP = sorted(SP,key = lambda tup:(tup[1],-tup[2]))

print(newSP)

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


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

newSP = sorted(SP,key = lambda tup:(tup[1],-tup[2]))

for i in range(n):
    print(newSP[i][0] + 1)
Buggy 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])


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

for info in info_list:
    print(info[0])
Buggy 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])


Fixed 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], reverse=True)
    for i in a:
        print(i[1])
Buggy code:
def Guide():
    N = int(input())
    lst = []
    for i in range(1, N + 1):
        city, score = input().split()
        lst.append([city, int(score), i])
    sorted_lst = sorted(lst, key=lambda x:(x[0], x[1]))

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


Guide()


Fixed code:
def Guide():
    N = int(input())
    lst = []
    for i in range(1, N + 1):
        city, score = input().split()
        lst.append([city, int(score), i])
    sorted_lst = sorted(lst, key=lambda x:(x[0], -x[1]))

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


Guide()
Buggy code:
# -*- coding: utf-8 -*-

N = int(input())
str_list = [input() for x in range(N)]
str_sort = sorted(str_list, key=lambda x: x.split()[1], reverse=True)
str_sort2 = sorted(str_sort, key=lambda x: x.split()[0])

for x in str_sort2:
    print(str_list.index(x)+1)

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

N = int(input())
str_list = [input() for x in range(N)]
str_sort = sorted(str_list, key=lambda x: int(x.split()[1]), reverse=True)
str_sort2 = sorted(str_sort, key=lambda x: x.split()[0])

for x in str_sort2:
    print(str_list.index(x)+1)
Buggy code:
a=[]
for i in range(int(input())):
    s, p = input().split()
    p=int(p)
    a.append((s,p,i+1))
a.sort(key=lambda x:(x[0],-x[1]))
print(a)
[print(x[2])for x in a]

Fixed code:
a=[]
for i in range(int(input())):
    s, p = input().split()
    p=int(p)
    a.append((s,p,i+1))
a.sort(key=lambda x:(x[0],-x[1]))
[print(x[2])for x in a]
Buggy code:
from operator import itemgetter
N=int(input())
R=[]
for i in range(N):
    s,p=input().split()
    int(p)
    R.append([s,p])

sorted_R=sorted(R,key = itemgetter(1),reverse=True)
sorted_R=sorted(sorted_R, key = itemgetter(0))

for i in range(len(R)):
    for j in range(len(R)):
        if R[j]==sorted_R[i]:
            print(j+1)

Fixed code:
from operator import itemgetter
N=int(input())
R=[]
for i in range(N):
    s,p=input().split()
    p=int(p)
    R.append([s,p])

sorted_R=sorted(R,key = itemgetter(1),reverse=True)
sorted_R=sorted(sorted_R, key = itemgetter(0))

for i in range(len(R)):
    for j in range(len(R)):
        if R[j]==sorted_R[i]:
            print(j+1)
Buggy code:
n = int(input())

lis = []

for i in range(n):
    s, p = input().split()
    lis.append([i+1, s, p])
    
lis.sort(key=lambda x: x[1])

names =[]

for i in lis:
    if i[1] not in names:
        names.append(i[1])
        
score = 100000


for name in names:
    for l in lis:
        if name in l:
            l[2] = int(l[2]) + score
        else:
            score -= 200
            
for i in lis:
    print(i[0])

Fixed code:
n = int(input())

lis = []

for i in range(n):
    s, p = input().split()
    lis.append([i+1, s, p])
    
lis.sort(key=lambda x: x[1])

names =[]

for i in lis:
    if i[1] not in names:
        names.append(i[1])
        
score = 100000


for name in names:
    for l in lis:
        if name in l:
            l[2] = int(l[2]) + score
        else:
            score -= 200
            
lis.sort(key=lambda x: x[2], reverse=True)
            
for i in lis:
    print(i[0])
Buggy code:
from operator import itemgetter, attrgetter
N = int(input())
A = []
for i in range(N):
    tmp = input().split()
    A.append([tmp[0],-int(tmp[1]),i])
A.sort()
A.sort(key=itemgetter(0,1))
print([A[i][2]+1 for i in range(N)])

Fixed code:
from operator import itemgetter, attrgetter
N = int(input())
A = []
for i in range(N):
    tmp = input().split()
    A.append([tmp[0],-int(tmp[1]),i])
A.sort()
A.sort(key=itemgetter(0,1))
for i in range(N):
    print(A[i][2]+1)
Buggy code:
N = int(input())
l = []
for i in range(N):
    s, p = input().split(' ')
    l.append([s, int(p), i])
l.sort(key=lambda x:(x[0], -x[1]))
_ = [print(a[2]) for a in l]

Fixed code:
N = int(input())
l = []
for i in range(N):
    s, p = input().split(' ')
    l.append([s, int(p), i+1])
l.sort(key=lambda x:(x[0], -x[1]))
_ = [print(a[2]) for a in l]
Buggy code:
n = int(input())
city_score = {}
for i in range(n):
	city, score = input.split()
    city_score[city] = city_score.get(city, []). + [(int(score), i)]

for city in sorted(city_score.keys()):
  for score in sorted(city_score[city]):
    print(score[1])

Fixed code:
n = int(input())
city_score = {}
for i in range(n):
    city, score = input().split()
    city_score[city] = city_score.get(city, []) + [(int(score), i)]

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

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


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

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


Fixed code:
n = int(input())
list1 = []
for i in range(n):
    s,p = input().split()
    p = int(p)
    list1.append([s, -p, i+1])
list1.sort()
for i in list1:
    print(i[2])
Buggy code:
n=int(input())
l=[input().split() for i in range(n)]
tmp=sorted(l, key=lambda x: x[1],reverse=True)
tmp=sorted(tmp,key=lambda x: x[0])
l2=[x for x in range(10)]
ans=list(zip(l2,tmp))

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

Fixed code:
n=int(input())
l=[input().split() for i in range(n)]
l2=[x for x in range(n)]
base=list(zip(l2,l))
ans=sorted(base, key=lambda x: int(x[1][1]),reverse=True)
ans=sorted(ans,key=lambda x: x[1][0])

for i in range(n):
    print(1+ans[i][0])
Buggy code:
n=int(input())
sp=[list(map(str,input().split())) for l in range(n)]
sn=[]
ss=[]
sn2=[]
ss2=[]
for i in range(n):
    sn.append(sp[i][0])
    ss.append(sp[i][1])
sn2=sorted(sn)
ss=sorted(range(len(sn)), key=lambda k: sn[k])
for i in range(n):
    ss2.append(int(sp[ss[i]][1]))
#print(sn2)
#print(ss)
#print(ss2)
for i in range(n-1):
    if sn2[i]==sn2[i+1]:
        if ss2[i]<ss2[i+1]:
            ss[i+1],ss[i]=ss[i],ss[i+1]
            ss2[i+1],ss2[i]=ss2[i],ss2[i+1]
for i in range(n):
    print(ss[i]+1)


Fixed code:
n=int(input())
sp=[list(map(str,input().split())) for l in range(n)]
sn=[]
ss=[]
sn2=[]
ss2=[]
for i in range(n):
    sn.append(sp[i][0])
    ss.append(sp[i][1])
sn2=sorted(sn)
ss=sorted(range(len(sn)), key=lambda k: sn[k])
for i in range(n):
    ss2.append(int(sp[ss[i]][1]))
for i in range(n):
    for j in range(n-1,i,-1):
        if sn2[j]==sn2[j-1]:
            if ss2[j-1]<ss2[j]:
                ss[j-1],ss[j]=ss[j],ss[j-1]
                ss2[j-1],ss2[j]=ss2[j],ss2[j-1]

for i in range(n):
    print(ss[i]+1)
Buggy code:

n = input()
list = []

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

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


Fixed code:

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

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

list.sort(key=lambda x:(x[1],-x[2]))
for l in list:
    print(l[0])
Buggy code:
n=int(input())
a=[]

for i in range(n):
    s,p=input().split()
    a.append([s,100-int(p)])
print(a)
city=sorted(a)   
print(city)
for i in city:
    print(a.index(i)+1)


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

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

city=sorted(a)   

for i in city:
    print(a.index(i)+1)
Buggy code:
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])

Fixed code:
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])
Buggy code:
n=int(input())
info=[]
for i in range(n):
    s,p=input().split()
    info.append([i+1,s,p])
#print(info)
info2=sorted(info,key=lambda x:x[2],reverse=True)
info3=sorted(info2,key=lambda x:x[1])
#print(info3)
for i in range(n):
    print(info3[i][0])

Fixed code:
n=int(input())
info=[]
for i in range(n):
    s,p=input().split()
    info.append([i+1,s,int(p)])
#print(info)
info2=sorted(info,key=lambda x:x[2],reverse=True)
info3=sorted(info2,key=lambda x:x[1])
#print(info3)
for i in range(n):
    print(info3[i][0])
Buggy code:
# B
# Guidebook

N = int(input())

sp_list = []

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

#print(sp_list)

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

Fixed code:
# B
# Guidebook

N = int(input())

sp_list = []

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

#print(sp_list)

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

for i in sp_list:
#    print(sp_list)
    print(int(i[2]))
Buggy code:
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)


Fixed code:
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)
Buggy code:
N = int(input())
S = [None]*N
P = [None]*N

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

I = [j+1 for j in range(N)]

x = [(s, p, i) for s, p, i in zip(S, P, I)]

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

for s, p, i in x:
    print(i)

Fixed code:
N = int(input())
S = [None]*N
P = [None]*N

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

P = [int(p) for p in P]
I = [j+1 for j in range(N)]
x = [(s, p, i) for s, p, i in zip(S, P, I)]

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

for s, p, i in x:
    print(i)
Buggy code:
from operator import itemgetter
n = int(input())
sp = []
for i in range(n):
         s,p = input().split()
         tmp = [s,100-int(p),i]
         sp.append(tmp)
print(sp)
sp = sorted(sp,key = itemgetter(0,1))
print(sp)
for i in range(n):
         print(sp[i][2]+1)


Fixed code:
from operator import itemgetter
n = int(input())
sp = []
for i in range(n):
         s,p = input().split()
         tmp = [s,100-int(p),i]
         sp.append(tmp)
sp = sorted(sp,key = itemgetter(0,1))
for i in range(n):
         print(sp[i][2]+1)
Buggy code:
n = int(input())
x = [list(map(str,input().split())) for i in range(n)]
for i in range(n):
    x[i][1]=int(x[i][1])
a = [i for i in range(1,n+1)]
a = sorted(a,key=lambda y:(x[y-1][0],x[y-1][1]),reverse=True)
for i in a:
    print(i)

Fixed code:
n = int(input())
x = [list(map(str,input().split())) for i in range(n)]
for i in range(n):
    x[i][1]=int(x[i][1])
a = [i for i in range(1,n+1)]
a = sorted(a,key=lambda y:(x[y-1][0],-x[y-1][1]))
for i in a:
    print(i)
Buggy code:
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    n=INT()
    sp=[]
    for i in range(n):
        s,p=STRM()
        sp.append([s,p,i+1])
    sorted_sp1=sorted(sp, key=lambda x:x[1], reverse=True)
    sorted_sp2=sorted(sorted_sp1, key=lambda x:x[0])
    for i in range(n):
        print(sorted_sp2[i][2])
    
if __name__ == '__main__':
    do()

Fixed code:
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    n=INT()
    sp=[]
    for i in range(n):
        s,p=STRM()
        sp.append([s,int(p),i+1])
    sorted_sp1=sorted(sp, key=lambda x:x[1], reverse=True)
    sorted_sp2=sorted(sorted_sp1, key=lambda x:x[0])
    for i in range(n):
        print(sorted_sp2[i][2])
    
if __name__ == '__main__':
    do()
Buggy code:
n = int(input())
li = []
for i in range(1, n+1):
    name, point = input().split()
    point = int(point)
    li.append([name, -point, i])

li.sort()

print(li)
for ans in li:
    print(ans[2])
    continue

Fixed code:
n = int(input())
li = []
for i in range(1, n+1):
    name, point = input().split()
    point = int(point)
    li.append([name, -point, i])

li.sort()

# print(li)
for ans in li:
    print(ans[2])
    continue
Buggy 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))

Fixed 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([[int(b),i+1]])
    li.append(a)
    l.append([a,cou])
    cou += 1
  else:
    lis[li.index(a)].append([int(b),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))
Buggy code:
n=int(input())
sp=[]
for i in range(n):
  x,y=input().split()
  sp.append([x,int(y),i+1])
  sp.sort(key=lambda x:(x[0],x[1]))
for i in range(n):
  print(sp[i][2])

Fixed code:
n=int(input())
sp=[]
for i in range(n):
  x,y=input().split()
  sp.append([x,int(y),i+1])
  sp.sort(key=lambda x:(x[0],-x[1]))
for i in range(n):
  print(sp[i][2])
Buggy code:
N=int(input())
Index=[]
S=[]
P=[]
for i in range(N):
  Index.append(i+1)
  s,p=input().split()
  S.append(s)
  P.append(p)
#print(S)
#print(P)

for i in range(N):
  deleteIndex=0
  outputIndex=Index[0]
  minS=S[0]
  maxP=P[0]
  for j in range(1,N-i):
    if (S[j] < minS) or ((S[j] == minS) and (P[j] > maxP)):
      deleteIndex=j
      outputIndex=Index[j]
      minS=S[j]
      maxP=P[j]
  print(outputIndex)
  del Index[deleteIndex]
  del S[deleteIndex]
  del P[deleteIndex]
  
      

Fixed code:
N=int(input())
Index=[]
S=[]
P=[]
for i in range(N):
  Index.append(i+1)
  s,p=input().split()
  S.append(s)
  P.append(int(p))
#print(S)
#print(P)

for i in range(N):
  deleteIndex=0
  outputIndex=Index[0]
  minS=S[0]
  maxP=P[0]
  for j in range(1,N-i):
    if (S[j] < minS) or ((S[j] == minS) and (P[j] > maxP)):
      deleteIndex=j
      outputIndex=Index[j]
      minS=S[j]
      maxP=P[j]
  print(outputIndex)
  del Index[deleteIndex]
  del S[deleteIndex]
  del P[deleteIndex]
Buggy code:
N,que=int(input()),[]
for i in range(N):
    s,p=list(input().split())
    que.append((s,int(p),i+1))
que.sort()
for x in que:
    print(x[-1])

Fixed code:
N,que=int(input()),[]
for i in range(N):
    s,p=list(input().split())
    que.append((s,-int(p),i+1))
que.sort()
for x in que:
    print(x[-1])
Buggy code:
n=int(input())
res=[]
for i in range(n):
	s,p=max(str,input().split())
    res.append([s,int(p)])
res1=res
res=sorted(res,key=lambda x:x[0], -x[1])
for i in range(n):
	print(res1.index(res[i])+1)

Fixed code:
n=int(input())
res = []
for i in range(n):
    s,p=map(str, input().split())
    res += [(s,int(p))]
res1=res
res = sorted(res, key=lambda x:(x[0],-x[1]))
for i in range(n):
    print(res1.index(res[i])+1)
Buggy code:
N = int(input())
S = sorted((map(lambda y: (y[0], -int(y[1]), x), input().split()) for x in range(1, N+1)))
for x in S:
  print(x[2])


Fixed code:
N = int(input())
S = sorted((list((lambda y: (y[0], -int(y[1]), x))(input().split()))) for x in range(1, N+1))

for x in S:
  print(x[2])
Buggy code:
N = int(input())
l = [list(input().split()) for _ in range(N)]
for i in range(N):
  l[i] += [i+1]
l.sort(key=lambda x:x[0])
l.sort(key=lambda x:int(x[1]))
for j in range(N):
  print(l[j][2])

Fixed code:
N = int(input())
l = [list(input().split()) for _ in range(N)]
for i in range(N):
  l[i] += [i+1]
l.sort(key=lambda x:(x[0],-int(x[1])))

for j in range(N):
  print(l[j][2])
Buggy code:
N = int(input())

d = {}
S = set()

for i in range(N):
    s,p = input().split()
    p = int(p)
    S.add(s)
    if s in d:
        d[s].append([p, i+1])
        continue
    d[s] = []
    d[s].append([p, i+1])
print(d)
S = list(S)
S.sort()

for key in S:
    L = d[key]

    L = sorted(L, reverse=True)
    for l in L:
        print(l[1]) 

Fixed code:
N = int(input())

d = {}
S = set()

for i in range(N):
    s,p = input().split()
    p = int(p)
    S.add(s)
    if s in d:
        d[s].append([p, i+1])
        continue
    d[s] = []
    d[s].append([p, i+1])
S = list(S)
S.sort()

for key in S:
    L = d[key]

    L = sorted(L, reverse=True)
    for l in L:
        print(l[1])
Buggy code:

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

sp.sort()
print(sp)

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

"""
from operator import itemgetter

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

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

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


Fixed code:

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

sp.sort()

for s,p,i in sp:
    print(i)

"""
from operator import itemgetter

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

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

l.sort(key = itemgetter(0))
l = sorted(l, key = lambda x:(x[1]),reverse = True)
print(l)
"""
Buggy code:
N=int(input())
S=[]
for i in range(N):
    S.append(list(input().split()))
    S[i][1]=-int(S[i][1])
for i in range(N):
    print(sorted(range(N),key=lambda k : S[k])[i])

Fixed code:
N=int(input())
S=[]
for i in range(N):
    S.append(list(input().split()))
    S[i][1]=-int(S[i][1])
for i in range(N):
    print(sorted(range(N),key=lambda k : S[k])[i]+1)
Buggy code:
N = int(input())
SP = []
name = []
for i in range(N):
    x = list(input().split())
    x = [x[0], int(x[1]), int(i)]
    name.append(x[0])
    SP.append(x)


# sort on secondary key
s = sorted(SP, key=lambda x: (x[0], x[1]))
# now sort on primary key, descending
#sorted(s, key=attrgetter('grade'), reverse=True)

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

Fixed code:
N = int(input())
SP = []
name = []
for i in range(N):
    x = list(input().split())
    x = [x[0], int(x[1]), int(i)]
    name.append(x[0])
    SP.append(x)


# sort on secondary key
s = sorted(SP, key=lambda x: (x[0], -x[1]))
# now sort on primary key, descending
#sorted(s, key=attrgetter('grade'), reverse=True)

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

Fixed code:
n = int(input())
l = []
for i in range(n):
  a, b = input().split()
  l.append((i+1, a, int(b)))
  
l = sorted(l, key=lambda x: (x[1],-x[2]))
for i in l:
  print(i[0])
Buggy 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]))

Fixed code:
N = int(input())

data=[]
for i in range(N):
    S,P = input().split()
    li = [i+1,S,int(P)]
    data.append(li)
    
data.sort(reverse=True, key=lambda x: x[2])
data.sort(key=lambda x: x[1])
for i in range(N):
    print(str(data[i][0]))
Buggy code:
from operator import itemgetter

N = int(input())

restaurnats = []
for i in range(N):
    restraunt = input().split()
    restraunt.append(i+1)
    restaurnats.append(restraunt)

restaurnats = sorted(restaurnats, key=itemgetter(1), reverse=True)
restaurnats = sorted(restaurnats, key=itemgetter(0))
for i in restaurnats:
    print(i[2])

Fixed code:
from operator import itemgetter

N = int(input())

restaurnats = []
for i in range(N):
    name, points = input().split()
    restraunt = [name, int(points), i+1]   
    restaurnats.append(restraunt)

restaurnats = sorted(restaurnats, key=itemgetter(1), reverse=True)
restaurnats = sorted(restaurnats, key=itemgetter(0))
for i in restaurnats:
    print(i[2])
Buggy code:
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])

Fixed code:
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])
Buggy code:
N = int(input())
restaurant = []
for i in range(0, N):
	shop = input().split()
	restaurant.append([i+1, shop[0], shop[1]])
restaurant.sort(key = lambda val: (val[1], val[2]))
for i in range(0, N):
	print(restaurant[i][0])

Fixed code:
N = int(input())
restaurant = []
for i in range(0, N):
	shop = input().split()
	restaurant.append([i+1, shop[0], int(shop[1])])
restaurant.sort(key = lambda val: (val[1], -val[2]))
for i in range(0, N):
	print(restaurant[i][0])