#include "bits/stdc++.h"

using namespace std;
typedef long long ll;
int main() {
    ll t;
    cin >> t;
    while(t--) {
        ll n, m;
        cin >> n >> m;
        ll a[n + 2];
        ll b[n + 2];
        for(ll i = 0; i < n; i++) cin >> a[i];
        for(ll i = 0; i < n; i++) cin >> b[i];

        vector<ll>lagbe(n + 2, 0), ase(n + 3, 0);
        vector <ll> v[n + 2];
        ll c[m + 2];
        for(ll i = 0; i < m; i++) {
            cin >> c[i];
            ase[c[i]]++;
        }

        ll d = 0;
        set<ll>bb;
        vector<ll>gg(n + 2, 0);
        for(ll i = 0; i < n; i++) {
            if(a[i] != b[i]) {
                lagbe[b[i]]++;
                v[b[i]].push_back(i + 1);
            }

            bb.insert(b[i]);
            gg[b[i]] = i + 1;
        }

        if(bb.count(c[m - 1]) == 0) {
            cout  << "NO" << endl;
            continue;
        }

        ll gi = 0;
        for(ll i = 0; i <= n; i++) {
            if(lagbe[i] > ase[i]) {
                gi = 1;
                break;
            }
        }

        if(gi == 1) {
            cout << "NO" << endl;
            continue;
        }

        cout << "YES" << endl;

        ll last = gg[c[m - 1]];
        if (!v[c[m - 1]].empty()) {
            last = v[c[m - 1]].back();
            v[c[m - 1]].pop_back();
        }

        for(ll i = 0; i < m - 1; i++) {
            if(!v[c[i]].empty()) {
                cout << v[c[i]].back() << " ";
                v[c[i]].pop_back();
            } else {
                cout << last << " ";
            }
        }

        cout << last;

        cout << endl;
    }
}
