n = int(input())
d = {}
for i in range(n):
    s ,p = input().split()
    p = int(p)
    if not(s in d):
        d[s] = {}
    d[s][p*-1] = i+1
for i in sorted(d.keys()):
    for j in sorted(d[i].keys()):
        print(d[i][j]) n = int(input()) n int(input()) int input() input d = {} d {} for i in range(n):
    s ,p = input().split()
    p = int(p)
    if not(s in d):
        d[s] = {}
    d[s][p*-1] = i+1 i range(n) range n s ,p = input().split() s input().split() ().split () input split p p = int(p) p int(p) int p if not(s in d):
        d[s] = {}
     not(s in d) s in d s d d[s] = {} d[s] d s {} d[s][p*-1] = i+1 d[s][p*-1] [s] d s p*-1 p -1 i+1 i 1 for i in sorted(d.keys()):
    for j in sorted(d[i].keys()):
        print(d[i][j]) i sorted(d.keys()) sorted d.keys() d.keys d keys for j in sorted(d[i].keys()):
        print(d[i][j]) j sorted(d[i].keys()) sorted d[i].keys() [i].keys [i] d i keys print(d[i][j]) print d[i][j] [i] d i j n = int(input()) int(input()) n p = input().split() input().split() p d = {} {} d s ,p = input().split() input().split() s p = int(p) int(p) p
n = int(input())
d = {}
for i in range(n):
    s ,p = input().split()
    p = int(p)
    if not(s in d):
        d[s] = {}
    d[s][p*-1] = i+1
for i in sorted(d.keys()):
    for j in sorted(d[i].keys()):
        print(d[i][j])
