#include<iostream>
#include<cstdio>
#include<cstring>
#include<map>
using namespace std;

inline int read()
{
	int x = 0;
	char c = getchar();
	while(c<'0'||c>'9') c = getchar();
	while(c>='0'&&c<='9') x = (x<<1) + (x<<3) + (c^48), c = getchar();
	return x;
}

const int MAXN = 1e5 + 1e4;

int a[MAXN],b[MAXN],c[MAXN],col[MAXN];
bool is[MAXN];

multimap<int,int> mp;

void solve()
{
	mp.clear();
	memset(col,0,sizeof(col));
	memset(is,0,sizeof(is));
	memset(a,0,sizeof(a));
	memset(a,0,sizeof(b));
	memset(a,0,sizeof(c));
	int n = read();
	int m = read();
	int cnt = 0;
	for(int i = 1;i<=n;i++) a[i] = read();
	for(int i = 1;i<=n;i++)
	{
		b[i] = read();
		if(b[i]!=a[i]) col[b[i]]++,mp.insert(make_pair(b[i],i));
		is[b[i]] = 1;
	}
	for(int i = 1;i<=m;i++)
	{
		c[i] = read();
		col[c[i]]--;
	}
	if(!is[c[m]])
	{
		cout<<"NO"<<endl;
		return;
	}
	int la;
	
	for(int i = 1;i<=n;i++)
	{
		if(b[i]==c[m])
		{
			la = i;
			break;
		}
	}
	multimap<int,int> ::iterator itt = mp.find(c[m]);
	if(itt!=mp.end()) la = itt->second,mp.erase(itt);
	for(int i = 1;i<=n;i++)
	{
		if(col[b[i]]>0)
		{
			cout<<"NO"<<endl;
			return;
		}
	}
	cout<<"YES"<<endl;
	multimap<int,int> ::iterator it;
	int i = 1;
	while(mp.size())
	{
		it = mp.find(c[i]);
		if(it==mp.end()) cout<<la<<" ";
		else
		{
			cout<<(it->second)<<" ";
			mp.erase(it);
		}
		i++;
	}
	for(i;i<=m;i++) cout<<la<<" ";
	cout<<endl;
	return;
}

int main()
{
	int t = read();
	while(t--) solve();
	return 0;
}

