#include <bits/stdc++.h>
#include <chrono>

using namespace std;

using ll           = long long;
using ld           = long double;
using pii          = pair<int, int>;
using pll          = pair<long, long>;
using vi           = vector<int>;
using vl           = vector<long long>;
using vb           = vector<bool>;
using vs           = vector<string>;
using vld          = vector<long double>;

#define pb             push_back
#define f              first
#define s              second
#define sz(a)          int((a).size())
#define all(a)         (a).begin(), (a).end()
#define rall(a)        (a).rbegin(), (a).rend()
#define sum(a)         ( accumulate((a).begin(), (a).end(), 0LL))
#define mine(a)        (*min_element((a).begin(), (a).end()))
#define maxe(a)        (*max_element((a).begin(), (a).end()))
#define mini(a)        ( min_element((a).begin(), (a).end()) - (a).begin())
#define maxi(a)        ( max_element((a).begin(), (a).end()) - (a).begin())
#define lowb(a, x)     ( lower_bound((a).begin(), (a).end(), (x)) - (a).begin())
#define uppb(a, x)     ( upper_bound((a).begin(), (a).end(), (x)) - (a).begin())
#define each(a, b)     for (auto &a: b)
#define yes            cout << "YES" << endl
#define no             cout << "NO"  << endl

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll mod = 1e9 + 7;

ll n, m, k, p, q, l, r, u, v, x, y, z;
// ll ans = 0;

void solve(int t = 1) {
    cin >> n >> m;

    vi a(n), b(n), c(m);
    each(u, a) cin >> u;
    each(u, b) cin >> u;
    each(u, c) cin >> u;

    vi ans(m, 0);

    map<int, vi> mp;
    for (int i = 0; i < m; i++) {
        mp[c[i]].push_back(i);
    }

    for (int i = 0; i < n; i++) {
        if (a[i] != b[i]) {
            if (!mp[b[i]].empty()) {
                a[i] = b[i];
                ans[mp[b[i]].back()] = i + 1;
                mp[b[i]].pop_back();
            } else {
                no;
                return;
            }
        }
    }

    if (a != b) {
        no;
        return;
    }

    if (ans[m - 1] == 0) {
        bool flag = true;

        for (int i = 0; i < n; i++) {
            if (c[m - 1] == b[i]) {
                ans[m - 1] = i + 1;
                flag = false;
                break;
            }
        }

        if (flag) {
            no;
            return;
        }
    }

    each(u, ans) {
        if (u == 0) u = ans[m - 1];
    }

    yes;
    each(u, ans) cout << u << ' ';
    cout << endl;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int tc = 1;
    cin >> tc;

    for (int t = 1; t <= tc; t++) solve(t);

    return 0;
}
