#include <bits/stdc++.h>
using namespace std;
const long long maxn = 1e5 + 5;
long long p[maxn];
long long h[maxn];
vector<long long> g[maxn];
long long happy[maxn];
bool ans;
void dfs(long long now, long long fa) {
  long long sz = g[now].size();
  long long hp = 0;
  for (long long i = 0; i < sz; i++) {
    long long v = g[now][i];
    if (v == fa) continue;
    dfs(v, now);
    p[now] += p[v];
    hp += happy[v];
  }
  if (sz == 1) {
    if ((p[now] + h[now]) % 2 || abs(h[now]) > p[now] ||
        h[now] + p[now] < hp * 2)
      ans = 0;
    else
      happy[now] = (p[now] + h[now]) / 2;
  } else {
    if (h[now] + p[now] >= hp * 2 && (h[now] + p[now]) % 2 == 0 &&
        abs(h[now]) <= p[now]) {
      happy[now] = (h[now] + p[now]) / 2;
    } else
      ans = 0;
  }
}
int main() {
  long long t;
  scanf("%lld", &t);
  while (t--) {
    long long n, m;
    scanf("%lld%lld", &n, &m);
    ans = 1;
    for (long long i = 0; i <= n; i++) g[i].clear();
    memset(happy, 0, sizeof(happy));
    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 u, v;
      scanf("%lld%lld", &u, &v);
      g[u].push_back(v);
      g[v].push_back(u);
    }
    dfs(1, -1);
    if (ans)
      printf("YES\n");
    else
      printf("NO\n");
  }
}
