#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 vis;
ii solve(int i) {
  int tot_people = p[i];
  int good = 0;
  vis[i] = true;
  for (auto x : adj[i]) {
    if (vis[x]) continue;
    auto temp = solve(x);
    if (temp.first == -1) {
      return temp;
    }
    tot_people += temp.first;
    good += temp.second;
  }
  int good_calculated = (tot_people + h[i]) / 2;
  if (good_calculated > tot_people || (tot_people + h[i]) % 2 ||
      good > good_calculated) {
    return make_pair(-1, -1);
  } else {
    return make_pair(tot_people, good_calculated);
  }
}
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);
    vis.clear();
    vis.resize(n);
    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);
    }
    auto ans = solve(0);
    if (ans.first != -1) {
      cout << "YES"
           << "\n";
    } else {
      cout << "NO"
           << "\n";
    }
  }
  return 0;
}
