#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
#define INF 1000000000
#define LINF 1000000000000000LL
#define pb push_back
#define all(x) x.begin(), x.end()
#define len(s) (int)s.size()
#define test_case { int t; cin>>t; while(t--)solve(); }
#define input(n, v) {for(int i = 0;i<n;i++) cin>>v[i];}
#define output(n, v) {for(int i = 0;i<n;i++) cout<<v[i]<<" "; cout<<endl;}
#define single_case solve();
#define line cout<<"------------"<<endl;
#define ios { ios_base::sync_with_stdio(false); cin.tie(NULL); }
const int N = 1e5 + 5;
int c1[N], c2[N], c3[N];
vector<int> v[N];

void solve()
{
    int n, m;
    cin>>n>>m;
    vector<int> a(n), b(n), c(m);
    for(int i = 1;i<=n;++i) v[i].clear();
    for(int i = 1;i<=n;i++) c1[i] = c2[i] = c3[i] = 0;
    for(int i = 0;i<n;i++) cin>>a[i], c1[a[i]]++;
    for(int i = 0;i<n;i++) cin>>b[i], c2[b[i]]++;
    for(int i = 0;i<m;i++) cin>>c[i], c3[c[i]]++;
    if(!c2[c[m-1]])
    {
        cout<<"NO"<<endl;
        return;
    }
    int p = -1;
    for(int i = 0;i<n;++i) if(b[i]==c[m-1]&&a[i]!=b[i]) p = i;
    if(p==-1)
        for(int i = 0;i<n;i++) if(b[i]==c[m-1]) p = i;
    for(int i = 0;i<n;i++) if(a[i]!=b[i]&&i!=p) v[b[i]].pb(i);
    vector<int> res;
    for(int i = 0;i<m-1;i++)
    {
        int x = c[i];
        if(len(v[x]))
        {
            res.pb(v[x].back());
            v[x].pop_back();
        }
        else
        {
            res.pb(p);
        }
    }
    res.pb(p);
    int moze = 1;
    for(int i = 0;i<n;i++) if(a[i]!=b[i]&&len(v[b[i]])) moze = 0;
    if(!moze)
    {
        cout<<"NO"<<endl;
    }
    else
    {
        cout<<"YES"<<endl;
        for(int x : res) cout<<x+1<<" ";
        cout<<endl;
    }
}



int main()
{
    ios
    test_case




    return 0;
}
