#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
pair<long long, long long> dfs(int node, int par, vector<long long> &p,
                               vector<long long> &hi, vector<long long> &sz,
                               vector<vector<int> > &g) {
  sz[node] = p[node];
  long long good_child = 0, bad_child = 0;
  for (int child : g[node]) {
    if (child == par) continue;
    auto a = dfs(child, node, p, hi, sz, g);
    if ((a.first < 0) || (a.second < 0)) return make_pair(-1, -1);
    good_child += a.first;
    bad_child += a.second;
    sz[node] += sz[child];
  }
  if (((sz[node] + hi[node]) & (1LL) == 1) || (hi[node] > sz[node]))
    return make_pair(-1, -1);
  long long good = (sz[node] + hi[node]) / 2;
  long long bad = (sz[node] - hi[node]) / 2;
  if (min(good, sz[node] - p[node]) < good_child) return make_pair(-1, -1);
  return make_pair(good, bad);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int tc;
  cin >> tc;
  while (tc--) {
    int n, m;
    cin >> n >> m;
    vector<long long> p(n), hi(n), sz(n);
    for (int i = 0; i < n; i++) {
      cin >> p[i];
    }
    for (int i = 0; i < n; i++) {
      cin >> hi[i];
    }
    vector<vector<int> > g(n);
    for (int i = 0; i < n - 1; i++) {
      int u, v;
      cin >> u >> v;
      u--, v--;
      g[u].push_back(v);
      g[v].push_back(u);
    }
    auto a = dfs(0, -1, p, hi, sz, g);
    if ((a.first < 0) || (a.second < 0)) {
      cout << "NO\n";
    } else {
      cout << "YES\n";
    }
  }
  return 0;
}
