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