#include <bits/stdc++.h>
using namespace std;
const long long MXN = 2e5 + 10;
long long q, n, m;
long long P[MXN], H[MXN], Hap[MXN], Sad[MXN], sub[MXN];
bool NO = 0;
vector<long long> adj[MXN];
inline bool check(long long x, long long t) { return (x >= 0 && x <= t); }
void pre_dfs(long long u, long long par) {
  sub[u] = P[u];
  for (auto v : adj[u]) {
    if (v != par) pre_dfs(v, u), sub[u] += sub[v];
  }
}
void dfs(long long u, long long par) {
  for (auto v : adj[u]) {
    if (v == par) continue;
    if (Hap[u] < Hap[v]) NO = 1;
    Hap[u] -= Hap[v];
    long long rem = Sad[v] - min(Sad[v], Sad[u]);
    Sad[u] -= min(Sad[v], Sad[u]);
    if (Hap[u] < rem) NO = 1;
    Hap[u] -= rem;
    dfs(v, u);
  }
}
void solve() {
  cin >> n >> m, NO = 0;
  for (int i = 1; i <= n; i++) cin >> P[i];
  for (int i = 1; i <= n; i++) cin >> H[i], adj[i].clear();
  for (int i = 1; i <= n - 1; i++) {
    long long u, v;
    cin >> u >> v;
    adj[u].push_back(v), adj[v].push_back(u);
  }
  pre_dfs(1, -1);
  for (int u = 1; u <= n; u++) {
    Hap[u] = (H[u] + sub[u]) / 2;
    Sad[u] = (sub[u] - Hap[u]);
    if (!check(Sad[u], sub[u]) || !check(Hap[u], sub[u]) ||
        ((H[u] + sub[u]) % 2 == 1) || ((H[u] + sub[u]) % 2 == -1))
      NO = 1;
  }
  dfs(1, -1);
  cout << (NO ? "NO" : "YES") << '\n';
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> q;
  while (q--) solve();
  return 0;
}
