import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
#mod = 998244353
INF = 10**18
eps = 10**-7


N = int(readline())
SP = [list(readline().split()) + [i+1] for i in range(N)]
for i in range(N):
    SP[i][1] = int(SP[i][1])
SP.sort(key=lambda x: (x[0], -x[1]))
for i in range(N):
    print(SP[i][2]) import sys sys readline = sys.stdin.readline readline sys.stdin.readline sys.stdin sys stdin readline sys.setrecursionlimit(10**8) sys.setrecursionlimit sys setrecursionlimit 10**8 10 8 mod = 10**9+7 mod 10**9+7 10**9 10 9 7 INF = 10**18 INF 10**18 10 18 eps = 10**-7 eps 10**-7 10 -7 N = int(readline()) N int(readline()) int readline() readline list(readline().split()) + [i+1] for i in range(N) for i in range(N) i range(N) range N for i in range(N) list(readline().split()) + [i+1] list(readline().split()) list readline().split() ().split () readline split [i+1] i+1 i 1 SP = [list(readline().split()) + [i+1] for i in range(N)] SP [list(readline().split()) + [i+1] for i in range(N)] for i in range(N):
    SP[i][1] = int(SP[i][1]) i range(N) range N SP[i][1] = int(SP[i][1]) SP[i][1] [i] SP i 1 int(SP[i][1]) int SP[i][1] [i] SP i 1 SP.sort(key=lambda x: (x[0], -x[1])) SP.sort SP sort key=lambda x: (x[0], -x[1]) key lambda x: (x[0], -x[1]) (x[0], -x[1]) x[0] x 0 -x[1] x[1] x 1 x for i in range(N):
    print(SP[i][2]) i range(N) range N print(SP[i][2]) print SP[i][2] [i] SP i 2 readline = sys.stdin.readline sys.stdin.readline readline N = int(readline()) int(readline()) N INF = 10**18 10**18 INF SP = [list(readline().split()) + [i+1] for i in range(N)] [list(readline().split()) + [i+1] for i in range(N)] SP mod = 10**9+7 10**9+7 mod eps = 10**-7 10**-7 eps
import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
#mod = 998244353
INF = 10**18
eps = 10**-7


N = int(readline())
SP = [list(readline().split()) + [i+1] for i in range(N)]
for i in range(N):
    SP[i][1] = int(SP[i][1])
SP.sort(key=lambda x: (x[0], -x[1]))
for i in range(N):
    print(SP[i][2])