#include <bits/stdc++.h>
using namespace std;
class graph {
 public:
  bool flag = true;
  map<long long, list<long long>> adj;
  vector<long long> pop;
  vector<long long> hap;
  vector<long long> par;
  long long v;
  long long cit;
  void init(long long n, long long m) {
    v = n;
    pop.resize(n + 1);
    hap.resize(n + 1);
    par.resize(n + 1);
    for (long long i = 1; i <= n; i++) {
      long long x;
      cin >> x;
      pop[i] = x;
    }
    for (long long i = 1; i <= n; i++) {
      cin >> hap[i];
    }
    par[1] = 1;
    for (long long i = 0; i < n - 1; ++i) {
      long long a, b;
      cin >> a >> b;
      par[b] = a;
      adj[a].push_back(b);
      adj[b].push_back(a);
    }
    long long sum = 0;
    for (long long i = 1; i <= n; i++) sum += pop[i];
    if (sum != m) flag = false;
  }
  pair<long long, pair<long long, long long>> check(long long node,
                                                    long long par) {
    long long tg = 0;
    long long tb = 0;
    long long curr = hap[node];
    long long totalPop = pop[node];
    for (auto child : adj[node]) {
      if (child == par) continue;
      pair<long long, pair<long long, long long>> temp = check(child, node);
      totalPop += temp.first;
      tg += temp.second.first;
      tb += temp.second.second;
    }
    long long g, b;
    g = b = 0;
    if ((curr + totalPop) < 0 || (curr + totalPop) % 2 != 0)
      flag = false;
    else
      g = (curr + totalPop) / 2;
    if (g > totalPop) flag = false;
    b = (totalPop - g);
    if (b < 0) flag = false;
    if (tg > g) flag = false;
    return {totalPop, {g, b}};
  }
};
int32_t main() {
  long long itr = 0;
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long tc;
  cin >> tc;
  while (tc--) {
    itr++;
    long long n, m;
    cin >> n >> m;
    graph g;
    g.init(n, m);
    g.check(1, 1);
    if (g.flag == false) {
      cout << "NO" << endl;
    } else
      cout << "YES" << endl;
  }
}
