#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define mp make_pair
#define pb push_back
#define sc second
#define fr first
#define scl(n) scanf("%lld",&n)
#define scll(n,m) scanf("%lld%lld",&n,&m)
#define scs(ch) scanf("%s", ch)
#define pll pair< ll,ll >

set < ll > st;
set < ll > :: iterator it;

ll araa[100005],arab[100005],arax[100005],cnt[100005],ck[100005],out[100005];

queue < ll > q[100005];

int main()
{
    ll test,t,i,j,k,a,b,c,x,y,z,n,m;

    scl(test);
    for(t=1;t<=test;t++)
    {
        scll(n,m);
        for(i=1;i<=n;i++){
            scl(araa[i]);
        }
        for(i=1;i<=n;i++)
        {
            scl(arab[i]);
            if(arab[i]!=araa[i]){
                q[arab[i]].push(i);

            }
            ck[arab[i]]=i;
        }
        for(i=1;i<=m;i++){
            scl(arax[i]);
        }
        z=0;
        for(i=m,x=-1;i>0;i--)
        {

            a=arax[i];
            if(!ck[a]){
                if(x==-1){
                    z=1;
                    break;
                }
                else{
                    out[i]=x;
                }
            }
            else if(q[a].empty())
            {
                //cout<<i<<endl;
                out[i]=ck[a];
            }
            else{
                b=q[a].front();
                q[a].pop();
                out[i]=b;
            }
            x=out[i];
        }
        for(i=0;i<=n;i++){
            if(!q[i].empty()){
                z=1;
                break;
            }
        }
        if(z){
            printf("No\n");
        }
        else{
            printf("Yes\n");
            for(i=1;i<=m;i++)
            {
                printf("%lld ",out[i]);
            }
            printf("\n");

        }
        for(i=1;i<=n;i++){
            ck[i]=0;
            cnt[i]=0;
            while(!q[i].empty()){
                q[i].pop();
            }
        }
    }


    return 0;
}

