#include <bits/stdc++.h>
const long long maxn = 1e6 + 10;
using namespace std;
void in(long long &x) {
  long long y = 1;
  char c = getchar();
  x = 0;
  while (c < '0' || c > '9') {
    if (c == '-') y = -1;
    c = getchar();
  }
  while (c <= '9' && c >= '0') {
    x = (x << 1) + (x << 3) + c - '0';
    c = getchar();
  }
  x *= y;
}
void o(long long x) {
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  if (x > 9) o(x / 10);
  putchar(x % 10 + '0');
}
long long n, m;
struct edge {
  long long to, next;
} e[maxn];
long long first[maxn] = {0}, cntedge = 0;
void addedge(long long fr, long long to) {
  e[++cntedge] = {to, first[fr]};
  first[fr] = cntedge;
  swap(fr, to);
  e[++cntedge] = {to, first[fr]};
  first[fr] = cntedge;
}
long long a[1000010];
long long h[1000010];
long long sons[1000010];
long long happs[1000010], sad[1000010];
bool dfs1(long long u, long long fa) {
  sons[u] = a[u];
  for (long long i = first[u]; i; i = e[i].next) {
    long long v = e[i].to;
    if (v == fa) continue;
    if (!dfs1(v, u)) return false;
    sons[u] += sons[v];
  }
  if ((sons[u] + h[u]) % 2 != 0) {
    return false;
  }
  happs[u] = (sons[u] + h[u]) >> 1;
  sad[u] = -h[u] + happs[u];
  if (happs[u] < 0 || sad[u] < 0) {
    return false;
  }
  return true;
}
bool dfs2(long long u, long long fa, long long hpps, long long sadss) {
  for (long long i = first[u]; i; i = e[i].next) {
    long long v = e[i].to;
    if (v == fa) continue;
    hpps -= happs[v];
    sadss -= sad[v];
    if (sadss < 0) {
      hpps += sadss;
      sadss = 0;
    }
    if (hpps < 0) return false;
    if (!dfs2(v, u, happs[v], sad[v])) {
      return false;
    }
  }
  return true;
}
signed main() {
  long long T;
  in(T);
  while (T--) {
    in(n);
    in(m);
    for (long long i = 1; i <= n; i++) {
      sons[i] = 0;
      happs[i] = 0;
      first[i] = 0;
      sad[i] = 0;
    }
    cntedge = 0;
    for (long long i = 1; i <= n; i++) {
      in(a[i]);
    }
    for (long long i = 1; i <= n; i++) {
      in(h[i]);
    }
    for (long long i = 1; i <= n - 1; i++) {
      long long x, y;
      in(x);
      in(y);
      addedge(x, y);
    }
    string ans;
    if (!dfs1(1, 0)) {
      ans += "NO";
    } else if (dfs2(1, 0, happs[1], sad[1])) {
      ans += "YES";
    } else {
      ans += "NO";
    }
    cout << ans << endl;
  }
  return 0;
}
