import copy

N = int(input())
org_arr = [list(input().split()) for _ in range(N)]
for i in range(len(org_arr)):
    org_arr[i][1]=int(org_arr[i][1])
    org_arr[i].append(i+1)

arr = copy.copy(org_arr)


arr = sorted(arr, reverse=True, key=lambda x: x[1])
arr.sort(key=lambda x:x[0])

for i in range(len(arr)):
    arr[i].append(i+1)

arr.sort(key=lambda x:x[0])
for i in range(len(arr)):
    print(arr[i][2]) import copy copy N = int(input()) N int(input()) int input() input list(input().split()) for _ in range(N) for _ in range(N) _ range(N) range N for _ in range(N) list(input().split()) list input().split() ().split () input split org_arr = [list(input().split()) for _ in range(N)] org_arr [list(input().split()) for _ in range(N)] for i in range(len(org_arr)):
    org_arr[i][1]=int(org_arr[i][1])
    org_arr[i].append(i+1) i range(len(org_arr)) range len(org_arr) len org_arr org_arr[i][1]=int(org_arr[i][1]) org_arr[i][1] [i] org_arr i 1 int(org_arr[i][1]) int org_arr[i][1] [i] org_arr i 1 org_arr[i].append(i+1) [i].append [i] org_arr i append i+1 i 1 arr = copy.copy(org_arr) arr copy.copy(org_arr) copy.copy copy copy org_arr arr = sorted(arr, reverse=True, key=lambda x: x[1]) arr sorted(arr, reverse=True, key=lambda x: x[1]) sorted arr reverse=True reverse True key=lambda x: x[1] key lambda x: x[1] x[1] x 1 x arr.sort(key=lambda x:x[0]) arr.sort arr sort key=lambda x:x[0] key lambda x:x[0] x[0] x 0 x for i in range(len(arr)):
    arr[i].append(i+1) i range(len(arr)) range len(arr) len arr arr[i].append(i+1) [i].append [i] arr i append i+1 i 1 arr.sort(key=lambda x:x[0]) arr.sort arr sort key=lambda x:x[0] key lambda x:x[0] x[0] x 0 x for i in range(len(arr)):
    print(arr[i][2]) i range(len(arr)) range len(arr) len arr print(arr[i][2]) print arr[i][2] [i] arr i 2 org_arr = [list(input().split()) for _ in range(N)] [list(input().split()) for _ in range(N)] org_arr arr = copy.copy(org_arr) copy.copy(org_arr) arr N = int(input()) int(input()) N arr = sorted(arr, reverse=True, key=lambda x: x[1]) sorted(arr, reverse=True, key=lambda x: x[1]) arr
import copy

N = int(input())
org_arr = [list(input().split()) for _ in range(N)]
for i in range(len(org_arr)):
    org_arr[i][1]=int(org_arr[i][1])
    org_arr[i].append(i+1)

arr = copy.copy(org_arr)


arr = sorted(arr, reverse=True, key=lambda x: x[1])
arr.sort(key=lambda x:x[0])

for i in range(len(arr)):
    arr[i].append(i+1)

arr.sort(key=lambda x:x[0])
for i in range(len(arr)):
    print(arr[i][2])
