#include <iostream>
#include <vector>

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    int t;
    std::cin >> t;
    while (t--) {
        int n, m;
        std::cin >> n >> m;
        std::vector<int> a(n), b(n), c(m);
        std::vector<std::vector<int>> same(n + 1, std::vector<int>());
        std::vector<std::vector<int>> different(n + 1, std::vector<int>());
        std::vector<std::vector<int>> newer(n + 1, std::vector<int>());
        for (int i = 0; i < n; ++i) {
            std::cin >> a[i];
        }
        for (int i = 0; i < n; ++i) {
            std::cin >> b[i];
            if (a[i] == b[i]) {
                same[b[i]].push_back(i);
            } else {
                different[b[i]].push_back(i);
            }
        }
        for (int i = 0; i < m; ++i) {
            std::cin >> c[i];
        }
        std::vector<int> ans(m);
        for (int i = 0; i < m; ++i) {
            if (!different[c[i]].empty()) {
                ans[i] = different[c[i]].back();
                newer[c[i]].push_back(ans[i]);
                different[c[i]].pop_back();
            } else if (!same[c[i]].empty()) {
                ans[i] = same[c[i]].back();
            } else if (!newer[c[i]].empty()) {
                ans[i] = newer[c[i]].back();
            } else {
                ans[i] = -1;
            }
        }
        bool next = false;
        int prev = -1;
        for (int i = m - 1; i >= 0; --i) {
            if (ans[i] == -1) {
                if (prev == -1) {
                    next = true;
                    break;
                }
                ans[i] = prev;
            } else if (prev == -1) {
                prev = ans[i];
            }
        }
        for (int i = 0; i < n; ++i) {
            if (!different[b[i]].empty()) {
                next = true;
                break;
            }
        }
        if (next) {
            std::cout << "NO\n";
            continue;
        }
        std::cout << "YES\n";
        for (int x : ans) {
            std::cout << x + 1 << ' ';
        }
        std::cout << '\n';
    }
    return 0;
}
