#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
const int N = 2e5 + 10;
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3f;
const int P = 1e9 + 7;
const double PI = acos(-1.0);
int a[N],b[N],c[N],d[N];
int ans[N];
vector<int> arr[N];
int n,m;
int main() {
    int t;
    cin>>t;
    while(t--){
        scanf("%d%d",&n,&m);
        for(int i = 1;i<=n;i++){
            scanf("%d",&a[i]);
            arr[i].clear();
        }
        int Max = 0;
        for(int i = 1;i<=n;i++) {
            scanf("%d",&b[i]);
            if(a[i]!=b[i]){
                arr[b[i]].push_back(i);
            }
        }
        for(int i = 1;i<=m;i++) scanf("%d",&c[i]);
        int flag = 0;
        int Last = -1;
        if(arr[c[m]].size()!=0){
            Last = arr[c[m]].back();
            arr[c[m]].pop_back();
        }else{
            for(int i = 1;i<=n;i++){
                if(b[i]==c[m]){
                    Last = i;
                    break;
                }
            }
        }
        if(Last==-1){
            puts("NO");
            continue;
        }
        ans[m] = Last;
        for(int i = 1;i<m;i++){
            if(arr[c[i]].size()==0){
                ans[i] = Last;
            }else{
                ans[i] = arr[c[i]].back();
                arr[c[i]].pop_back();
            }
        }
        for(int i = 1;i<=n;i++){
            if(arr[i].size()>0){
                flag = 1;
                break;
            }
        }
        if(flag){
            puts("NO");
        }else{
            puts("YES");
            for(int i= 1;i<=m;i++)  printf("%d ",ans[i]);
            printf("\n");
        }
    }
    return 0;
}
