#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>

#define fast ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define ll long long

using namespace std;

const int N = 1e5+5;

int a[N], b[N], c[N], d[N];

vector<int> col[N];

int main()
{
	int t;
	
	scanf("%d",&t);
	
	while(t--)
	{
		int n, m;
		
		scanf("%d %d",&n,&m);
		
		for(int i=1;i<=n;++i)
		{
			scanf("%d",&a[i]);
		}
		
		map<int,int> mp;
		
		int cnt = 0;
		
		for(int i=1;i<=n;++i)
		{
			scanf("%d",&b[i]);
			
			if(a[i]!=b[i])
			{
				col[b[i]].push_back(i);
				
				++cnt;
			}
		}
		
		for(int i=1;i<=m;++i)
		{
			scanf("%d",&c[i]);
		}
		
		if(m<cnt)
		{
			cout << "NO" << endl;
		}
		else
		{
			int plc = -1; 
			
			if(col[c[m]].size()!=0)
			{
				plc = col[c[m]][col[c[m]].size()-1];
			}
			else
			{
				for(int i=1;i<=n;++i)
				{
					if(b[i]==c[m])
					{
						plc = i;
						
						break;
					}
				}
			}
			
			if(plc==-1)
			{
				cout << "NO" << endl;
			}
			else
			{
				for(int i=1;i<=m;++i)
				{
					if(col[c[i]].size()!=0)
					{
						d[i] = col[c[i]][0];
						
						col[c[i]].erase(col[c[i]].begin(),col[c[i]].begin()+1);
						
						--cnt;
					}
					else
					{
						d[i] = plc;
					}
				}
				
				if(cnt==0)
				{
					cout << "YES" << endl;
					
					for(int i=1;i<=m;++i)
					{
						cout << d[i] << " ";
					}
					
					cout << endl;
				}
				else
				{
					cout << "NO" << endl;
				}
			}
		}
		
		for(int i=1;i<=n;++i)
		{
			col[i].clear();
		}
	}
	
	return 0;
}
