N = int(input())
S = []
for i in range(N):
    s,p = input().split()
    S.append([s,int(p),i+1])
S.sort( key = lambda S: (S[0],-S[1]))
for i in range(N):
    print(S[i][2]) N = int(input()) N int(input()) int input() input S = [] S [] for i in range(N):
    s,p = input().split()
    S.append([s,int(p),i+1]) i range(N) range N s,p = input().split() s input().split() ().split () input split p S.append([s,int(p),i+1]) S.append S append [s,int(p),i+1] s int(p) int p i+1 i 1 S.sort( key = lambda S: (S[0],-S[1])) S.sort S sort key = lambda S: (S[0],-S[1]) key lambda S: (S[0],-S[1]) (S[0],-S[1]) S[0] S 0 -S[1] S[1] S 1 S for i in range(N):
    print(S[i][2]) i range(N) range N print(S[i][2]) print S[i][2] [i] S i 2 S = [] [] S p = input().split() input().split() p N = int(input()) int(input()) N s,p = input().split() input().split() s
N = int(input())
S = []
for i in range(N):
    s,p = input().split()
    S.append([s,int(p),i+1])
S.sort( key = lambda S: (S[0],-S[1]))
for i in range(N):
    print(S[i][2])
