n = int(input())
s_p = [ list(map(str, input().split())) for i in range(n)  ]

d = {}
for i, v in enumerate(s_p):
    s = v[0]
    p = v[1]
    if s not in d.keys():
        d[s] = [(i, p)]
    else:
        d[s] = sorted(d[s] + [(i,p)], key=lambda x: int(x[1]), reverse=True)

for key in sorted(d.keys()):
    for i,j in d[key]:
        print(i+1) n = int(input()) n int(input()) int input() input list(map(str, input().split())) for i in range(n) for i in range(n) i range(n) range n for i in range(n) list(map(str, input().split())) list map(str, input().split()) map str input().split() ().split () input split s_p = [ list(map(str, input().split())) for i in range(n)  ] s_p [ list(map(str, input().split())) for i in range(n)  ] d = {} d {} for i, v in enumerate(s_p):
    s = v[0]
    p = v[1]
    if s not in d.keys():
        d[s] = [(i, p)]
    else:
        d[s] = sorted(d[s] + [(i,p)], key=lambda x: int(x[1]), reverse=True) i v enumerate(s_p) enumerate s_p s = v[0] s v[0] v 0 p = v[1] p v[1] v 1 if s not in d.keys():
        d[s] = [(i, p)]
    else:
        d[s] = sorted(d[s] + [(i,p)], key=lambda x: int(x[1]), reverse=True) s not in d.keys() s d.keys() d.keys d keys d[s] = [(i, p)] d[s] d s [(i, p)] (i, p) i p d[s] = sorted(d[s] + [(i,p)], key=lambda x: int(x[1]), reverse=True) d[s] d s sorted(d[s] + [(i,p)], key=lambda x: int(x[1]), reverse=True) sorted d[s] + [(i,p)] d[s] d s [(i,p)] (i,p) i p key=lambda x: int(x[1]) key lambda x: int(x[1]) int(x[1]) int x[1] x 1 x reverse=True reverse True for key in sorted(d.keys()):
    for i,j in d[key]:
        print(i+1) key sorted(d.keys()) sorted d.keys() d.keys d keys for i,j in d[key]:
        print(i+1) i j d[key] d key print(i+1) print i+1 i 1 n = int(input()) int(input()) n p = v[1] v[1] p s = v[0] v[0] s s_p = [ list(map(str, input().split())) for i in range(n)  ] [ list(map(str, input().split())) for i in range(n)  ] s_p d = {} {} d
n = int(input())
s_p = [ list(map(str, input().split())) for i in range(n)  ]

d = {}
for i, v in enumerate(s_p):
    s = v[0]
    p = v[1]
    if s not in d.keys():
        d[s] = [(i, p)]
    else:
        d[s] = sorted(d[s] + [(i,p)], key=lambda x: int(x[1]), reverse=True)

for key in sorted(d.keys()):
    for i,j in d[key]:
        print(i+1)