#include <bits/stdc++.h>
std::mt19937_64 rng(
    std::chrono::steady_clock::now().time_since_epoch().count());
using namespace std;
const long long N = 100005;
vector<long long> v[N];
vector<long long> sub(N);
vector<long long> vis(N), h(N), p(N);
long long ans;
pair<long long, long long> dfs(long long s) {
  vis[s] = 1;
  long long good = 0, bad = 0;
  pair<long long, long long> pp;
  long long temp;
  for (auto i : v[s]) {
    if (!vis[i]) {
      pp = dfs(i);
      good += pp.first;
      bad += pp.second;
    }
  }
  temp = (h[s] + bad + good + p[s]);
  long long total_vis = good + bad + p[s];
  long long x = 0, y = 0;
  if (temp % 2 == 0 and temp / 2 >= 0 and temp / 2 <= total_vis and
      good <= temp / 2) {
    x = temp / 2;
    y = bad + good + p[s] - temp / 2;
  } else {
    ans = 0;
  }
  return {x, y};
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  cin >> t;
  while (t--) {
    long long n, m;
    cin >> n >> m;
    for (long long i = 1; i <= n; i++) {
      vis[i] = 0;
      sub[i] = 0;
      v[i].clear();
    }
    for (long long i = 1; i <= n; i++) cin >> p[i];
    for (long long i = 1; i <= n; i++) cin >> h[i];
    long long x, y;
    for (long long i = 0; i < n - 1; i++) {
      cin >> x >> y;
      v[x].push_back(y);
      v[y].push_back(x);
    }
    ans = 1;
    dfs(1);
    if (ans)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
  cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
  return 0;
}
