#include<iostream>
#include<bits/stdc++.h>
#define m_p make_pair
#define fi first
#define se second
#define pb push_back
typedef long long ll;
#define f(i,n) for(ll i=0;i<n;i++)
#define f1(i,n) for(ll i=1;i<=n;i++)
#define   crap ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0)
using namespace std;
#define INF 1000000
#define vll vector<ll>
const int M = 1e9+7;
ll fastpower(ll x,ll n,ll M)
{
    if(n==0)
        return 1;
    else if(n%2 == 0)        //n is even
        return fastpower((x*x)%M,n/2,M);
    else                             //n is odd
        return (x*fastpower((x*x)%M,(n-1)/2,M))%M;
}
ll GCD(ll A, ll B) {
    if(B==0)
        return A;
    else
        return GCD(B, A % B);
}
bool vowl(char c)
{
  return c=='a'||c=='e'||c=='i'||c=='o'||c=='u';
}
ll modInverse(ll A,ll M)// when M is prime
{
    return fastpower(A,M-2,M);
}
void sieve(ll N) {
        bool isPrime[N+1];
        for(ll i = 0; i <= N;++i) {
            isPrime[i] = true;
        }
        isPrime[0] = false;
        isPrime[1] = false;
        for(ll i = 2; i * i <= N; ++i) {
             if(isPrime[i] == true) {                    //Mark all the multiples of i as composite numbers
                 for(ll j = i * i; j <= N ;j += i)
                     isPrime[j] = false;
            }
        }
    }
vector<ll> factorize(ll n) {
    vector<ll> res;
    for (ll i = 2; i * i <= n; ++i) {
        while (n % i == 0) {
            res.push_back(i);
            n /= i;
        }
    }
    if (n != 1) {
        res.push_back(n);
    }
    return res;
}
 
int main()
{
  crap;
  #ifndef ONLINE_JUDGE
      freopen("input.txt","r",stdin);
      freopen("output.txt","w",stdout);
      #endif
      ll t=1;
      cin>>t;
      while(t--)
      {
       ll n,m;
       cin>>n>>m;
       ll a[n],b[n],c[m];
       f(i,n)cin>>a[i];
       f(i,n)cin>>b[i];
       f(i,m)cin>>c[i];
       vector<int> v[n+5];vll temp[n+5];
       int ans[n+5];
       memset(ans,0,sizeof(ans));
       int u=0;
       for(int i=0;i<n;i++)
       {
        v[b[i]].pb(i+1);
        if(a[i]!=b[i])
        {
          ans[b[i]]++;
          u++;
          temp[b[i]].pb(i+1);
        }
       }
       int p=0;int flag=0;int l;ll sol[m];
       for(int i=m-1;i>=0;i--)
       {
            if(ans[c[i]]>0)
            {
              u--;
              ans[c[i]]--;
            sol[i]=temp[c[i]][temp[c[i]].size()-1];
            temp[c[i]].pop_back();
              if(p==0)l=sol[i];
              p=1;
            }
            else if(!v[c[i]].empty())
              {
                if(p==0)l=v[c[i]][0];
                p=1;
                sol[i]=v[c[i]][0];
              }
              else if(v[c[i]].empty()&&p==1)
              {
                sol[i]=l;
              }
            else if(v[c[i]].empty()&&p==0)flag=1;

       }
       if(u==0&&flag==0)
        {

          cout<<"YES"<<endl;
          f(i,m)cout<<sol[i]<<" ";
          cout<<endl;
         }
       else
        cout<<"NO"<<endl;

      }
  return 0;
}