function Main(input) {
	const data = input.split("\n");
  	const n = Number(data[0]);
  	const sps = data.slice(1).map(d => d.split(" "));
  	const sortedSps = sps.slice();
  	sortedSps.sort((a, b) => {
    	if (a[0] < b[0]) {
          return -1;
        } else if (b[0] < a[0]) {
          return 1;
        } else {
          if (Number(a[1]) < Number(b[1])) {
            return 1;
          } else {
            return -1;
          }
        }
    });
  	const result = [];
  	for (let i = 0; i < sps.length; i++) {
      const index = sps.findIndex(sp => sp[0] === sortedSps[i][0] && sp[1] === sortedSps[i][1]);
      result.push(index + 1);
    }
    console.log(result.join("\n"));
  	
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
