N=int(input())
d=[input().split() for i in range(N)]
name=[]
for i in range(N):
    d[i].append(i+1)
    d[i][1]=int(d[i][1])
    name.append(d[i][0])
Name=list(set(name))
Name.sort()
d.sort()
for i in range(len(Name)):
    li=[]
    for j in range(N):
        if Name[i]==d[j][0]:
            li.append([d[j][1],d[j][2]])
        else:
            continue
    li.sort()
    Li=li[::-1]
    for k in range(len(li)):
        print(Li[k][1]) N=int(input()) N int(input()) int input() input input().split() for i in range(N) for i in range(N) i range(N) range N for i in range(N) input().split() ().split () input split d=[input().split() for i in range(N)] d [input().split() for i in range(N)] name=[] name [] for i in range(N):
    d[i].append(i+1)
    d[i][1]=int(d[i][1])
    name.append(d[i][0]) i range(N) range N d[i].append(i+1) [i].append [i] d i append i+1 i 1 d[i][1]=int(d[i][1]) d[i][1] [i] d i 1 int(d[i][1]) int d[i][1] [i] d i 1 name.append(d[i][0]) name.append name append d[i][0] [i] d i 0 Name=list(set(name)) Name list(set(name)) list set(name) set name Name.sort() Name.sort Name sort d.sort() d.sort d sort for i in range(len(Name)):
    li=[]
    for j in range(N):
        if Name[i]==d[j][0]:
            li.append([d[j][1],d[j][2]])
        else:
            continue
    li.sort()
    Li=li[::-1]
    for k in range(len(li)):
        print(Li[k][1]) i range(len(Name)) range len(Name) len Name li=[] li [] for j in range(N):
        if Name[i]==d[j][0]:
            li.append([d[j][1],d[j][2]])
        else:
            continue
     j range(N) range N if Name[i]==d[j][0]:
            li.append([d[j][1],d[j][2]])
        else:
            continue
     Name[i]==d[j][0] Name[i] Name i d[j][0] [j] d j 0 li.append([d[j][1],d[j][2]]) li.append li append [d[j][1],d[j][2]] d[j][1] [j] d j 1 d[j][2] [j] d j 2 continue li.sort() li.sort li sort Li=li[::-1] Li li[::-1] li ::-1 -1 for k in range(len(li)):
        print(Li[k][1]) k range(len(li)) range len(li) len li print(Li[k][1]) print Li[k][1] [k] Li k 1 name=[] [] name Name=list(set(name)) list(set(name)) Name N=int(input()) int(input()) N d=[input().split() for i in range(N)] [input().split() for i in range(N)] d li=[] [] li Li=li[::-1] li[::-1] Li
N=int(input())
d=[input().split() for i in range(N)]
name=[]
for i in range(N):
    d[i].append(i+1)
    d[i][1]=int(d[i][1])
    name.append(d[i][0])
Name=list(set(name))
Name.sort()
d.sort()
for i in range(len(Name)):
    li=[]
    for j in range(N):
        if Name[i]==d[j][0]:
            li.append([d[j][1],d[j][2]])
        else:
            continue
    li.sort()
    Li=li[::-1]
    for k in range(len(li)):
        print(Li[k][1])