import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

n = int(input())
score = [0] * n
for i in range(n):
    s = input().split()
    score[i] = (s[0].strip(), int(s[1]), i + 1)

for s in sorted(score, key=lambda l: (l[0], -l[1])):
    print(s[2]) import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline sys.setrecursionlimit(10 ** 7) sys.setrecursionlimit sys setrecursionlimit 10 ** 7 10 7 n = int(input()) n int(input()) int input() input score = [0] * n score [0] * n [0] 0 n for i in range(n):
    s = input().split()
    score[i] = (s[0].strip(), int(s[1]), i + 1) i range(n) range n s = input().split() s input().split() ().split () input split score[i] = (s[0].strip(), int(s[1]), i + 1) score[i] score i (s[0].strip(), int(s[1]), i + 1) s[0].strip() [0].strip [0] s 0 strip int(s[1]) int s[1] s 1 i + 1 i 1 for s in sorted(score, key=lambda l: (l[0], -l[1])):
    print(s[2]) s sorted(score, key=lambda l: (l[0], -l[1])) sorted score key=lambda l: (l[0], -l[1]) key lambda l: (l[0], -l[1]) (l[0], -l[1]) l[0] l 0 -l[1] l[1] l 1 l print(s[2]) print s[2] s 2 score = [0] * n [0] * n score input = sys.stdin.readline sys.stdin.readline input n = int(input()) int(input()) n s = input().split() input().split() s
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

n = int(input())
score = [0] * n
for i in range(n):
    s = input().split()
    score[i] = (s[0].strip(), int(s[1]), i + 1)

for s in sorted(score, key=lambda l: (l[0], -l[1])):
    print(s[2])
