#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
long long *sz;
long long *p;
long long *h;
vector<long long> *gr;
long long get_bad(long long v) { return (sz[v] - h[v]) / 2; }
bool dfs(long long v) {
  sz[v] = p[v];
  long long sb = 0;
  for (long long g : gr[v]) {
    if (sz[g] != -1) {
      continue;
    }
    if (!dfs(g)) {
      return false;
    }
    sz[v] += sz[g];
    sb += get_bad(g);
  }
  return sb >= get_bad(v) - p[v];
}
inline void solve() {
  long long n, m;
  cin >> n >> m;
  long long _p[n];
  p = _p;
  for (long long i = 0; i < n; i++) {
    cin >> p[i];
  }
  long long _h[n];
  h = _h;
  for (long long i = 0; i < n; i++) {
    cin >> h[i];
  }
  vector<long long> _gr[n];
  gr = _gr;
  for (long long i = 1; i < n; i++) {
    long long x, y;
    cin >> x >> y;
    x--;
    y--;
    gr[x].push_back(y);
    gr[y].push_back(x);
  }
  long long _sz[n];
  sz = _sz;
  memset(_sz, -1, sizeof(_sz));
  bool ok = dfs(0);
  for (long long i = 0; i < n; i++) {
    if (abs(h[i]) % 2 != sz[i] % 2 || h[i] > sz[i]) {
      ok = false;
      break;
    }
  }
  if (ok) {
    cout << "YES\n";
  } else {
    cout << "NO\n";
  }
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  long long t;
  cin >> t;
  for (long long i = 0; i < t; ++i) {
    solve();
  }
  return 0;
}
