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