func_code_string: #include<bits/stdc++.h>   using namespace std;   const int maxn=1e5+10;   int a[maxn],b[maxn],c[maxn];   vector<int> v1[maxn],v2[maxn],app[maxn];   int ans[maxn];   int main()   {    int t;    cin>>t;    while(t--)    {     memset(ans,-1,sizeof(ans));     int n,m;     cin>>n>>m;     for(int i=1;i<=n;i++)     {      v1[i].clear();      v2[i].clear();      app[i].clear();      cin>>a[i];     }     for(int i=1;i<=n;i++)     {      cin>>b[i];      if(a[i]!=b[i])      {       v1[b[i]].push_back(i);      }      else      {       app[a[i]].push_back(i);      }     }     for(int i=1;i<=m;i++)     {      cin>>c[i];      v2[c[i]].push_back(i);     }     bool flag=true;     for(int i=1;i<=n;i++)     {      if((int)v1[i].size()>(int)v2[i].size())      {       puts( NO );       flag=false;       break;      }      int pp=-1;      if(!v1[i].empty())      {       pp=v1[i].back();      }      for(int j=0;j<v2[i].size();j++)      {       if(v1[i].empty())       {        if(pp!=-1)        {         ans[v2[i][j]]=pp;        }        else if(!app[i].empty())        {         ans[v2[i][j]]=app[i].back();        }       }       else       {        ans[v2[i][j]]=v1[i].back();        v1[i].pop_back();       }      }     }     if(!flag)     {      continue;     }     if(ans[m]==-1)     {      puts( NO );      continue;     }     puts( YES );     for(int i=1;i<=m;i++)     {      if(ans[i]==-1)      {       ans[i]=ans[m];      }      cout<<ans[i]<<   ;     }     cout<<endl;    }    return 0;   }   