#include <bits/stdc++.h>
using namespace std;
int p[100010];
int happy[100010];
int h[100010], e[200010], idx, ne[200010];
int ha_per[100010];
void add(int a, int b) { e[idx] = b, ne[idx] = h[a], h[a] = idx++; }
bool flag;
void dfs(int u, int fa) {
  if (!flag) return;
  if (h[u] == -1) {
    if (abs(happy[u]) > p[u]) {
      flag = false;
      return;
    }
    if ((p[u] - happy[u]) % 2) {
      flag = false;
      return;
    } else {
      ha_per[u] = (happy[u] + p[u]) / 2;
      return;
    }
  }
  int res = 0;
  int tt = 0;
  for (int i = h[u]; ~i; i = ne[i]) {
    int j = e[i];
    if (j == fa) continue;
    dfs(j, u);
    res += ha_per[j];
    tt += p[j];
  }
  p[u] += tt;
  if (abs(happy[u]) > p[u]) {
    flag = false;
    return;
  }
  if ((p[u] - happy[u]) % 2) {
    flag = false;
    return;
  }
  ha_per[u] = (happy[u] + p[u]) / 2;
  if (res > ha_per[u]) flag = false;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    flag = true;
    int n, m;
    memset(h, -1, sizeof h);
    idx = 0;
    cin >> n >> m;
    for (int i = 1; i <= n; i++) cin >> p[i];
    for (int i = 1; i <= n; i++) cin >> happy[i];
    for (int i = 0; i < n - 1; i++) {
      int a, b;
      cin >> a >> b;
      add(a, b), add(b, a);
    }
    dfs(1, -1);
    if (flag)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
}
