#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
const double pi = 3.141592653589793;
template <class T>
using V = vector<T>;
using Graph = vector<vector<int>>;
using P = pair<long long, long long>;
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline void out(T a) {
  cout << a << '\n';
}
void YN(bool ok) {
  if (ok)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}
const long long INF = 1e18;
const int mx = 200005;
V<long long> p, h, cnt, cnt_good;
V<V<long long>> G;
void dfs(long long v, long long par) {
  for (long long u : G[v]) {
    if (u == par) continue;
    dfs(u, v);
    cnt[v] += cnt[u];
  }
  cnt[v] += p[v];
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int qqq;
  cin >> qqq;
  while (qqq--) {
    long long n, m;
    cin >> n >> m;
    p.clear();
    h.clear();
    cnt.clear();
    cnt_good.resize(n);
    p.resize(n);
    h.resize(n);
    cnt.resize(n);
    for (int i = 0; i < n; i++) cin >> p[i];
    for (int i = 0; i < n; i++) cin >> h[i];
    G.clear();
    G.resize(n);
    for (int i = 0; i < n - 1; i++) {
      cnt[i] = 0;
      long long a, b;
      cin >> a >> b;
      a--;
      b--;
      G[a].push_back(b);
      G[b].push_back(a);
    }
    cnt[n - 1] = 0;
    dfs(0, -1);
    bool ok = 1;
    for (int i = 0; i < n; i++) {
      if (h[i] + cnt[i] < 0 || cnt[i] - h[i] < 0) ok = 0;
      if ((h[i] + cnt[i]) % 2 == 1 || (cnt[i] - h[i]) % 2 == 1) ok = 0;
      long long good = (h[i] + cnt[i]) / 2;
      if (!(0 <= good && good <= cnt[i])) ok = 0;
    }
    V<int> d(n, -1);
    queue<int> que;
    que.push(0);
    d[0] = 0;
    while (que.size()) {
      int v = que.front();
      que.pop();
      long long c = 0;
      for (int nv : G[v]) {
        if (d[nv] != -1) continue;
        d[nv] = d[v] + 1;
        c += (cnt[nv] + h[nv]) / 2;
        que.push(nv);
      }
      if (c > (h[v] + cnt[v]) / 2) ok = 0;
    }
    YN(ok);
  }
}
