#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
int t, n, i, j, k, m, f;
int p[maxn], h[maxn], num[maxn], vis[maxn];
vector<int> v[maxn];
void dfs(int k) {
  vis[k] = 1;
  int s = 0;
  num[k] = p[k];
  for (int i = 0; i < v[k].size(); i++)
    if (vis[v[k][i]] == 0) {
      dfs(v[k][i]);
      num[k] += num[v[k][i]];
      s += h[v[k][i]];
    }
  if ((num[k] + h[k]) % 2 != 0 || h[k] > num[k] || h[k] + num[k] < 0) f = 1;
  if (s > h[k] + p[k]) f = 1;
}
int main() {
  scanf("%d", &t);
  while (t--) {
    scanf("%d%d", &n, &m);
    for (i = 1; i <= n; i++) {
      v[i].clear();
      vis[i] = 0;
    }
    for (i = 1; i <= n; i++) scanf("%d", &p[i]);
    for (i = 1; i <= n; i++) scanf("%d", &h[i]);
    for (i = 1; i <= n - 1; i++) {
      int x, y;
      scanf("%d%d", &x, &y);
      v[x].push_back(y);
      v[y].push_back(x);
    }
    f = 0;
    dfs(1);
    if (f == 1)
      cout << "NO" << endl;
    else
      cout << "YES" << endl;
  }
  return 0;
}
