#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using uint = unsigned int;
using ull = unsigned long long;
using ii = pair<int, int>;
using pli = pair<ll, int>;
using vi = vector<int>;
using vll = vector<ll>;
using pll = pair<ll, ll>;
using pil = pair<int, ll>;
using vvi = vector<vi>;
using vpi = vector<ii>;
const int N = 100100;
ll mod = 1000000007;
vvi adj;
vi p, h;
int n, m;
vi good;
vi tot_people;
bool ok = true;
void dfs(int node, int parent) {
  int sum_good = 0;
  tot_people[node] = p[node];
  for (auto x : adj[node]) {
    if (x == parent) continue;
    dfs(x, node);
    sum_good += good[x];
    tot_people[node] += tot_people[x];
  }
  if ((tot_people[node] + h[node]) % 2) {
    ok = false;
  }
  good[node] = (tot_people[node] + h[node]) / 2;
  if (good[node] < sum_good) {
    ok = false;
  }
  if (good[node] > tot_people[node]) {
    ok = false;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int tt;
  cin >> tt;
  while (tt--) {
    int n, m;
    cin >> n >> m;
    adj.resize(n);
    for (int i = 0; i <= n - 1; i++) adj[i].clear();
    p.clear();
    p.resize(n);
    good.clear();
    good.resize(n);
    tot_people.clear();
    tot_people.resize(n);
    ok = true;
    for (int i = 0; i <= n - 1; i++) cin >> p[i];
    assert(accumulate(p.begin(), p.end(), 0) == m);
    h.resize(n);
    for (int i = 0; i <= n - 1; i++) {
      cin >> h[i];
    }
    for (int i = 0; i <= n - 2; i++) {
      int x, y;
      cin >> x >> y;
      x--, y--;
      adj[x].push_back(y);
      adj[y].push_back(x);
    }
    dfs(0, -1);
    if (ok) {
      cout << "YES"
           << "\n";
    } else {
      cout << "NO"
           << "\n";
    }
  }
  return 0;
}
