N = gets.to_i
R = Array.new(N).map{Array.new(2)}
for i in 0..N-1
 R[i][0],R[i][1] = gets.chomp.split(" ");
end
_sort = R.sort {|a, b| (a[0] <=> b[0]).nonzero? || (b[1] <=> a[1])}
for i in 0..N-1
 m = R.index(_sort[i])
  puts m+1
end