#include<bits/stdc++.h>
using namespace std;
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
	long long int n, m;
	cin>>n>>m;
	long long int a[n],b[n],c[m];
	map<long long int,long long int> m1;
	map<long long int, set<long long int>> m3;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	for (int i = 0; i < n; i++)
	{
		cin >> b[i];
		if (b[i] != a[i])
			m3[b[i]].insert(i +  1);
	}
	for (int i=0;i<m;i++)
	{
		cin>>c[i];
		m1[c[i]]++;
	}
	int flag=0;
	for (auto d : m3)
		if (m3[d.first].size()>m1[d.first])
		{
			cout<<"NO"<<endl;
			flag=1;
			break;
		}
		if(flag==1)
			continue;
	int flag1=-1;
	for (int i=0;i<n;i++)
	{
		if (b[i]!= a[i] && b[i] == c[m - 1])
			flag1 = i + 1;
		else if (b[i] == c[m - 1]&& m3[c[m - 1]].size() < m1[c[m - 1]] && flag1 == -1 )
			flag1 = i + 1; 
	}
	if (flag1 == -1)
	{
		cout << "NO" << endl;
		continue;
	}
	cout<<"YES"<<endl;
	for (int i=0;i<m-1;i++)
	{
		if (m3[c[i]].size() == 0)
			cout<<flag1<<" ";
		else
		{
			cout<<*m3[c[i]].begin()<<" ";
			m3[c[i]].erase(m3[c[i]].begin());
		}
	}
	cout<<flag1<<endl;
	}
}