#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
const int mod = 1e9 + 7;
const double eps = 1e-8;
long long p[maxn], h[maxn], flag, total[maxn], good[maxn];
vector<long long> w[maxn];
void add_edge(long long x, long long y) {
  w[x].push_back(y);
  w[y].push_back(x);
}
void dfs(long long x, long long fx) {
  long long len = w[x].size(), sum = 0;
  total[x] = p[x];
  for (long long i = 0; i < len; ++i) {
    long long y = w[x][i];
    if (y == fx) continue;
    dfs(y, x);
    total[x] += p[y];
    sum += good[y];
    if (flag) return;
  }
  p[x] = total[x];
  if (flag) return;
  if (abs(h[x]) > total[x]) {
    flag = 1;
    return;
  }
  if ((h[x] + total[x]) % 2 == 0 && ((h[x] + total[x]) / 2) >= h[x]) {
    good[x] = (h[x] + total[x]) / 2;
    if (good[x] < sum) {
      flag = 1;
      return;
    }
  } else {
    flag = 1;
  }
  return;
}
int main() {
  long long t;
  scanf("%lld", &t);
  while (t--) {
    long long n, m;
    flag = 0;
    memset(good, 0, sizeof(good));
    scanf("%lld%lld", &n, &m);
    for (long long i = 1; i <= n; ++i) w[i].clear();
    for (long long i = 1; i <= n; ++i) scanf("%lld", &p[i]);
    for (long long i = 1; i <= n; ++i) scanf("%lld", &h[i]);
    for (long long i = 1; i < n; ++i) {
      long long x, y;
      scanf("%lld%lld", &x, &y);
      add_edge(x, y);
    }
    dfs(1, 0);
    if (flag || total[1] != m) {
      printf("NO\n");
    } else {
      printf("YES\n");
    }
  }
  return 0;
}
