# -*- coding: utf-8 -*- import sys,copy,math,heapq,itertools as it,fractions,re,bisect,collections as coll N = int(raw_input()) T = map(int, raw_input().split()) D = map(int, raw_input().split()) s = sum(T) TD = zip(T, D, range(N)) TD = sorted(sorted(TD, key = lambda x:x[1]), key = lambda x:(s - x[0])* (x[1] + 1)) print " ".join(map(str, [TD[i][2] + 1 for i in xrange(N)]))