n = int(input())
a = []
for i in range(n):
    s, p = input().split()
    p = int(p)*-1
    a.append([i+1,s,p])
a = sorted(a, key=lambda x:(x[1], x[2]))
for i in range(n):
    print(a[i][0]) n = int(input()) n int(input()) int input() input a = [] a [] for i in range(n):
    s, p = input().split()
    p = int(p)*-1
    a.append([i+1,s,p]) i range(n) range n s, p = input().split() s input().split() ().split () input split p p = int(p)*-1 p int(p)*-1 int(p) int p -1 a.append([i+1,s,p]) a.append a append [i+1,s,p] i+1 i 1 s p a = sorted(a, key=lambda x:(x[1], x[2])) a sorted(a, key=lambda x:(x[1], x[2])) sorted a key=lambda x:(x[1], x[2]) key lambda x:(x[1], x[2]) (x[1], x[2]) x[1] x 1 x[2] x 2 x for i in range(n):
    print(a[i][0]) i range(n) range n print(a[i][0]) print a[i][0] [i] a i 0 s, p = input().split() input().split() s n = int(input()) int(input()) n p = input().split() input().split() p p = int(p)*-1 int(p)*-1 p a = sorted(a, key=lambda x:(x[1], x[2])) sorted(a, key=lambda x:(x[1], x[2])) a a = [] [] a
n = int(input())
a = []
for i in range(n):
    s, p = input().split()
    p = int(p)*-1
    a.append([i+1,s,p])
a = sorted(a, key=lambda x:(x[1], x[2]))
for i in range(n):
    print(a[i][0])