N = int(input())
L = sorted([list(input().split()) + [i + 1] for i in range(N)], key = lambda x: x[0])
while len(L) > 0:
    c = sum([x[0] == L[0][0] for x in L])
    M = sorted(L[0: c], key = lambda x : int(x[1]), reverse = True)
    for x in M:
        print(x[2])
    L = L[c:] N = int(input()) N int(input()) int input() input list(input().split()) + [i + 1] for i in range(N) for i in range(N) i range(N) range N for i in range(N) list(input().split()) + [i + 1] list(input().split()) list input().split() ().split () input split [i + 1] i + 1 i 1 L = sorted([list(input().split()) + [i + 1] for i in range(N)], key = lambda x: x[0]) L sorted([list(input().split()) + [i + 1] for i in range(N)], key = lambda x: x[0]) sorted [list(input().split()) + [i + 1] for i in range(N)] key = lambda x: x[0] key lambda x: x[0] x[0] x 0 x while len(L) > 0:
    c = sum([x[0] == L[0][0] for x in L])
    M = sorted(L[0: c], key = lambda x : int(x[1]), reverse = True)
    for x in M:
        print(x[2])
    L = L[c:] len(L) > 0 len(L) len L 0 x[0] == L[0][0] for x in L for x in L x L for x in L x[0] == L[0][0] x[0] x 0 L[0][0] [0] L 0 0 c = sum([x[0] == L[0][0] for x in L]) c sum([x[0] == L[0][0] for x in L]) sum [x[0] == L[0][0] for x in L] M = sorted(L[0: c], key = lambda x : int(x[1]), reverse = True) M sorted(L[0: c], key = lambda x : int(x[1]), reverse = True) sorted L[0: c] L 0: c 0 c 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 x in M:
        print(x[2])
     x M print(x[2]) print x[2] x 2 L = L[c:] L L[c:] L c: c L = sorted([list(input().split()) + [i + 1] for i in range(N)], key = lambda x: x[0]) sorted([list(input().split()) + [i + 1] for i in range(N)], key = lambda x: x[0]) L c = sum([x[0] == L[0][0] for x in L]) sum([x[0] == L[0][0] for x in L]) c N = int(input()) int(input()) N L = L[c:] L[c:] L M = sorted(L[0: c], key = lambda x : int(x[1]), reverse = True) sorted(L[0: c], key = lambda x : int(x[1]), reverse = True) M
N = int(input())
L = sorted([list(input().split()) + [i + 1] for i in range(N)], key = lambda x: x[0])
while len(L) > 0:
    c = sum([x[0] == L[0][0] for x in L])
    M = sorted(L[0: c], key = lambda x : int(x[1]), reverse = True)
    for x in M:
        print(x[2])
    L = L[c:]