# 32. 按身高和体重排队

32

const readline = require('readline');
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
});

let n;
let heights;
let weights;
rl.on('line', function(line) {
    if (!n) {
        n = parseInt(line);
    } else if (!heights) {
        heights = line.split(' ').map(Number);
    } else if (!weights) {
        weights = line.split(' ').map(Number);
    }
})
rl.on('close', function () {
    let ans = [];
    for(let i=1; i<=heights.length; i++) {
        ans.push(i);
    }
    ans.sort((a, b) => {
        if(heights[a-1] === heights[b-1]) {
            return weights[a-1] - weights[b-1];
        } else {
            return heights[a-1] - heights[b-1];
        }
    });
    console.log(ans.join(' '));
})

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33