#B - Guidebook AC(ヒント)
N = int(input())
S = []
P = []
for _ in range(N):
    s,p = input().split()
    S.append(s)
    P.append(int(p)*(-1))#負の値にして降順にソートできるようにする

book = list(zip(S,P))
book_sort = sorted(book)
ans = [book.index(i)+1 for i in book_sort]
for j in ans:
    print(j) N = int(input()) N int(input()) int input() input S = [] S [] P = [] P [] for _ in range(N):
    s,p = input().split()
    S.append(s)
    P.append(int(p)*(-1))#負の値にして降順にソートできるようにする _ range(N) range N s,p = input().split() s input().split() ().split () input split p S.append(s) S.append S append s P.append(int(p)*(-1)) P.append P append int(p)*(-1) int(p) int p -1 book = list(zip(S,P)) book list(zip(S,P)) list zip(S,P) zip S P book_sort = sorted(book) book_sort sorted(book) sorted book book.index(i)+1 for i in book_sort for i in book_sort i book_sort for i in book_sort book.index(i)+1 book.index(i) book.index book index i 1 ans = [book.index(i)+1 for i in book_sort] ans [book.index(i)+1 for i in book_sort] for j in ans:
    print(j) j ans print(j) print j S = [] [] S book_sort = sorted(book) sorted(book) book_sort N = int(input()) int(input()) N s,p = input().split() input().split() s ans = [book.index(i)+1 for i in book_sort] [book.index(i)+1 for i in book_sort] ans book = list(zip(S,P)) list(zip(S,P)) book P = [] [] P p = input().split() input().split() p
#B - Guidebook AC(ヒント)
N = int(input())
S = []
P = []
for _ in range(N):
    s,p = input().split()
    S.append(s)
    P.append(int(p)*(-1))#負の値にして降順にソートできるようにする

book = list(zip(S,P))
book_sort = sorted(book)
ans = [book.index(i)+1 for i in book_sort]
for j in ans:
    print(j)