#include<bits/stdc++.h>

typedef long long ll;
using namespace std;

const int N = 1e5 + 5;
vector<int> G[N];
void solve() {
  int n, m; cin >> n >> m;
  vector<int> a(n, 0), b(n, 0), c(m, 0);
  for(int i = 0; i < n; i++) {
    cin >> a[i];
    G[i + 1].clear();
  }  
  for(int i = 0; i < n; i++) {
    cin >> b[i];
    if(a[i] != b[i]) {
      G[b[i]].push_back(i); 
    } 
  }
  for(int i = 0; i < m; i++) {
    cin >> c[i];
  }
  int last = -1;
  if(G[c[m - 1]].size()) {
    last = G[c[m - 1]].back();
    G[c[m - 1]].pop_back();
  } else {
    for(int i = 0; i < n; i++) {
      if(b[i] == c[m - 1]) {
        last = i; break;
      }
    }
  }
  if(last == -1) {
    cout << "NO\n";
  } else {
    vector<int> ans(m, -1);
    ans[m - 1] = last;
    for(int i = 0; i < m - 1; i++) {
      if(G[c[i]].size() == 0) {
        ans[i] = last;
      } else {
        ans[i] = G[c[i]].back();
        G[c[i]].pop_back();
      }
    }
    bool ok = 1;
    for(int i = 1; i <= n; i++) {
      if(G[i].size()) {
        ok = 0; break;
      }
    }
    if(!ok) {
      cout << "NO\n";
    } else {
      cout << "YES\n";
      for(int i = 0; i < ans.size(); i++) {
        cout << ans[i] + 1 << ' ';
      }
      cout << '\n';
    }
  }
}
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  int T = 1; cin >> T;
  while(T--) {
    solve();
  }
  return 0;
} 