(function() {
function Main(input) {
  lines = input.split("\n")
  lines = lines.splice(1)
  lines = lines.map(function(l, idx) { l = l.split(' '); l[2] = idx + 1; return l }) 
  lines = lines.sort(function(a, b) {
    if (a[0] == b[0]) {
      return b[1] - a[1]
    } else if (a[0] > b[0]) {
      return 1
    } else if (a[0] < b[0]) {
      return -1
    }
  
  } )
  lines.forEach(function(l) { console.log(l[2]) })
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
}())
