#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main(){

	ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int t ;
    cin >> t;
    while(t--) {
        int n, m, no = -1;
        cin >> n >> m;
        vector <int> a(n + 1), b(n + 1);
        vector <int> c(m + 1), res(m + 1);
        for(int i = 1; i <= n; i++)
            cin >> a[i];
        for(int i = 1; i <= n; i++)
            cin >> b[i];
        for(int i = 1; i <= m; i++)
            cin >> c[i];
        vector <int> pos[n + 1];
        vector <int> cnt(n + 1);
        for(int i = 1; i <= n; i++) {
            if(a[i] != b[i])
                pos[b[i]].push_back(i);
            cnt[b[i]] = i;
        }
        bool ok = true;
        for(int i = m; i >= 1; i--) {
            if(pos[c[i]].size()) {
                res[i] = pos[c[i]].back();
                no = pos[c[i]].back();
                pos[c[i]].pop_back();
            }
            else if(no != -1) {
                res[i] = no;
            }
            else if(cnt[c[i]] != 0) {
                res[i] = cnt[c[i]];
                no = cnt[c[i]];
            }
            else
                ok = false;
        }
        for(int i = 1; i <= n; i++) {
            if(pos[i].size())
                ok = false;
        }
        if(ok) {
            cout << "YES\n";
            for(int i = 1; i <= m; i++)
                cout << res[i] << " ";
            cout << "\n";
        }
        else
            cout << "NO\n";
    }

	return 0;
}