#include <bits/stdc++.h>
using namespace std;
bool isPossible = 1;
void dfs(int node, map<int, vector<int>> &g, int parent, vector<int> &total,
         vector<int> &bad, vector<int> &good, vector<int> &hp,
         vector<int> &ppl) {
  int badChild = 0;
  total[node] = ppl[node];
  for (int nbr : g[node]) {
    if (nbr == parent) {
      continue;
    }
    dfs(nbr, g, node, total, bad, good, hp, ppl);
    total[node] += total[nbr];
    badChild += bad[nbr];
  }
  if (hp[node] > total[node] or hp[node] < -total[node]) {
    isPossible = false;
  }
  if ((hp[node] + total[node]) % 2 != 0) {
    isPossible = false;
  }
  good[node] = (hp[node] + total[node]) / 2;
  bad[node] = (total[node] - hp[node]) / 2;
  if (bad[node] > ppl[node] + badChild) {
    isPossible = false;
  }
  return;
}
void countryHappiness() {
  int n, m;
  cin >> n >> m;
  vector<int> hp(n), ppl(n);
  for (int i = 0; i < n; i++) {
    cin >> ppl[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> hp[i];
  }
  map<int, vector<int>> g;
  for (int i = 1; i < n; i++) {
    int x, y;
    cin >> x >> y;
    x--, y--;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  isPossible = true;
  vector<int> bad(n), good(n), total(n);
  dfs(0, g, -1, total, bad, good, hp, ppl);
  if (isPossible) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}
void solve() { countryHappiness(); }
int main() {
  int T;
  cin >> T;
  while (T--) {
    solve();
  }
}
