#include using namespace std; using ll = long long; int main(){ ios::sync_with_stdio(false); cin.tie(0); int N; cin >> N; vector> a(N); for(int i = 0; i < N; i++) { cin >> get<0>(a[i]); get<0>(a[i]) *= 2; } for(int i = 0; i < N; i++){ cin >> get<1>(a[i]); get<2>(a[i]) = i + 1; } sort(a.begin(), a.end(), [&](tuple lhs, tuple rhs){ return get<0>(lhs) / 2 * get<1>(lhs) + (get<0>(lhs) + get<0>(rhs) / 2) * get<1>(rhs) > get<0>(rhs) / 2 * get<1>(rhs) + (get<0>(rhs) + get<0>(lhs) / 2) * get<1>(lhs); }); for(int i = 0; i < N; i++){ cout << get<2>(a[i]) << (i + 1 == N ? '\n' : ' '); } }