public static void main(String[] args) throws IOException {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = new StringTokenizer("");
        PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(out)));

        int N = nextInt();
        array = new int[N];
        List<ArrayNumber> list = new ArrayList<>();
        for (int i = 0; i < N; i++) {
            list.add(new ArrayNumber(i, nextInt()));
        }

        Collections.sort(list, new Comparator<ArrayNumber>() {
            @Override
            public int compare(ArrayNumber o1, ArrayNumber o2) {
                if (o1.value > o2.value) {
                    return 1;
                } else if (o1.value == o2.value) {
                    return 0;
                } else {
                    return -1;
                }
            }
        });

        int i = 0;
        for (ArrayNumber _array : list) {
            array[i++] = _array.value;
        }

        int log = (int) Math.ceil(Math.log(array.length) / Math.log(2));
        int size = 2 * (int) Math.pow(2, log) - 1;

        tree = new int[size];
        lazy = new int[size];

        buildTree(0, 0, N - 1);

        int M = nextInt();
        for (int m = 0; m < M; m++) {
            int x = nextInt();
            updateTree(0, 0, N - 1, 0, N - 1, x, -1);
        }

        for (i = 0; i < N; i++) {
            list.get(i).value = queryTree(0, 0, N - 1, i, i);
        }

        Collections.sort(list, new Comparator<ArrayNumber>() {
            @Override
            public int compare(ArrayNumber o1, ArrayNumber o2) {
                if (o1.index > o2.index) {
                    return 1;
                } else if (o1.index == o2.index) {
                    return 0;
                } else {
                    return -1;
                }
            }
        });

        for (int j = 0; j < N; j++) {
            pw.print(list.get(j).value + " ");
        }
        pw.println();

        reader.close();
        pw.close();
    }