#include <bits/stdc++.h>
using namespace std;
void my_dbg() { cout << endl; }
template <typename Arg, typename... Args>
void my_dbg(Arg A, Args... B) {
  cout << ' ' << A;
  my_dbg(B...);
}
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
const int inf = INT_MAX;
const int ninf = INT_MIN;
const int mod = 1e9 + 7;
const int maxN = 2e5 + 2;
vi adj[maxN];
vi live(maxN), hap(maxN), sum(maxN), good(maxN);
bool ok;
void dfs(int node, int par) {
  int sum_g = 0;
  sum[node] = live[node];
  for (auto i : adj[node]) {
    if (i == par) continue;
    dfs(i, node);
    sum_g += good[i];
    sum[node] += sum[i];
  }
  good[node] = (hap[node] + sum[node]) / 2;
  if ((hap[node] + sum[node]) & 1) {
    ok = 0;
  } else if (good[node] < 0 or good[node] > sum[node]) {
    ok = 0;
  } else if (sum_g > good[node]) {
    ok = 0;
  }
}
void solve() {
  int n, m;
  scanf("%d", &n);
  scanf("%d", &m);
  for (int i = (int)(1); i < (int)(n + 1); i++) scanf("%d", &live[i]);
  for (int i = (int)(1); i < (int)(n + 1); i++) scanf("%d", &hap[i]);
  for (int i = (int)(0); i < (int)(n + 1); i++) {
    adj[i].clear();
  }
  for (int i = (int)(0); i < (int)(n - 1); i++) {
    int a, b;
    scanf("%d", &a);
    scanf("%d", &b);
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  ok = 1;
  dfs(1, 0);
  puts(ok ? "YES" : "NO");
}
int main() {
  int t = 1;
  scanf("%d", &t);
  while (t--) {
    solve();
  }
  return 0;
}
