
q = int(input())

r = set([])

g = {}

n = {}

for i in range(q):
    s,p = input().split()
    if s not in r:
        r.add(s)
        g[s] = [int(p)]
        n[int(p)] = i+1
    else:
        g[s].append(int(p))
        n[int(p)] = i+1
        
r = list(r)

r.sort()

for i in r:
    x = g[i]
    x.sort(reverse = True)
    for t in x:
        print(n[t]) q = int(input()) q int(input()) int input() input r = set([]) r set([]) set [] g = {} g {} n = {} n {} for i in range(q):
    s,p = input().split()
    if s not in r:
        r.add(s)
        g[s] = [int(p)]
        n[int(p)] = i+1
    else:
        g[s].append(int(p))
        n[int(p)] = i+1
         i range(q) range q s,p = input().split() s input().split() ().split () input split p if s not in r:
        r.add(s)
        g[s] = [int(p)]
        n[int(p)] = i+1
    else:
        g[s].append(int(p))
        n[int(p)] = i+1
         s not in r s r r.add(s) r.add r add s g[s] = [int(p)] g[s] g s [int(p)] int(p) int p n[int(p)] = i+1 n[int(p)] n int(p) int p i+1 i 1 g[s].append(int(p)) [s].append [s] g s append int(p) int p n[int(p)] = i+1 n[int(p)] n int(p) int p i+1 i 1 r = list(r) r list(r) list r r.sort() r.sort r sort for i in r:
    x = g[i]
    x.sort(reverse = True)
    for t in x:
        print(n[t]) i r x = g[i] x g[i] g i x.sort(reverse = True) x.sort x sort reverse = True reverse True for t in x:
        print(n[t]) t x print(n[t]) print n[t] n t q = int(input()) int(input()) q x = g[i] g[i] x s,p = input().split() input().split() s p = input().split() input().split() p r = list(r) list(r) r r = set([]) set([]) r n = {} {} n g = {} {} g

q = int(input())

r = set([])

g = {}

n = {}

for i in range(q):
    s,p = input().split()
    if s not in r:
        r.add(s)
        g[s] = [int(p)]
        n[int(p)] = i+1
    else:
        g[s].append(int(p))
        n[int(p)] = i+1
        
r = list(r)

r.sort()

for i in r:
    x = g[i]
    x.sort(reverse = True)
    for t in x:
        print(n[t])