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