n = int(input())    
spl = []
for i in range(n):
    s,p = map(str, input().split())
    p = int(p) *(-1)
    spl.append((s,p,i+1))
    
spl.sort()
for s,p,i in spl:
    print(i) n = int(input()) n int(input()) int input() input spl = [] spl [] for i in range(n):
    s,p = map(str, input().split())
    p = int(p) *(-1)
    spl.append((s,p,i+1))
     i range(n) range n s,p = map(str, input().split()) s map(str, input().split()) map str input().split() ().split () input split p p = int(p) *(-1) p int(p) *(-1) int(p) int p -1 spl.append((s,p,i+1)) spl.append spl append (s,p,i+1) s p i+1 i 1 spl.sort() spl.sort spl sort for s,p,i in spl:
    print(i) s p i spl print(i) print i p = map(str, input().split()) map(str, input().split()) p n = int(input()) int(input()) n spl = [] [] spl s,p = map(str, input().split()) map(str, input().split()) s p = int(p) *(-1) int(p) *(-1) p
n = int(input())    
spl = []
for i in range(n):
    s,p = map(str, input().split())
    p = int(p) *(-1)
    spl.append((s,p,i+1))
    
spl.sort()
for s,p,i in spl:
    print(i)