N = int(input())
book = []
for i in range(N):
    city, sco = input().split()
    sco = int(sco)
    book.append({'city':city, 'score':sco, 'number':i+1})

book.sort(key = lambda x: (x['city'],-x['score']))

for j in range(N):
    print(book[j]['number']) N = int(input()) N int(input()) int input() input book = [] book [] for i in range(N):
    city, sco = input().split()
    sco = int(sco)
    book.append({'city':city, 'score':sco, 'number':i+1}) i range(N) range N city, sco = input().split() city input().split() ().split () input split sco sco = int(sco) sco int(sco) int sco book.append({'city':city, 'score':sco, 'number':i+1}) book.append book append {'city':city, 'score':sco, 'number':i+1} 'city' 'city' city 'score' 'score' sco 'number' 'number' i+1 i 1 book.sort(key = lambda x: (x['city'],-x['score'])) book.sort book sort key = lambda x: (x['city'],-x['score']) key lambda x: (x['city'],-x['score']) (x['city'],-x['score']) x['city'] x 'city' -x['score'] x['score'] x 'score' x for j in range(N):
    print(book[j]['number']) j range(N) range N print(book[j]['number']) print book[j]['number'] [j] book j 'number' sco = int(sco) int(sco) sco N = int(input()) int(input()) N sco = input().split() input().split() sco city, sco = input().split() input().split() city book = [] [] book
N = int(input())
book = []
for i in range(N):
    city, sco = input().split()
    sco = int(sco)
    book.append({'city':city, 'score':sco, 'number':i+1})

book.sort(key = lambda x: (x['city'],-x['score']))

for j in range(N):
    print(book[j]['number'])
