#include<bits/stdc++.h>

using namespace std;

const int NN = 101010;

int a[NN], b[NN], c[NN], pos[NN], cnt[NN], ans[NN];
set<int> st[NN];

void solve() {
	int n, m;
	scanf("%d %d", &n, &m);
	for(int i=1; i<=n; i++) scanf("%d", a+i);
	for(int i=1; i<=n; i++) scanf("%d", b+i);
	for(int i=1; i<=m; i++) scanf("%d", c+i);
	
	int win = 0;
	for(int i=1; i<=n; i++) st[i].clear(), pos[i]=0, cnt[i]=0, ans[i]=0;
	for(int i=1; i<=n; i++) {
		if(a[i] != b[i]) {
			st[b[i]].insert(i);
			win++;
		}
		pos[b[i]] = i;
	}
	for(int i=m; i; i--) {
		if(st[c[i]].size()) {
			int u = *st[c[i]].begin();
			st[c[i]].erase(u);
			ans[i] = u;
			win--;
		} else {
			if(i==m) {
				if(pos[c[i]]) ans[i] = pos[c[i]];
				else {
					puts("NO");
					return ;
				}
			}
			ans[i] = ans[m];
		}
	}
	if(win) {
		puts("NO");
		return ;
	}
	
	puts("YES");
	for(int i=1; i<=m; i++) cout<<ans[i]<<" ";
	puts("");
}

int main(){
#ifndef ONLINE_JUDGE
	freopen("in.in","r",stdin);
	freopen("out.out","w",stdout);
#endif
	int t; cin>>t;
	while(t--) solve();
	
	return 0;
}
            