#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;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKY29uc3QgaW50IE1BWF9TSVpFID0gNTAwMDAwOwoKaW50IG1haW4oKSB7CiAgICBpbnQgbiwgYXJyW01BWF9TSVpFICsgMV07CiAgICBjaW4gPj4gbjsKICAgIGZvciAoaW50IGkgPSAxOyBpIDw9IG47ICsraSkgewogICAgICAgIGNpbiA+PiBhcnJbaV07CiAgICB9CiAgICBpbnQgbTsKICAgIGNpbiA+PiBtOwogICAgaW50IHg7IAogICAgZm9yIChpbnQgaiA9IDE7IGogPD0gbTsgKytqKSB7CiAgICAgICAgY2luID4+IHg7CiAgICAgICAgaW50IHBvc2l0aW9uID0gLTE7CiAgICAgICAgZm9yIChpbnQgayA9IDE7IGsgPD0gbjsgKytrKSB7CiAgICAgICAgICAgIGlmIChhcnJba10gPT0geCAmJiBwb3NpdGlvbiA9PSAtMSkgewogICAgICAgICAgICAgICAgcG9zaXRpb24gPSBrIDsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBjb3V0IDw8IHBvc2l0aW9uIDw8ICIgIjsgCiAgICB9CiAgICAKICAgIHJldHVybiAwOwp9