# 128 B

n = int(input())
s = []

for i in range(n):
    tp = list(input().split())
    s.append(tp)

for i in range(n):
    s[i][1] = int(s[i][1]) * (-1)
    s[i].append(i+1)
s.sort()

for i in range(n):
    print(s[i][2])
 n = int(input()) n int(input()) int input() input s = [] s [] for i in range(n):
    tp = list(input().split())
    s.append(tp) i range(n) range n tp = list(input().split()) tp list(input().split()) list input().split() ().split () input split s.append(tp) s.append s append tp for i in range(n):
    s[i][1] = int(s[i][1]) * (-1)
    s[i].append(i+1) i range(n) range n s[i][1] = int(s[i][1]) * (-1) s[i][1] [i] s i 1 int(s[i][1]) * (-1) int(s[i][1]) int s[i][1] [i] s i 1 -1 s[i].append(i+1) [i].append [i] s i append i+1 i 1 s.sort() s.sort s sort for i in range(n):
    print(s[i][2]) i range(n) range n print(s[i][2]) print s[i][2] [i] s i 2 n = int(input()) int(input()) n tp = list(input().split()) list(input().split()) tp s = [] [] s
# 128 B

n = int(input())
s = []

for i in range(n):
    tp = list(input().split())
    s.append(tp)

for i in range(n):
    s[i][1] = int(s[i][1]) * (-1)
    s[i].append(i+1)
s.sort()

for i in range(n):
    print(s[i][2])

