#include <bits/stdc++.h>
const int nn = 1e5 + 5;
int t, n, m;
long long per[nn], h[nn];
int cnt, prev[nn << 1], last[nn], to[nn << 1];
void addedge(int p, int q) {
  prev[++cnt] = last[p];
  to[last[p] = cnt] = q;
}
long long sum[nn], rec[nn];
int flag;
void dfs(int p, int fa) {
  sum[p] = per[p];
  rec[p] = -per[p];
  for (int i = last[p], q; i; i = prev[i]) {
    if ((q = to[i]) != fa) {
      dfs(q, p);
      if (flag == 1) return;
      sum[p] += sum[q];
      rec[p] += rec[q];
    }
  }
  if (rec[p] > h[p] || rec[p] + (sum[p] << 1) < h[p] || (rec[p] - h[p] & 1)) {
    flag = 1;
    return;
  }
  sum[p] -= h[p] - rec[p] >> 1;
  rec[p] = h[p];
  return;
}
int main() {
  scanf("%d", &t);
  while (t--) {
    scanf("%d %d", &n, &m);
    for (int i = 1; i <= n; i++) scanf("%lld", per + i);
    for (int i = 1; i <= n; i++) scanf("%lld", h + i);
    for (int i = 1; i < n; i++) {
      int p, q;
      scanf("%d %d", &p, &q);
      addedge(p, q);
      addedge(q, p);
    }
    flag = 0;
    dfs(1, 0);
    puts(!flag ? "YES" : "NO");
    cnt = 0;
    for (int i = 1; i <= n; i++) per[i] = h[i] = last[i] = sum[i] = 0;
  }
}
