n = int(input())
s = []
p = [0] * 101
d = {}
for i in range(n):
    a,b = input().split()
    b = int(b)
    s.append(a)
    p[b] = i+1
    if a in list(d.keys()):
        d[a].append(b)
        continue
    d[a] = [b]
s = sorted(set(s))
for i in s:
    c = sorted(d[i],reverse=True)
    for j in c:
        print(p[j]) n = int(input()) n int(input()) int input() input s = [] s [] p = [0] * 101 p [0] * 101 [0] 0 101 d = {} d {} for i in range(n):
    a,b = input().split()
    b = int(b)
    s.append(a)
    p[b] = i+1
    if a in list(d.keys()):
        d[a].append(b)
        continue
    d[a] = [b] i range(n) range n a,b = input().split() a input().split() ().split () input split b b = int(b) b int(b) int b s.append(a) s.append s append a p[b] = i+1 p[b] p b i+1 i 1 if a in list(d.keys()):
        d[a].append(b)
        continue
     a in list(d.keys()) a list(d.keys()) list d.keys() d.keys d keys d[a].append(b) [a].append [a] d a append b continue d[a] = [b] d[a] d a [b] b s = sorted(set(s)) s sorted(set(s)) sorted set(s) set s for i in s:
    c = sorted(d[i],reverse=True)
    for j in c:
        print(p[j]) i s c = sorted(d[i],reverse=True) c sorted(d[i],reverse=True) sorted d[i] d i reverse=True reverse True for j in c:
        print(p[j]) j c print(p[j]) print p[j] p j b = int(b) int(b) b d = {} {} d p = [0] * 101 [0] * 101 p s = sorted(set(s)) sorted(set(s)) s s = [] [] s n = int(input()) int(input()) n c = sorted(d[i],reverse=True) sorted(d[i],reverse=True) c a,b = input().split() input().split() a b = input().split() input().split() b
n = int(input())
s = []
p = [0] * 101
d = {}
for i in range(n):
    a,b = input().split()
    b = int(b)
    s.append(a)
    p[b] = i+1
    if a in list(d.keys()):
        d[a].append(b)
        continue
    d[a] = [b]
s = sorted(set(s))
for i in s:
    c = sorted(d[i],reverse=True)
    for j in c:
        print(p[j])
