//#include <bits/stdc++.h>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <string.h>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <queue>
#include <math.h>
#include <assert.h>
#define ff first
#define ss second
#define ll long long
#define mod 1000000007
using namespace std;
ll te, n, m, a[100009], b[100009], c[100009];
unordered_map<ll, vector<ll> > need;
unordered_map<ll, ll> can;
int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cin>>te;
    while(te--) {
        cin>>n>>m;
        for(int i=1;i<=n;i++) {
            cin>>a[i];
        }
        need.clear();
        can.clear();
        for(int i=1;i<=n;i++) {
            cin>>b[i];
            if(a[i] != b[i]) {
                need[b[i]].push_back(i);
            }
        }
        for(int i=1;i<=m;i++) {
            cin>>c[i];
            can[c[i]]++;
        }
        bool pp = 1;
        for(auto el : need) {
            if(can.find(el.first) == can.end() || can[el.first] < el.second.size()) {
                cout<<"NO\n";
                pp = 0;
                break;
            }
        }
        if(pp == 0)
            continue;
        int last = -1;
        for(int i=1;i<=n;i++) {
            if(b[i] == c[m]) {
                last = i;
                break;
            }
        }
        if(last == -1) {
            cout<<"NO\n";
            continue;
        }
        cout<<"YES\n";
        for(int i=1;i<=n;i++) {
            if(a[i] != b[i] && b[i] == c[m]) {
                last = i;
                break;
            }
        }
        for(int i=1;i<m;i++) {
            if(need.find(c[i]) != need.end()) {
                ll ind = need[c[i]].back();
                cout<<ind<<" ";
                need[c[i]].pop_back();
                if(need[c[i]].size() == 0)
                    need.erase(c[i]);
                continue;
            }
            cout<<last<<" ";
        }
        cout<<last<<endl;
    }
}
