#include <bits/stdc++.h>
using namespace std;
const long long inf = (long long)1e9;
const int N = (int)1e5 + 2;
int good[N], h[N], p[N], pass[N];
vector<vector<int>> tr;
bool ok = true;
void dfs(int u, int par = -1) {
  pass[u] = p[u];
  int goods = 0;
  for (auto v : tr[u]) {
    if (v != par) {
      dfs(v, u);
      goods += good[v];
      pass[u] += pass[v];
    }
  }
  if ((pass[u] + h[u]) & 1) ok = false;
  int g = (pass[u] + h[u]) / 2;
  if (g < goods || g > pass[u]) ok = false;
  good[u] = g;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    ok = true;
    int n, m;
    cin >> n >> m;
    tr.clear();
    tr.resize(n + 1);
    for (int i = 1; i <= n; ++i) {
      cin >> p[i];
      good[i] = 0;
      pass[i] = 0;
    }
    for (int i = 1; i <= n; ++i) cin >> h[i];
    for (int i = 0; i < n - 1; ++i) {
      int u, v;
      cin >> u >> v;
      tr[u].push_back(v), tr[v].push_back(u);
    }
    dfs(1);
    if (ok)
      puts("YES");
    else
      puts("NO");
  }
}
