#include <bits/stdc++.h>
using namespace std;
using gg = long long;
// MAX
// constexpr gg MAX = 25;
constexpr gg MAX = 1e6 + 5;
constexpr gg mod = 1e9 + 7;
gg ni, mi, ti, ki, di, pi;
gg a[MAX], b[MAX], c[MAX], ans[MAX];
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    // ti
    cin >> ti;
    while (ti--) {
        cin >> ni >> mi;
        unordered_map<gg, vector<gg>> cor, mis;
        for (gg i = 1; i <= ni; ++i) {
            cin >> a[i];
        }
        for (gg i = 1; i <= ni; ++i) {
            cin >> b[i];
            if (a[i] == b[i]) {
                cor[b[i]].push_back(i);
            } else {
                mis[b[i]].push_back(i);
            }
        }
        stack<gg> st;
        for (gg i = 1; i <= mi; ++i) {
            cin >> c[i];
            if (mis.count(c[i]) or cor.count(c[i])) {
                gg t = mis.count(c[i]) ? mis[c[i]].back() : cor[c[i]].back();
                while (not st.empty()) {
                    ans[st.top()] = t;
                    st.pop();
                }
                ans[i] = t;
                if (mis.count(c[i])) {
                    auto& kkk = mis[c[i]];
                    cor[c[i]].push_back(kkk.back());
                    kkk.pop_back();
                    if (kkk.empty()) {
                        mis.erase(c[i]);
                    }
                }
            } else {
                st.push(i);
            }
        }
        if (not st.empty() or not mis.empty()) {
            cout << "NO\n";
        } else {
            cout << "YES\n";
            for (gg i = 1; i <= mi; ++i) {
                cout << ans[i] << " ";
            }
            cout << "\n";
        }
    }
    return 0;
}