n=int(input())
cnt=1
List=[]
for i in range(n):
    s,p=input().split()
    p=int(p)
    List.append([s,p,cnt])
    cnt+=1
List.sort()
for i in range(len(List)):
    for j in range(i+1,len(List)):
        if List[i][0]==List[j][0] and List[j][1]>=List[i][1]:
            List[i],List[j]=List[j],List[i]
for i in range(len(List)):
    print(List[i][2]) n=int(input()) n int(input()) int input() input cnt=1 cnt 1 List=[] List [] for i in range(n):
    s,p=input().split()
    p=int(p)
    List.append([s,p,cnt])
    cnt+=1 i range(n) range n s,p=input().split() s input().split() ().split () input split p p=int(p) p int(p) int p List.append([s,p,cnt]) List.append List append [s,p,cnt] s p cnt cnt+=1 cnt 1 List.sort() List.sort List sort for i in range(len(List)):
    for j in range(i+1,len(List)):
        if List[i][0]==List[j][0] and List[j][1]>=List[i][1]:
            List[i],List[j]=List[j],List[i] i range(len(List)) range len(List) len List for j in range(i+1,len(List)):
        if List[i][0]==List[j][0] and List[j][1]>=List[i][1]:
            List[i],List[j]=List[j],List[i] j range(i+1,len(List)) range i+1 i 1 len(List) len List if List[i][0]==List[j][0] and List[j][1]>=List[i][1]:
            List[i],List[j]=List[j],List[i] List[i][0]==List[j][0] and List[j][1]>=List[i][1] List[i][0]==List[j][0] List[i][0] [i] List i 0 List[j][0] [j] List j 0 List[j][1]>=List[i][1] List[j][1] [j] List j 1 List[i][1] [i] List i 1 List[i],List[j]=List[j],List[i] List[i] List i List[j] List j List[j] List j List[i] List i for i in range(len(List)):
    print(List[i][2]) i range(len(List)) range len(List) len List print(List[i][2]) print List[i][2] [i] List i 2 List=[] [] List s,p=input().split() input().split() s p=input().split() input().split() p cnt+=1 1 cnt cnt=1 1 cnt n=int(input()) int(input()) n p=int(p) int(p) p
n=int(input())
cnt=1
List=[]
for i in range(n):
    s,p=input().split()
    p=int(p)
    List.append([s,p,cnt])
    cnt+=1
List.sort()
for i in range(len(List)):
    for j in range(i+1,len(List)):
        if List[i][0]==List[j][0] and List[j][1]>=List[i][1]:
            List[i],List[j]=List[j],List[i]
for i in range(len(List)):
    print(List[i][2])