#include <iostream>
using namespace std;

const int MAX_SIZE = 500000;

int main() {
    int n, arr[MAX_SIZE + 1];
    cin >> n;
    for (int i = 1; i <= n; ++i) {
        cin >> arr[i];
    }
    int m;
    cin >> m;
    int x; 
    for (int j = 1; j <= m; ++j) {
        cin >> x;
        int position = -1;
        for (int k = 1; k <= n; ++k) {
            if (arr[k] == x && position == -1) {
                position = k ;
            }
        }
        cout << position << " "; 
    }
    
    return 0;
}