#include <bits/stdc++.h>
using namespace std;
const int CONST = 1e9 + 7;
const int MAX = 100005;
const double pi = 3.14159265358979323846;
int n, m;
vector<int> pop(MAX);
vector<int> hap(MAX);
vector<int> adj[MAX];
vector<int> totals(MAX, 0);
vector<bool> vis(MAX, false);
vector<int> good(MAX, 0), bad(MAX, 0);
bool ans = true;
bool solve(int node, int par) {
  if (vis[node]) return false;
  vis[node] = true;
  int chbad = 0, chgood = 0;
  int total = pop[node];
  for (auto &child : adj[node]) {
    if (child != par) {
      if (solve(child, node)) {
        return true;
      }
      total += totals[child];
      chbad += bad[child];
      chgood += good[child];
    }
  }
  totals[node] = total;
  if ((hap[node] + total) & 1 == 1) {
    ans = false;
    return true;
  }
  good[node] = (total + hap[node]) / 2;
  bad[node] = total - good[node];
  if (good[node] < 0 || bad[node] < 0 || good[node] > total ||
      bad[node] > total) {
    ans = false;
    return true;
  }
  if (adj[node].size() == 0) {
    return false;
  }
  long long int badleft, goodleft;
  if (pop[node] - bad[node] < 0) {
    badleft = bad[node] - pop[node];
    goodleft = good[node];
  } else {
    badleft = 0;
    goodleft = good[node] - (pop[node] - bad[node]);
  }
  if (badleft > chbad) {
    ans = false;
    return true;
  }
  if (goodleft < chbad - badleft + chgood) {
    ans = false;
    return true;
  }
  return false;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long t;
  cin >> t;
  while (t--) {
    cin >> n >> m;
    for (int i = 1; i < n + 1; ++i) {
      cin >> pop[i];
    }
    for (int i = 1; i < n + 1; ++i) {
      cin >> hap[i];
    }
    for (int i = 0; i < n - 1; ++i) {
      int u, v;
      cin >> u >> v;
      adj[u].push_back(v);
      adj[v].push_back(u);
    }
    solve(1, -1);
    for (int i = 1; i < n + 1; ++i) {
      adj[i].clear();
      vis[i] = false;
    }
    if (ans)
      cout << "YES\n";
    else
      cout << "NO\n";
    ans = true;
  }
  return 0;
}
