#include<bits/stdc++.h>
using namespace std;
int main(){
	int t;
	cin>>t;
	while(t--)
	{
	    int n,m,rem=0,extra=0;
	    cin>>n>>m;
	    unordered_map<int,queue<int> > mp;
	    unordered_map<int,int> contain,ran;
	    vector<int> ans;
	    queue<int> extrav;
	    int a[n],b[n],c[m];
	    for(int i=0;i<n;i++)cin>>a[i];
	    for(int i=0;i<n;i++)
	    {
	        cin>>b[i];
	        if(a[i]!=b[i]){mp[b[i]].push(i);rem++;}
	        contain[b[i]]++;
	        ran[b[i]]=i;
	        
	    }
	    for(int i=0;i<m;i++){
	        cin>>c[i];
	        if(contain.find(c[i])==contain.end())
	        {
	            
	           extra++;
	           ans.push_back(-1);
	        }
	        else
	        {
	            if(mp.find(c[i])==mp.end() || mp[c[i]].size()==0)
	            {
	                ans.push_back(ran[c[i]]+1);
	            }
	            else
	            {
	                ans.push_back(mp[c[i]].front()+1);
	                mp[c[i]].pop();
	                rem--;
	            }
	            if(extra>0)
	            {
	                while(extra!=0)
	               {extrav.push(ans[ans.size()-1]);extra--;}
	                
	            }
	        }
	    }
	    if(extra==0 && rem==0)
	    {
	        cout<<"YES"<<endl;
	        for(int i=0;i<ans.size();i++)
	        {
	            if(ans[i]==-1)
	            {
	                cout<<extrav.front()<<" ";
	                extrav.pop();
	            }
	            else cout<<ans[i]<<" ";
	        }
	        cout<<endl;
	    }
	    else
	    {
	        cout<<"NO"<<endl;
	    }
	}
	return 0;
}