n=int(input())
l=list()
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(k) for i,j,k in l] n=int(input()) n int(input()) int input() input l=list() l list() list for i in range(n):
    s,p=input().split()
    l.append([s,int(p),i+1]) i range(n) range n s,p=input().split() s input().split() ().split () input split p l.append([s,int(p),i+1]) l.append l append [s,int(p),i+1] s int(p) int p i+1 i 1 l.sort(key=lambda x:(x[0],-x[1])) l.sort l sort key=lambda x:(x[0],-x[1]) key lambda x:(x[0],-x[1]) (x[0],-x[1]) x[0] x 0 -x[1] x[1] x 1 x print(k) for i,j,k in l for i,j,k in l i j k l for i,j,k in l print(k) print k [print(k) for i,j,k in l] n=int(input()) int(input()) n s,p=input().split() input().split() s p=input().split() input().split() p l=list() list() l
n=int(input())
l=list()
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(k) for i,j,k in l]
