#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 7;
vector<int> G[maxn];
long long p[maxn], b[maxn];
long long siz[maxn];
long long f1[maxn], f2[maxn];
bool dfs(int x, int fa) {
  siz[x] = p[x];
  for (int i = 0; i < G[x].size(); i++) {
    int v = G[x][i];
    if (v == fa) continue;
    if (!dfs(v, x)) return false;
    siz[x] += siz[v];
  }
  f1[x] = (siz[x] + b[x]) / 2;
  f2[x] = (siz[x] - b[x]) / 2;
  long long num1 = 0, num2 = 0;
  for (int i = 0; i < G[x].size(); i++) {
    int v = G[x][i];
    if (v == fa) continue;
    num1 += f1[v];
    num2 += f2[v];
  }
  if (f1[x] < 0 || f2[x] < 0) return false;
  if (f1[x] + f2[x] != siz[x]) return false;
  if (num1 + num2 > f1[x] + f2[x]) return false;
  if (num1 > f1[x]) return false;
  if (f1[x] - f2[x] != b[x]) return false;
  return true;
}
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    int n, m;
    scanf("%d%d", &n, &m);
    for (int i = 1; i <= n; i++) {
      scanf("%lld", &p[i]);
      G[i].clear();
    }
    for (int i = 1; i <= n; i++) {
      scanf("%lld", &b[i]);
    }
    for (int i = 1; i < n; i++) {
      int x, y;
      scanf("%d%d", &x, &y);
      G[x].push_back(y);
      G[y].push_back(x);
    }
    if (dfs(1, -1))
      printf("YES\n");
    else
      printf("NO\n");
  }
  return 0;
}
