n = int(input())

S=[]
for i in range(n):
    c,p = map(str,input().split())
    S.append( [c,int(p)] )

C=[0]*n
for i in range(n):
    for j in range(n):
        if S[i][0]>S[j][0]:
            C[i]+=1
        elif S[i][0]==S[j][0]:
            if S[i][1]<S[j][1]:
                C[i]+=1

A=[0]*n
for i in range(n):
    print( C.index(i)+1 )
 n = int(input()) n int(input()) int input() input S=[] S [] for i in range(n):
    c,p = map(str,input().split())
    S.append( [c,int(p)] ) i range(n) range n c,p = map(str,input().split()) c map(str,input().split()) map str input().split() ().split () input split p S.append( [c,int(p)] ) S.append S append [c,int(p)] c int(p) int p C=[0]*n C [0]*n [0] 0 n for i in range(n):
    for j in range(n):
        if S[i][0]>S[j][0]:
            C[i]+=1
        elif S[i][0]==S[j][0]:
            if S[i][1]<S[j][1]:
                C[i]+=1 i range(n) range n for j in range(n):
        if S[i][0]>S[j][0]:
            C[i]+=1
        elif S[i][0]==S[j][0]:
            if S[i][1]<S[j][1]:
                C[i]+=1 j range(n) range n if S[i][0]>S[j][0]:
            C[i]+=1
        elif S[i][0]==S[j][0]:
            if S[i][1]<S[j][1]:
                C[i]+=1 S[i][0]>S[j][0] S[i][0] [i] S i 0 S[j][0] [j] S j 0 C[i]+=1 C[i] C i 1 elif S[i][0]==S[j][0]:
            if S[i][1]<S[j][1]:
                C[i]+=1 S[i][0]==S[j][0] S[i][0] [i] S i 0 S[j][0] [j] S j 0 if S[i][1]<S[j][1]:
                C[i]+=1 S[i][1]<S[j][1] S[i][1] [i] S i 1 S[j][1] [j] S j 1 C[i]+=1 C[i] C i 1 A=[0]*n A [0]*n [0] 0 n for i in range(n):
    print( C.index(i)+1 ) i range(n) range n print( C.index(i)+1 ) print C.index(i)+1 C.index(i) C.index C index i 1 c,p = map(str,input().split()) map(str,input().split()) c A=[0]*n [0]*n A S=[] [] S C=[0]*n [0]*n C n = int(input()) int(input()) n p = map(str,input().split()) map(str,input().split()) p
n = int(input())

S=[]
for i in range(n):
    c,p = map(str,input().split())
    S.append( [c,int(p)] )

C=[0]*n
for i in range(n):
    for j in range(n):
        if S[i][0]>S[j][0]:
            C[i]+=1
        elif S[i][0]==S[j][0]:
            if S[i][1]<S[j][1]:
                C[i]+=1

A=[0]*n
for i in range(n):
    print( C.index(i)+1 )

