#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 7;
int N, M;
bool ans;
int p[MAXN], h[MAXN], sz[MAXN], inf[MAXN], fel[MAXN];
vector<int> G[MAXN];
void sz_dfs(int node, int parent) {
  sz[node] = p[node];
  for (int u : G[node])
    if (u != parent) {
      sz_dfs(u, node);
      sz[node] += sz[u];
    }
  if ((sz[node] + h[node]) % 2 == 1) ans = false;
  if (abs(h[node]) > sz[node]) ans = false;
}
void dfs(int node, int parent) {
  inf[node] = 0;
  fel[node] = 0;
  for (int u : G[node])
    if (u != parent) {
      dfs(u, node);
      inf[node] += (sz[u] - (sz[u] + h[u]) / 2);
      fel[node] += (sz[u] + h[u]) / 2;
    }
  if (G[node].size() == 1 && parent != 0) return;
  if (((sz[node] - (sz[node] + h[node]) / 2) - p[node]) > inf[node]) {
    ans = false;
  }
  if (((sz[node] + h[node]) / 2) < fel[node]) {
    ans = false;
  }
}
void solve() {
  ans = true;
  cin >> N >> M;
  for (int i = 1; i <= N; ++i) cin >> p[i];
  for (int i = 1; i <= N; ++i) cin >> h[i];
  for (int i = 1; i < N; ++i) {
    int x, y;
    cin >> x >> y;
    G[x].push_back(y);
    G[y].push_back(x);
  }
  sz_dfs(1, 0);
  dfs(1, 0);
  if (!ans) {
    cout << "NO\n";
    for (int i = 1; i <= N; ++i) G[i].clear();
    return;
  }
  cout << "YES\n";
  for (int i = 1; i <= N; ++i) G[i].clear();
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int TT;
  cin >> TT;
  while (TT--) {
    solve();
  }
  return 0;
}
