#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <map>
#define ll long long
using namespace std;


int main()
{
    ll t;
    cin >> t;
    while (t--) {
        ll n, m;
        cin >> n >> m;
        string s;
        vector<ll> a(n, 0);
        vector<ll> b(n, 0);
        vector<ll> c(m, 0);
        vector<ll> result(m, 0);
        vector<vector<ll>> bucket(n + 1, vector<ll>(0));

        for (auto& e : a)cin >> e;
        for (auto& e : b)cin >> e;
        for (auto& e : c)cin >> e;

        for (ll i = 0; i < n; i++)
        {
            if (b[i] != a[i]) {
                bucket[b[i]].push_back(i);
            }
        }

        ll lastC = -1;
        if (bucket[c[m - 1]].size() > 0) {
            lastC = bucket[c[m - 1]].back();
            bucket[c[m - 1]].pop_back();
        }
        else {
            for (ll i = 0; i < n; i++)
            {
                if (b[i] == c[m - 1]) {
                    lastC = i;
                    break;
                }
            }
        }

        if (lastC == -1) {
            cout << "NO" << endl;
        }
        else {
            result[m - 1] = lastC;
            for (ll i = 0; i < m - 1; i++)
            {
                if (bucket[c[i]].size() == 0) {
                    result[i] = lastC;
                }
                else {
                    result[i] = bucket[c[i]].back();
                    bucket[c[i]].pop_back();
                }
            }

            auto res = true;
            for (ll i = 0; i < n + 1; i++)
            {
                if (bucket[i].size() > 0) {
                    res = false;
                }
            }

            if (res == false) {
                cout << "NO" << endl;
            }
            else {
                cout << "YES" << endl;
                for (ll i = 0; i < m; i++)
                {
                    cout << result[i] + 1;
                    if (i < m - 1) {
                        cout << " ";
                    }
                    else {
                        cout << endl;
                    }
                }
            }
        }
    }
    return 0;
}