#include <bits/stdc++.h>
using namespace std;
vector<long long> adj[100005], tot(100005), hap(100005), thp(100005),
    tsd(100005), org(100005);
vector<bool> vis(100005, false), mvis(100005, false);
bool pos = true;
pair<long long, long long> dfs(long long n) {
  pair<long long, long long> cur = {0, 0};
  vis[n] = true;
  bool isLeaf = true;
  for (long long nei : adj[n]) {
    if (vis[nei] == false) {
      auto cc = dfs(nei);
      cur.first += cc.first;
      cur.second += cc.second;
      isLeaf = false;
    }
  }
  if (isLeaf) {
    return make_pair(thp[n], tsd[n]);
  }
  if (cur.first > thp[n]) {
    pos = false;
  } else {
    long long lft = thp[n] - cur.first;
    if (lft + tsd[n] - org[n] != cur.second) {
      pos = false;
    }
  }
  if (cur.first + cur.second + org[n] != tot[n]) pos = false;
  if (n == 1) {
  }
  return make_pair(thp[n], tsd[n]);
}
void mdfs(long long n) {
  mvis[n] = true;
  for (long long nei : adj[n])
    if (mvis[nei] == false) {
      mdfs(nei);
      tot[n] += tot[nei];
    }
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  ;
  long long t;
  cin >> t;
  while (t--) {
    long long n, p;
    cin >> n >> p;
    for (long long i = 1; i <= n; i++) {
      cin >> tot[i];
      org[i] = tot[i];
      adj[i].clear();
      vis[i] = false;
      mvis[i] = false;
    }
    for (long long i = 1; i <= n; i++) cin >> hap[i];
    long long a, b;
    for (long long i = 0; i < n - 1; i++) {
      cin >> a >> b;
      adj[a].push_back(b);
      adj[b].push_back(a);
    }
    mdfs(1);
    pos = true;
    for (long long i = 1; i <= n; i++) {
      thp[i] = (tot[i] + hap[i]) / 2;
      tsd[i] = tot[i] - thp[i];
      if (thp[i] < 0 || tsd[i] < 0 || thp[i] + tsd[i] != tot[i] ||
          (thp[i] - tsd[i] != hap[i]))
        pos = false;
    }
    pair<long long, long long> cp = dfs(1);
    if (pos)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
  return 0;
}
