#include <bits/stdc++.h>
using namespace std;
struct asd {
  signed long long int bad;
  signed long long int citizen;
  signed long long int happy;
} city[200001];
std::vector<signed long long int> ct[200001];
signed long long int n, m;
signed long long int flag = 0;
void dfs(signed long long int u, signed long long int p) {
  for (auto v : ct[u]) {
    if (v != p) {
      dfs(v, u);
      city[u].citizen += city[v].citizen;
    }
  }
}
void dfs_check(signed long long int u, signed long long int p) {
  signed long long int badp = city[u].bad;
  signed long long int citizen = city[u].citizen;
  for (auto v : ct[u]) {
    if (v != p) {
      dfs_check(v, u);
      badp -= city[v].bad;
      citizen -= city[v].citizen;
    }
  }
  if (badp > citizen) flag = 1;
  if (-badp > city[u].citizen) flag = 1;
}
int main() {
  if (fopen("1388C"
            ".INP",
            "r")) {
    freopen(
        "1388C"
        ".INP",
        "r", stdin);
    freopen(
        "1388C"
        ".OUT",
        "w", stdout);
  }
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  signed long long int t;
  cin >> t;
  while (t--) {
    cin >> n >> m;
    flag = 0;
    for (auto i = 1; i < n + 1; ++i) {
      ct[i].clear();
      cin >> city[i].citizen;
    }
    for (auto i = 1; i < n + 1; ++i) {
      cin >> city[i].happy;
    }
    for (auto i = 1; i < n; ++i) {
      signed long long int u, v;
      cin >> u >> v;
      ct[u].push_back(v);
      ct[v].push_back(u);
    }
    dfs(1, 1);
    for (auto i = 1; i < n + 1; ++i) {
      if ((city[i].citizen - city[i].happy) % 2) {
        flag = 1;
        break;
      }
      city[i].bad = (city[i].citizen - city[i].happy) / 2;
      if (city[i].bad < 0) {
        flag = 1;
        break;
      }
    }
    dfs_check(1, 1);
    if (flag)
      cout << "NO";
    else
      cout << "YES";
    cout << '\n';
  }
  return 0;
}
