#include <bits/stdc++.h>
using ll = long long;
using namespace std;
template <class T>
struct Edge {
  int src, dest;
  T cost;
  explicit Edge(int src, int dest, T cost) : src(src), dest(dest), cost(cost) {}
  bool operator<(const Edge<T> &other) const { return cost < other.cost; }
};
template <class T>
using Graph = std::vector<std::vector<Edge<T>>>;
template <class T>
using Edges = std::vector<Edge<T>>;
template <class T>
Graph<T> make_graph(int V, int E, int one_indexed = 1, bool digraph = 0,
                    bool weighted = 0) {
  Graph<T> graph(V);
  int u, v;
  T c = 1;
  for (int i = 0; i < E; ++i) {
    std::cin >> u >> v;
    if (weighted) std::cin >> c;
    graph[u - one_indexed].emplace_back(u - one_indexed, v - one_indexed, c);
    if (!digraph)
      graph[v - one_indexed].emplace_back(v - one_indexed, u - one_indexed, c);
  }
  return graph;
}
ll rec(int v, int par, Graph<int> &adj, vector<ll> &pop) {
  for (auto &e : adj[v])
    if (e.dest != par) {
      pop[v] += rec(e.dest, v, adj, pop);
    }
  return pop[v];
}
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  int t;
  cin >> t;
  for (int _ = 0, _Len = (t); _ < _Len; ++_) {
    ll n, m;
    cin >> n >> m;
    vector<ll> pop(n), happy(n);
    for (int i = 0, iLen = (n); i < iLen; ++i) cin >> pop[i];
    for (int i = 0, iLen = (n); i < iLen; ++i) cin >> happy[i];
    auto tree = make_graph<int>(n, n - 1);
    rec(0, -1, tree, pop);
    bool ok = 1;
    for (int i = 0, iLen = (n); i < iLen; ++i)
      if (abs(happy[i]) > pop[i] || (abs(happy[i]) & 1) != (abs(pop[i]) & 1)) {
        ok = 0;
        break;
      }
    if (ok) {
      deque<pair<ll, ll>> dq;
      dq.emplace_back(0, -1);
      while (!dq.empty()) {
        auto [v, par] = dq.front();
        dq.pop_front();
        ll good = 0, bad = 0;
        ll cpop = 0;
        for (auto &e : tree[v])
          if (e.dest != par) {
            good += happy[e.dest] + (pop[e.dest] - happy[e.dest]) / 2;
            bad += (pop[e.dest] - happy[e.dest]) / 2;
            cpop += pop[e.dest];
            dq.emplace_back(e.dest, v);
          }
        if (cpop && good - bad - (pop[v] - cpop) > happy[v]) {
          ok = 0;
          break;
        }
      }
    }
    cout << (ok ? "YES" : "NO") << "\n";
  }
}
