#include <bits/stdc++.h>
using namespace std;
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
void fst() {
  ios::sync_with_stdio(0);
  cin.tie(0);
}
int mod = 1e9 + 7;
int binpow(int a, int b) {
  int res = 1;
  while (b > 0) {
    if (b & 1) {
      res = res * a;
      res %= mod;
    }
    a = a * a;
    a %= mod;
    b >>= 1;
    b %= mod;
  }
  return res;
}
int n, k, m, tc, x, y, u, v;
int MS = 1e5;
int32_t main() {
  fst();
  cin >> tc;
  while (tc--) {
    cin >> n >> m;
    vector<vector<int> > adj(n + 1);
    vector<int> par(n + 1), good_child(n + 1), bad(n + 1), total(n + 1),
        good(n + 1), h(n + 1), p(n + 1), vis(n + 1);
    for (int i = 0; i < n; i++) cin >> p[i + 1];
    for (int i = 0; i < n; i++) cin >> h[i + 1];
    for (int i = 0; i < n - 1; i++) {
      cin >> x >> y;
      adj[x].push_back(y);
      adj[y].push_back(x);
    }
    par[1] = 0;
    vis[1] = true;
    queue<int> q;
    stack<int> st;
    q.push(1);
    st.push(1);
    while (!q.empty()) {
      int s = q.front();
      vis[s] = true;
      q.pop();
      for (auto u : adj[s]) {
        if (vis[u]) continue;
        par[u] = s;
        vis[u] = true;
        q.push(u);
        st.push(u);
      }
    }
    int fl = 1;
    while (st.size() != 0) {
      int tp = st.top();
      p[par[tp]] += p[tp];
      good[tp] = (p[tp] + h[tp]) / 2;
      bad[tp] = (p[tp] - h[tp]) / 2;
      good_child[par[tp]] += good[tp];
      if (abs(h[tp]) > p[tp] || good_child[tp] > good[tp] ||
          (p[tp] + h[tp]) % 2 == 1)
        fl = 0;
      st.pop();
    }
    if (fl) {
      cout << "YES\n";
    } else {
      cout << "NO\n";
    }
  }
}
