#include <bits/stdc++.h>
using namespace std;
long long m;
vector<list<long long>> v;
vector<long long> q, h, k;
bool flag;
pair<long long, long long> obh(int u) {
  pair<long long, long long> pr;
  long long sum = q[u], alr = 0;
  k[u] = 1;
  for (auto i : v[u]) {
    if (!k[i]) {
      pr = obh(i);
      sum += pr.first;
      alr += pr.second;
    }
  }
  k[u] = 0;
  if ((sum - h[u]) % 2 != 0 || sum - h[u] < 0 || (sum - h[u]) / 2 > sum ||
      (sum - h[u]) / 2 > m) {
    flag = 0;
  }
  long long yt = (sum - h[u]) / 2;
  if (yt - q[u] > alr) {
    flag = 0;
  }
  return pair<long long, long long>(sum, yt);
}
int main() {
  long long T;
  cin >> T;
  while (T--) {
    flag = 1;
    long long n, a;
    cin >> n >> m;
    v.clear();
    q.clear();
    h.clear();
    k.clear();
    q.push_back(0);
    h.push_back(0);
    v.resize(n + 1);
    k.resize(n + 1);
    for (int i = 0; i < n; ++i) {
      cin >> a;
      q.push_back(a);
    }
    for (int i = 0; i < n; ++i) {
      cin >> a;
      h.push_back(a);
    }
    for (int i = 0; i < n - 1; ++i) {
      long long b;
      cin >> a >> b;
      v[a].push_back(b);
      v[b].push_back(a);
    }
    auto prr = obh(1);
    if (flag && prr.second <= m)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
}
