#include <iostream>
using namespace std;

int main() {
    ios::sync_with_stdio(false);
	cin.tie(0);
    int n;
    cin >> n;
    int arr[n];
    for (int i = 0;i < n;i++) {
        cin >> arr[i];
    }
    int m;
    cin >> m;
    int arr2[m];
    for (int i = 0;i < m;i++) {
        cin >> arr2[i];
    }
    for (int i = 0;i < m;i++) {
        int c = 0;
        for (int j = 0;j < n;j++) {
            if (arr2[i] == arr[j]) {
                cout << j+1 << " ";
                c = 1;
            }
        }
        if (c == 0) {
            cout << -1 << " ";
        }
    }
    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: