n = int(input())
l = []
for i in range(n):
    s,p = map(str,input().split())
    l.append([s,int(p),i+1])
l.sort(key = lambda x: (x[0], -x[1]))
for i in range(n):
    print(l[i][2]) n = int(input()) n int(input()) int input() input l = [] l [] for i in range(n):
    s,p = map(str,input().split())
    l.append([s,int(p),i+1]) i range(n) range n s,p = map(str,input().split()) s map(str,input().split()) map str input().split() ().split () input split p l.append([s,int(p),i+1]) l.append l append [s,int(p),i+1] s int(p) int p i+1 i 1 l.sort(key = lambda x: (x[0], -x[1])) l.sort l sort key = lambda x: (x[0], -x[1]) key lambda x: (x[0], -x[1]) (x[0], -x[1]) x[0] x 0 -x[1] x[1] x 1 x for i in range(n):
    print(l[i][2]) i range(n) range n print(l[i][2]) print l[i][2] [i] l i 2 p = map(str,input().split()) map(str,input().split()) p s,p = map(str,input().split()) map(str,input().split()) s n = int(input()) int(input()) n l = [] [] l
n = int(input())
l = []
for i in range(n):
    s,p = map(str,input().split())
    l.append([s,int(p),i+1])
l.sort(key = lambda x: (x[0], -x[1]))
for i in range(n):
    print(l[i][2])