import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

N = int(input())
 
SP = []
for i in range(N):
  s,p = input().split()
  SP.append((s,-int(p),i+1))
  
SP.sort()
 
for s,p,i in SP:
  print(i) import sys sys readline = sys.stdin.buffer.readline readline sys.stdin.buffer.readline sys.stdin.buffer sys.stdin sys stdin buffer readline readlines = sys.stdin.buffer.readlines readlines sys.stdin.buffer.readlines sys.stdin.buffer sys.stdin sys stdin buffer readlines read = sys.stdin.buffer.read read sys.stdin.buffer.read sys.stdin.buffer sys.stdin sys stdin buffer read sys.setrecursionlimit(10 ** 7) sys.setrecursionlimit sys setrecursionlimit 10 ** 7 10 7 INF = float('inf') INF float('inf') float 'inf' N = int(input()) N int(input()) int input() input SP = [] SP [] for i in range(N):
  s,p = input().split()
  SP.append((s,-int(p),i+1))
   i range(N) range N s,p = input().split() s input().split() ().split () input split p SP.append((s,-int(p),i+1)) SP.append SP append (s,-int(p),i+1) s -int(p) int(p) int p i+1 i 1 SP.sort() SP.sort SP sort for s,p,i in SP:
  print(i) s p i SP print(i) print i SP = [] [] SP s,p = input().split() input().split() s read = sys.stdin.buffer.read sys.stdin.buffer.read read readlines = sys.stdin.buffer.readlines sys.stdin.buffer.readlines readlines INF = float('inf') float('inf') INF N = int(input()) int(input()) N p = input().split() input().split() p readline = sys.stdin.buffer.readline sys.stdin.buffer.readline readline
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

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