#include <iostream>
#include <unordered_map>
using namespace std;
int main() {
int n, v[500000];
cin >> n;
// Creăm un map pentru a stoca pozițiile elementelor din v
unordered_map<int, int> pozitie;
for (int i = 1; i <= n; ++i) {
cin >> v[i];
pozitie[v[i]] = i; // Cheia este valoarea din v[i], iar valoarea este poziția i
}
int m, x[100000];
cin >> m;
for (int i = 1; i <= m; ++i) {
cin >> x[i];
}
// Căutăm fiecare element din x în map-ul de poziții
for (int i = 1; i <= m; ++i) {
if (pozitie.find(x[i]) != pozitie.end()) {
cout << pozitie[x[i]] << " ";
} else {
cout << "-1 "; // Opțional, dacă vrei să afișezi ceva când elementul nu este găsit
}
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dW5vcmRlcmVkX21hcD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmludCBtYWluKCkgewogICAgaW50IG4sIHZbNTAwMDAwXTsKICAgIGNpbiA+PiBuOwoKICAgIC8vIENyZcSDbSB1biBtYXAgcGVudHJ1IGEgc3RvY2EgcG96acibaWlsZSBlbGVtZW50ZWxvciBkaW4gdgogICAgdW5vcmRlcmVkX21hcDxpbnQsIGludD4gcG96aXRpZTsKICAgIGZvciAoaW50IGkgPSAxOyBpIDw9IG47ICsraSkgewogICAgICAgIGNpbiA+PiB2W2ldOwogICAgICAgIHBveml0aWVbdltpXV0gPSBpOyAvLyBDaGVpYSBlc3RlIHZhbG9hcmVhIGRpbiB2W2ldLCBpYXIgdmFsb2FyZWEgZXN0ZSBwb3ppyJtpYSBpCiAgICB9CgogICAgaW50IG0sIHhbMTAwMDAwXTsKICAgIGNpbiA+PiBtOwogICAgZm9yIChpbnQgaSA9IDE7IGkgPD0gbTsgKytpKSB7CiAgICAgICAgY2luID4+IHhbaV07CiAgICB9CgogICAgLy8gQ8SDdXTEg20gZmllY2FyZSBlbGVtZW50IGRpbiB4IMOubiBtYXAtdWwgZGUgcG96acibaWkKICAgIGZvciAoaW50IGkgPSAxOyBpIDw9IG07ICsraSkgewogICAgICAgIGlmIChwb3ppdGllLmZpbmQoeFtpXSkgIT0gcG96aXRpZS5lbmQoKSkgewogICAgICAgICAgICBjb3V0IDw8IHBveml0aWVbeFtpXV0gPDwgIiAiOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIGNvdXQgPDwgIi0xICI7IC8vIE9wyJtpb25hbCwgZGFjxIMgdnJlaSBzxIMgYWZpyJllemkgY2V2YSBjw6JuZCBlbGVtZW50dWwgbnUgZXN0ZSBnxINzaXQKICAgICAgICB9CiAgICB9CgogICAgcmV0dXJuIDA7Cn0=