
function Main(input) {
    var N = parseInt(input[0], 10);
    var SP = input.slice(1);

    var S = [];
    var P = [];

    SP.forEach((value, index) => {
        if (index % 2 === 0) {
            S.push(value);
        } else {
            P.push(parseInt(value, 10));
        }
    });

    var objectList = [];

    for (var i = 0; i < N; i++) {
        objectList.push({
            name: S[i],
            value: P[i],
            index: i + 1
        });
    }

    objectList = objectList.sort((a, b) => {
        if (a.name !== b.name) {
            return a.name > b.name ? 1 : -1;
        } else {
            return b.value - a.value;
        }
    });

    for (v of objectList) {
        console.log(v.index);
    }
}

Main(require("fs").readFileSync("/dev/stdin", "utf8").trim().split(/\n|\s/));