from operator import itemgetter
N = int(input())

T = list()
for i in range(N):
    S, P = map(str, input().split())
    T.append((S, int(P), str(i+1)))

T = sorted(T, key=itemgetter(1), reverse=True)
T = sorted(T, key=itemgetter(0))
for t in T:
    print(t[2]) from operator import itemgetter N = int(input()) N int(input()) int input() input T = list() T list() list for i in range(N):
    S, P = map(str, input().split())
    T.append((S, int(P), str(i+1))) i range(N) range N S, P = map(str, input().split()) S map(str, input().split()) map str input().split() ().split () input split P T.append((S, int(P), str(i+1))) T.append T append (S, int(P), str(i+1)) S int(P) int P str(i+1) str i+1 i 1 T = sorted(T, key=itemgetter(1), reverse=True) T sorted(T, key=itemgetter(1), reverse=True) sorted T key=itemgetter(1) key itemgetter(1) itemgetter 1 reverse=True reverse True T = sorted(T, key=itemgetter(0)) T sorted(T, key=itemgetter(0)) sorted T key=itemgetter(0) key itemgetter(0) itemgetter 0 for t in T:
    print(t[2]) t T print(t[2]) print t[2] t 2 N = int(input()) int(input()) N S, P = map(str, input().split()) map(str, input().split()) S T = sorted(T, key=itemgetter(0)) sorted(T, key=itemgetter(0)) T T = sorted(T, key=itemgetter(1), reverse=True) sorted(T, key=itemgetter(1), reverse=True) T T = list() list() T P = map(str, input().split()) map(str, input().split()) P
from operator import itemgetter
N = int(input())

T = list()
for i in range(N):
    S, P = map(str, input().split())
    T.append((S, int(P), str(i+1)))

T = sorted(T, key=itemgetter(1), reverse=True)
T = sorted(T, key=itemgetter(0))
for t in T:
    print(t[2])
