// Arup Guha
// 3/11/2026
// Solution to COP 3330 Program 6: Ducksort

import java.util.*;

public class Ducksort {

	public static void main(String[] args) {
	
		// Read in all the data first.
		Scanner stdin = new Scanner(System.in);
		int n = stdin.nextInt();
		int[] food = new int[n];
		for (int i=0; i<n; i++)
			food[i] = stdin.nextInt();
		int[] ducks = new int[n];
		for (int i=0; i<n; i++)
			ducks[i] = stdin.nextInt();
			
		// Create and store our objects in an array.
		Bench[] benches = new Bench[n];
		for (int i=0; i<n; i++)
			benches[i] = new Bench(food[i], ducks[i], i+1);
			
		// Sort it!
		Arrays.sort(benches);
		
		// Ta da!
		for (int i=0; i<n-1; i++)
			System.out.print(benches[i]+" ");
		System.out.println(benches[n-1]);
	}
}

class Bench implements Comparable<Bench> {

	private int food;
	private int numDucks;
	private int idx;
	
	// Basic constructor.
	public Bench(int myFood, int myDucks, int i) {
		food = myFood;
		numDucks = myDucks;
		idx = i;
	}
	
	public int compareTo(Bench other) {
	
		// Food is different; prioritize more food.
		if (food != other.food)
			return other.food - food;
			
		// We want fewer ducks to break ties.
		if (numDucks != other.numDucks)
			return numDucks - other.numDucks;
			
		// This will break all remaining ties.
		return idx - other.idx;
	}
	
	// This is what we want for the problem.
	public String toString() {
		return ""+idx;
	}
}