#!/usr/bin/env python3 import collections import functools Spot = collections.namedtuple("Spot", "i t d") def spot_cmp(spot1, spot2): return spot2.t * spot1.d - spot1.t * spot2.d def main(): n = int(input()) ts = map(int, input().split()) ds = map(int, input().split()) spots = [Spot(*args) for args in zip(range(1, n + 1), ts, ds)] spots.sort(key=functools.cmp_to_key(spot_cmp)) print(*(spot.i for spot in spots)) if __name__ == '__main__': main()