n = int(input())
sp ={}
l = [] 
for i in range(n):
    s,p = input().split()
    sp ={}
    sp["index"] = i+1
    sp["name"] = s
    sp["score"] = int(p)
    l.append(sp)


for dic in sorted(l, key=lambda x: (x["name"], -x["score"])):
    print(dic["index"]) n = int(input()) n int(input()) int input() input sp ={} sp {} l = [] l [] for i in range(n):
    s,p = input().split()
    sp ={}
    sp["index"] = i+1
    sp["name"] = s
    sp["score"] = int(p)
    l.append(sp) i range(n) range n s,p = input().split() s input().split() ().split () input split p sp ={} sp {} sp["index"] = i+1 sp["index"] sp "index" i+1 i 1 sp["name"] = s sp["name"] sp "name" s sp["score"] = int(p) sp["score"] sp "score" int(p) int p l.append(sp) l.append l append sp for dic in sorted(l, key=lambda x: (x["name"], -x["score"])):
    print(dic["index"]) dic sorted(l, key=lambda x: (x["name"], -x["score"])) sorted l key=lambda x: (x["name"], -x["score"]) key lambda x: (x["name"], -x["score"]) (x["name"], -x["score"]) x["name"] x "name" -x["score"] x["score"] x "score" x print(dic["index"]) print dic["index"] dic "index" l = [] [] l sp ={} {} sp sp ={} {} sp s,p = input().split() input().split() s p = input().split() input().split() p n = int(input()) int(input()) n
n = int(input())
sp ={}
l = [] 
for i in range(n):
    s,p = input().split()
    sp ={}
    sp["index"] = i+1
    sp["name"] = s
    sp["score"] = int(p)
    l.append(sp)


for dic in sorted(l, key=lambda x: (x["name"], -x["score"])):
    print(dic["index"])