import java.io.*;
import java.util.*;

public class shelter_md implements Runnable {
	class Point implements Comparable<Point> {
		int id, x;
		
		public Point(int id, int x) {
			this.id = id;
			this.x = x;
		}

		public int compareTo(Point o) {
			return x - o.x;
		}
	}
	
	private BufferedReader in;
	private PrintWriter out;

	public void run() {
		try {
			solve();
		} catch (IOException e) {
			e.printStackTrace();
			System.exit(1);
		}
	}
	
	public Point[] readPoints(BufferedReader in) throws IOException {
		int n = Integer.parseInt(in.readLine());
		Point[] a = new Point[n];
		StringTokenizer st = new StringTokenizer(in.readLine());
		for (int i = 0; i < n; i++) {
			int x = Integer.parseInt(st.nextToken());
			a[i] = new Point(i, x);
		}
		Arrays.sort(a);
		return a;
	}

	private void solve() throws IOException {
		Locale.setDefault(Locale.US);
		in = new BufferedReader(new FileReader("shelter.in"));
		out = new PrintWriter("shelter.out");
		Point[] towns = readPoints(in);
		Point[] shelters = readPoints(in);
		int[] ans = new int[towns.length];
		int i = 0;
		for (Point p : towns) {
			while (i < shelters.length && shelters[i].x < p.x)
				i++;
			int dist = Integer.MAX_VALUE;
			int shel = -1;
			if (i < shelters.length) {
				dist = shelters[i].x - p.x;
				shel = i;
			}
			if (i >= 1) {
				int cur = p.x - shelters[i - 1].x;
				if (cur < dist) {
					dist = cur;
					shel = i - 1;
				}
			}
			ans[p.id] = shelters[shel].id;
		}
		for (int x : ans)
			out.print((x + 1) + " ");
		out.println();
		in.close();
		out.close();
	}

	public static void main(String[] args) {
		new Thread(new shelter_md()).start();
	}
}
