#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
#define MottoHayaku ios::sync_with_stdio(0);cin.tie(0);
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define F first
#define S second
#define pb push_back
#define int ll
const int MOD=1e9+7;
const int INF=1e9;
const int N=1e5+5;
vector<ll> pos[N];
ll a[N],b[N],c[N];
signed main()
{
    MottoHayaku
    ll t;
    cin>>t;
    while(t--)
    {
        ll n,m;
        cin>>n>>m;
        rep1(i,n) pos[i].clear();
        rep(i,n) cin>>a[i];
        rep(i,n) cin>>b[i];
        rep(i,m)
        {
            cin>>c[i];
            if(i==m-1) break;
            pos[c[i]].pb(i);
        }
        ll id=-1;
        rep(i,n)
        {
            if(b[i]==c[m-1])
            {
                id=i;
                if(a[i]!=b[i]) break;
            }
        }
        if(id==-1)
        {
            cout<<"NO\n";
            continue;
        }
        vector<ll> ans(m,id+1);
        bool x=0;
        rep(i,n)
        {
            if(i==id||a[i]==b[i]) continue;
            if(pos[b[i]].size()==0)
            {
                x=1;
                break;
            }
            ll to=pos[b[i]].back();
            pos[b[i]].pop_back();
            ans[to]=i+1;
        }
        if(x) cout<<"NO\n";
        else
        {
            cout<<"YES\n";
            for(ll u:ans) cout<<u<<" ";
            cout<<"\n";
        }
    }
}
