#include<bits/stdc++.h>
 
using namespace std;
 
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
 
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(vector<vector<T>> x){cerr<<"\n{"; int f=x.size();for(int i=0;i<f;i++){cerr<<"("; int g=x[i].size(); for(auto j:x[i]){cerr<<j; (--g!=0)?cerr<<",":cerr<<"";}cerr<<")\n";}cerr<<"}";}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void __print(vector<bool> x){cerr<<"{";int f=x.size();for(auto i:x){cerr<<i;(--f !=0)?cerr<<",":cerr<<"";}cerr<<"}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
 
#ifndef ONLINE_JUDGE
#define trace(x...) cerr << "[" << #x << "] = [", _print(x)
#else
#define trace(x...)
#endif
 
template<typename... T>
void read(T&... args) {
    ((cin >> args), ...);
}
 
template<typename... T>
void writ(T&&... args) {
    ((cout << args << " "), ...);
}
#define ull unsigned long long
#define ll long long
#define MOD 1000000007
#define INF (ll)1e18
#define IINF (int)1e9
#define EPS 1e-9
/*
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    In the blazing sun I saw you
    In the shadows hiding from yourself
    When the lights are on I know you
    See you're grey from all the lies you tell 
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
*/

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //Last solution was a bust
    int t; cin>>t;
    while(t--){
        int n,m; cin>>n>>m;
        vector<int> mp[100001];

        vector<int> a(n);
        for(int i=0;i<n;i++) cin>>a[i];
        vector<int> b(n);
        for(int i=0;i<n;i++){
            cin>>b[i];
            if(a[i]!=b[i])
                mp[b[i]].push_back(i);
        }
        vector<int> c(m);
        for(int i=0;i<m;i++) cin>>c[i];

        int l=-1;
        if((int)mp[c[m-1]].size()>0){ //This is just present here to give this more priority
            l=mp[c[m-1]].back();
            mp[c[m-1]].pop_back();
        }
        else{
            for(int i=0;i<n;i++){
                if(b[i]==c[m-1]){
                    l=i;
                    break;
                }
            }
        }
        if(l==-1){
            cout<<"NO"<<endl;
            continue;
        }
        vector<int> ans(m,0);
        for(int i=0;i<m-1;i++){
            if((int)mp[c[i]].size()==0){
                ans[i]=l+1;
            }
            else{
                ans[i]=mp[c[i]].back();
                ans[i]+=1;
                mp[c[i]].pop_back();
            }
        }

        bool flag=true;
        for(int i=1;i<=n;i++){
            if((int)mp[i].size()>0){
                cout<<"NO"<<endl;
                flag=false;
                break;
            }
        }
        ans[m-1]=l+1;
        if(flag){
            cout<<"YES"<<endl;
            for(auto i: ans) cout<<i<<" ";
            cout<<endl;
        }
    }    
    return 0;
}

