#include "bits/stdc++.h"

using namespace std;
using ll = long long;
const int MAX_N = 1e5 + 9;
int a[MAX_N],b[MAX_N],ans[MAX_N]; vector<int>p[MAX_N];
void clr(int n){
    for(int i = 1 ; i <= n ; i++)
        p[i].clear();
}
int32_t main() {
    ios_base::sync_with_stdio(0), cin.tie(0);
    int t,n,m; cin >> t;
    while(t--){
        cin >> n >> m; bool can = 1; int lst= -1, mxidx = -1; memset(ans,-1, (m + 4) * sizeof(ans[0]));
        for(int i = 0 ; i < n ; i++)
            cin >> a[i];
        for(int i = 0 ; i < n ; i++)
            cin >> b[i];
        for(int i = 0 ,x; i < m ; i++)
            cin >> x , p[x].push_back(i) , lst = x;
        for(int i = 0 ;i < n ; i++){
            if(b[i] == lst){
                mxidx = i + 1; break;
            }
        }
        if(mxidx == -1){
            cout << "NO\n"; clr(n); continue;
        }
        for(int i = 0 ; i < n   ; i++){
            if(b[i] == a[i])
                continue;
            if(p[b[i]].empty()){
                can=0; break;
            }
               ans[p[b[i]].back()] = i + 1, p[b[i]].pop_back();
        }
        clr(n);
        if(!can){
            cout << "NO\n"; continue;
        }
        cout << "YES\n";
        if(ans[m - 1] == -1)
            ans[m - 1] = mxidx;
        for(int i = 0 ; i < m ; i++){
            ans[i] = (~ans[i] ? ans[i] : ans[m - 1]);
            cout  << ans[i] << " \n"[i == m -1];
        }

    }
}