#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
int a[N][3], h[N];
vector<int> v[N];
int flag;
void dfs(int x, int fa) {
  if (flag) return;
  for (auto i : v[x]) {
    if (i != fa) {
      dfs(i, x);
      a[x][2] += a[i][2];
      a[x][1] += a[i][1];
    }
  }
  if ((a[x][1] - h[x]) / 2 > a[x][2] + a[x][0] || (a[x][1] - h[x]) % 2 == 1 ||
      (a[x][1] - (a[x][1] - h[x]) / 2) < 0 || (a[x][1] - h[x]) < 0) {
    flag = 1;
    return;
  } else {
    a[x][2] = (a[x][1] - h[x]) / 2;
  }
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    flag = 0;
    int n, m;
    cin >> n >> m;
    for (int i = 1; i <= n; i++) {
      cin >> a[i][1];
      a[i][0] = a[i][1];
      a[i][2] = 0;
      v[i].clear();
    }
    for (int i = 1; i <= n; i++) {
      cin >> h[i];
    }
    int u, w;
    for (int i = 1; i <= n - 1; i++) {
      cin >> u >> w;
      v[u].push_back(w);
      v[w].push_back(u);
    }
    dfs(1, 1);
    if (flag) {
      cout << "NO" << endl;
    } else {
      cout << "YES" << endl;
    }
  }
  return 0;
}
