#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define fi first
#define se second
#define pii pair<int,int> 

void solve() {
    int n, m;
    cin>>n>>m;
    vector<int> a(n), b(n), c(m), vis(n, 1);
    int cnt = 0;
    for(int i=0;i<n;i++) cin>>a[i];
    for(int i=0;i<n;i++) {
        cin>>b[i];
        if(a[i] != b[i]) {
            vis[i] = 0;
            cnt++;
        }    
        
    }
    vector<vector<int>> arr(n);
    for(int i=0;i<m;i++) {
        cin>>c[i];
        arr[c[i] - 1].pb(i);
    }
    if(cnt > m) {
        cout<<"NO";
        return ;
    }
    vector<int> ans(m, -1);
    for(int i=0;i<n;i++) {
        if(a[i] != b[i]) {
            if(arr[b[i] - 1].empty()) {
                cout<<"NO";
                return ;
            }
            else {
                ans[arr[b[i] - 1].back()] = i;
                arr[b[i] - 1].pop_back(); 
            }
        }
    }
    for(int i=0;i<n;i++) {
        if(a[i] == b[i]) {
            if(!arr[b[i] - 1].empty())  {
                ans[arr[b[i] - 1].back()] = i;
                arr[b[i] - 1].pop_back(); 
            }
        }
    }
    int last = ans[m-1];
    for(int i=m-2;i>=0;i--) {
        if(last != -1) {
            if(ans[i] == -1) {
                ans[i] = last;
            } 
            else last = ans[i];
        }
        else last = ans[i];
    }
    for(int i=0;i<m;i++) {
        if(ans[i] == -1) {
            cout<<"NO";
            return ;
        }
    }
    cout<<"YES"<<"\n";
    for(int i=0;i<m;i++) cout<<ans[i] + 1<<" "; 
}

int main() {
    int t = 1;
    cin>>t;
    while(t--) {
        solve();
        cout<<"\n";
    }
    return 0;
}

