#include <bits/stdc++.h>
using namespace std;
long long int n, m, k, x, u, v;
vector<long long int> adj[100005];
long long int cnt[100005];
long long int h[100005];
long long int P[100005];
long long int S[100005];
long long int a[100005];
long long int b[100005];
string ans = "";
void reset() {
  for (long long int i = 0; i < n + 1; i++) {
    adj[i].clear();
    P[i] = 0;
    cnt[i] = 0;
    a[i] = b[i] = S[i] = 0;
    h[i] = 0;
    cnt[i] = 0;
  }
}
void dfs(long long int u) {
  S[u] = cnt[u];
  for (long long int v : adj[u]) {
    if (v != P[u]) {
      P[v] = u;
      dfs(v);
      S[u] += S[v];
    }
  }
}
void check(long long int u) {
  if (h[u] % 2 != 0 ^ S[u] % 2 != 0) {
    ans = "NO";
    return;
  }
  a[u] = (S[u] + h[u]) / 2;
  b[u] = (S[u] - h[u]) / 2;
  if (a[u] < 0 || b[u] < 0) {
    ans = "NO";
    return;
  }
  for (long long int v : adj[u]) {
    if (v != P[u]) check(v);
  }
  long long int a_subtree = 0;
  for (long long int v : adj[u]) {
    if (v != P[u]) a_subtree += a[v];
  }
  if (a_subtree > a[u]) {
    ans = "NO";
    return;
  }
}
void purple18() {
  ans = "YES";
  cin >> n >> m;
  for (long long int i = 1; i <= n; i++) {
    cin >> cnt[i];
  }
  for (long long int i = 1; i <= n; i++) {
    cin >> h[i];
  }
  for (long long int i = 0; i < n - 1; i++) {
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  dfs(1);
  check(1);
  cout << ans << "\n";
  reset();
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long int t = 1;
  cin >> t;
  while (t--) purple18();
}
