#import operator
n = int(input())
l = set()
cnt = 1
d = {}
o = {}
for i in range(n):
    s,p = input().split()
    p = int(p)
    d[(s, p)] = cnt
    if s in o:
        x = o[s]
        x.append(p)
        o[s] = x

    else:
        o[s] = [p]

    l.add(s)
    cnt = cnt+1

w = list(l)
w.sort()
k = []
#print("  ")
for i in w:
    m = o[i]
    m.sort(reverse = True)
    for j in m:
        #print(i,j,d[(i,j)])
        k.append(d[(i,j)])

for h in k:
    print(h) n = int(input()) n int(input()) int input() input l = set() l set() set cnt = 1 cnt 1 d = {} d {} o = {} o {} for i in range(n):
    s,p = input().split()
    p = int(p)
    d[(s, p)] = cnt
    if s in o:
        x = o[s]
        x.append(p)
        o[s] = x

    else:
        o[s] = [p]

    l.add(s)
    cnt = cnt+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 d[(s, p)] = cnt d[(s, p)] d (s, p) s p cnt if s in o:
        x = o[s]
        x.append(p)
        o[s] = x

    else:
        o[s] = [p]

     s in o s o x = o[s] x o[s] o s x.append(p) x.append x append p o[s] = x o[s] o s x o[s] = [p] o[s] o s [p] p l.add(s) l.add l add s cnt = cnt+1 cnt cnt+1 cnt 1 w = list(l) w list(l) list l w.sort() w.sort w sort k = [] k [] for i in w:
    m = o[i]
    m.sort(reverse = True)
    for j in m:
        #print(i,j,d[(i,j)])
        k.append(d[(i,j)]) i w m = o[i] m o[i] o i m.sort(reverse = True) m.sort m sort reverse = True reverse True for j in m:
        #print(i,j,d[(i,j)])
        k.append(d[(i,j)]) j m k.append(d[(i,j)]) k.append k append d[(i,j)] d (i,j) i j for h in k:
    print(h) h k print(h) print h m = o[i] o[i] m x = o[s] o[s] x d = {} {} d cnt = 1 1 cnt n = int(input()) int(input()) n o = {} {} o p = input().split() input().split() p l = set() set() l w = list(l) list(l) w s,p = input().split() input().split() s k = [] [] k cnt = cnt+1 cnt+1 cnt p = int(p) int(p) p
#import operator
n = int(input())
l = set()
cnt = 1
d = {}
o = {}
for i in range(n):
    s,p = input().split()
    p = int(p)
    d[(s, p)] = cnt
    if s in o:
        x = o[s]
        x.append(p)
        o[s] = x

    else:
        o[s] = [p]

    l.add(s)
    cnt = cnt+1

w = list(l)
w.sort()
k = []
#print("  ")
for i in w:
    m = o[i]
    m.sort(reverse = True)
    for j in m:
        #print(i,j,d[(i,j)])
        k.append(d[(i,j)])

for h in k:
    print(h)