n = int(input())
sp = []
for i in range(n):
    s,p = map(str, input().split())
    sp.append((s,int(p)))
sp1 = tuple(sp)
sp = sorted(sp, key=lambda x:(x[0],-x[1]))
for h in sp:
    print(sp1.index(h)+1) n = int(input()) n int(input()) int input() input sp = [] sp [] for i in range(n):
    s,p = map(str, input().split())
    sp.append((s,int(p))) i range(n) range n s,p = map(str, input().split()) s map(str, input().split()) map str input().split() ().split () input split p sp.append((s,int(p))) sp.append sp append (s,int(p)) s int(p) int p sp1 = tuple(sp) sp1 tuple(sp) tuple sp sp = sorted(sp, key=lambda x:(x[0],-x[1])) sp sorted(sp, key=lambda x:(x[0],-x[1])) sorted sp 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 h in sp:
    print(sp1.index(h)+1) h sp print(sp1.index(h)+1) print sp1.index(h)+1 sp1.index(h) sp1.index sp1 index h 1 sp = sorted(sp, key=lambda x:(x[0],-x[1])) sorted(sp, key=lambda x:(x[0],-x[1])) sp sp = [] [] sp s,p = map(str, input().split()) map(str, input().split()) s n = int(input()) int(input()) n sp1 = tuple(sp) tuple(sp) sp1 p = map(str, input().split()) map(str, input().split()) p
n = int(input())
sp = []
for i in range(n):
    s,p = map(str, input().split())
    sp.append((s,int(p)))
sp1 = tuple(sp)
sp = sorted(sp, key=lambda x:(x[0],-x[1]))
for h in sp:
    print(sp1.index(h)+1)