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