n = int(input())

l = []

for i in range(n):
    s, p = map(str, input().split())
    p = int(p)
    l.append([s, -p, i+1])

l.sort()

for _, _, i in l:
    print(i) n = int(input()) n int(input()) int input() input l = [] l [] for i in range(n):
    s, p = map(str, input().split())
    p = int(p)
    l.append([s, -p, i+1]) i range(n) range n s, p = map(str, input().split()) s map(str, input().split()) map str input().split() ().split () input split p p = int(p) p int(p) int p l.append([s, -p, i+1]) l.append l append [s, -p, i+1] s -p p i+1 i 1 l.sort() l.sort l sort for _, _, i in l:
    print(i) _ _ i l print(i) print i l = [] [] l p = map(str, input().split()) map(str, input().split()) p p = int(p) int(p) p s, p = map(str, input().split()) map(str, input().split()) s n = int(input()) int(input()) n
n = int(input())

l = []

for i in range(n):
    s, p = map(str, input().split())
    p = int(p)
    l.append([s, -p, i+1])

l.sort()

for _, _, i in l:
    print(i)
