n = int(input())
spi = []
for i in range(n):
    s,p = input().split()
    p = 100-int(p)
    spi.append([s,p,i+1])
spi.sort()
for x in spi:print(x[-1]) n = int(input()) n int(input()) int input() input spi = [] spi [] for i in range(n):
    s,p = input().split()
    p = 100-int(p)
    spi.append([s,p,i+1]) i range(n) range n s,p = input().split() s input().split() ().split () input split p p = 100-int(p) p 100-int(p) 100 int(p) int p spi.append([s,p,i+1]) spi.append spi append [s,p,i+1] s p i+1 i 1 spi.sort() spi.sort spi sort for x in spi:print(x[-1]) x spi p = input().split() input().split() p spi = [] [] spi n = int(input()) int(input()) n p = 100-int(p) 100-int(p) p s,p = input().split() input().split() s
n = int(input())
spi = []
for i in range(n):
    s,p = input().split()
    p = 100-int(p)
    spi.append([s,p,i+1])
spi.sort()
for x in spi:print(x[-1])