def nig (x,y):
    if x[0] == y[0]: return -1 if x[1]>y[1] else 1
    return -1 if x[0] < y[0] else 1
cuc_fuk = []
for x in range(input()):
    a,b = raw_input().split()
    cuc_fuk.append((a,int(b),x+1))
for piss in sorted(cuc_fuk, cmp = nig ):
    print piss[2] def nig (x,y):
    if x[0] == y[0]: return -1 if x[1]>y[1] else 1
    return -1 if x[0] < y[0] else 1 nig if x[0] == y[0]: return -1 if x[1]>y[1] else 1
     x[0] == y[0] x[0] x 0 y[0] y 0 return -1 if x[0] < y[0] else 1 -1 if x[0] < y[0] else 1 x[0] < y[0] x[0] x 0 y[0] y 0 -1 1 x x y y cuc_fuk = [] cuc_fuk [] for x in range(input()):
    a,b = raw_input().split()
    cuc_fuk.append((a,int(b),x+1)) x range(input()) range input() input a,b = raw_input().split() a raw_input().split() ().split () raw_input split b cuc_fuk.append((a,int(b),x+1)) cuc_fuk.append cuc_fuk append (a,int(b),x+1) a int(b) int b x+1 x 1 for piss in sorted(cuc_fuk, cmp = nig ):
    print piss[2] piss sorted(cuc_fuk, cmp = nig ) sorted cuc_fuk cmp = nig cmp nig print piss[2] piss 2 def nig (x,y):
    if x[0] == y[0]: return -1 if x[1]>y[1] else 1
    return -1 if x[0] < y[0] else 1 def nig (x,y):
    if x[0] == y[0]: return -1 if x[1]>y[1] else 1
    return -1 if x[0] < y[0] else 1 nig b = raw_input().split() raw_input().split() b cuc_fuk = [] [] cuc_fuk a,b = raw_input().split() raw_input().split() a
def nig (x,y):
    if x[0] == y[0]: return -1 if x[1]>y[1] else 1
    return -1 if x[0] < y[0] else 1
cuc_fuk = []
for x in range(input()):
    a,b = raw_input().split()
    cuc_fuk.append((a,int(b),x+1))
for piss in sorted(cuc_fuk, cmp = nig ):
    print piss[2]