#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
int T;
int n, m;
int p[maxn];
int h[maxn];
namespace Graph {
struct Node {
  int to;
  int next;
} edge[maxn << 1];
int head[maxn], cnt;
inline void add_edge(int x, int y) {
  edge[++cnt].next = head[x];
  edge[cnt].to = y;
  head[x] = cnt;
}
}  // namespace Graph
using namespace Graph;
int sum[maxn];
int siz[maxn];
int flag = 0;
inline int dfs(int x, int fa) {
  siz[x] = p[x];
  int f = 0, dp = 0;
  for (int i = head[x]; i != 0; i = edge[i].next) {
    int k = edge[i].to;
    if (k == fa) continue;
    f = 1;
    dp += dfs(k, x);
    siz[x] += siz[k];
  }
  if ((siz[x] - h[x]) % 2 != 0) flag = 1;
  sum[x] = (siz[x] - h[x]) / 2;
  if (sum[x] > dp + p[x] || sum[x] - dp < p[x] - siz[x] || sum[x] < 0 ||
      siz[x] - sum[x] < 0)
    flag = 1;
  return sum[x];
}
int main() {
  scanf("%d", &T);
  while (T--) {
    memset(head, 0, sizeof(head));
    cnt = 0;
    for (int i = 1; i <= n; i++) siz[i] = sum[i] = 0;
    scanf("%d%d", &n, &m);
    flag = 0;
    for (int i = 1; i <= n; i++) scanf("%d", &p[i]);
    for (int i = 1; i <= n; i++) scanf("%d", &h[i]);
    for (int i = 1; i <= n - 1; i++) {
      int x, y;
      scanf("%d%d", &x, &y);
      add_edge(x, y);
      add_edge(y, x);
    }
    dfs(1, 0);
    if (!flag)
      printf("YES\n");
    else
      printf("NO\n");
  }
  return 0;
}
