from operator import itemgetter
N = int(input())
R = [list(input().split()) for i in range(N)]
R = [(R[i][0], int(R[i][1]), i+1) for i in range(N)]
S = sorted(R, key=itemgetter(1), reverse=True)
T = sorted(S, key=itemgetter(0))
for t in T:
    print(t[2]) from operator import itemgetter N = int(input()) N int(input()) int input() input list(input().split()) for i in range(N) for i in range(N) i range(N) range N for i in range(N) list(input().split()) list input().split() ().split () input split R = [list(input().split()) for i in range(N)] R [list(input().split()) for i in range(N)] (R[i][0], int(R[i][1]), i+1) for i in range(N) for i in range(N) i range(N) range N for i in range(N) (R[i][0], int(R[i][1]), i+1) R[i][0] [i] R i 0 int(R[i][1]) int R[i][1] [i] R i 1 i+1 i 1 R = [(R[i][0], int(R[i][1]), i+1) for i in range(N)] R [(R[i][0], int(R[i][1]), i+1) for i in range(N)] S = sorted(R, key=itemgetter(1), reverse=True) S sorted(R, key=itemgetter(1), reverse=True) sorted R key=itemgetter(1) key itemgetter(1) itemgetter 1 reverse=True reverse True T = sorted(S, key=itemgetter(0)) T sorted(S, key=itemgetter(0)) sorted S 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 R = [list(input().split()) for i in range(N)] [list(input().split()) for i in range(N)] R S = sorted(R, key=itemgetter(1), reverse=True) sorted(R, key=itemgetter(1), reverse=True) S T = sorted(S, key=itemgetter(0)) sorted(S, key=itemgetter(0)) T R = [(R[i][0], int(R[i][1]), i+1) for i in range(N)] [(R[i][0], int(R[i][1]), i+1) for i in range(N)] R N = int(input()) int(input()) N
from operator import itemgetter
N = int(input())
R = [list(input().split()) for i in range(N)]
R = [(R[i][0], int(R[i][1]), i+1) for i in range(N)]
S = sorted(R, key=itemgetter(1), reverse=True)
T = sorted(S, key=itemgetter(0))
for t in T:
    print(t[2])
