#include <bits/stdc++.h>
using namespace std;
using pint = pair<int, int>;
using ll = long long;
using ull = unsigned long long;
using vll = vector<long long>;
using pll = pair<ll, ll>;
constexpr ll INF = 1e15 + 7LL;
constexpr ll MOD = 1e9 + 7LL;
template <typename T>
istream &operator>>(istream &is, vector<T> &v) {
  for (int i = 0; i < v.size(); ++i) {
    is >> v[i];
  }
  return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  if (v.size() == 0) return os;
  for (int i = 0; i < v.size() - 1; ++i) {
    os << v[i] << " ";
  }
  os << v[v.size() - 1];
  return os;
}
int main() {
  int t;
  cin >> t;
  vector<int> pos;
  for (int iii = (0), iii_end_ = (t); iii < iii_end_; iii++) {
    ll n, m;
    cin >> n >> m;
    vll p(n), h(n);
    cin >> p >> h;
    vll x(n - 1), y(n - 1);
    for (int i = (0), i_end_ = (n - 1); i < i_end_; i++) {
      cin >> x[i] >> y[i];
      x[i]--;
      y[i]--;
      if (y[i] < x[i]) swap(x[i], y[i]);
    }
    vector<vector<int> > G(n);
    for (int i = (0), i_end_ = (n - 1); i < i_end_; i++) {
      G[x[i]].push_back(y[i]);
      G[y[i]].push_back(x[i]);
    }
    vector<int> leaves;
    for (int i = (1), i_end_ = (n); i < i_end_; i++) {
      if (G[i].size() == 1) {
        leaves.push_back(i);
      }
    }
    vector<int> dist(n, -1);
    queue<int> que;
    que.push(0);
    dist[0] = 0;
    while (que.size()) {
      int now = que.front();
      que.pop();
      for (int elem : G[now]) {
        if (dist[elem] == -1) {
          dist[elem] = dist[now] + 1;
          que.push(elem);
        }
      }
    }
    map<ll, vector<int> > madis;
    for (int i = (0), i_end_ = (n); i < i_end_; i++) {
      madis[dist[i]].push_back(i);
    }
    vll nump(n, 0);
    for (int i = (0), i_end_ = (n); i < i_end_; i++) {
      nump[i] = p[i];
    }
    for (auto ite = madis.rbegin(); ite != madis.rend(); ++ite) {
      ll nowdis = ite->first;
      vector<int> &nowinds = ite->second;
      for (int elem : nowinds) {
        for (int to : G[elem]) {
          if (dist[to] + 1 == nowdis) {
            nump[to] += nump[elem];
            continue;
          }
        }
      }
    }
    bool flag = false;
    vll vecestp(n), vecestm(n);
    for (int elem = (0), elem_end_ = (n); elem < elem_end_; elem++) {
      ll twop = nump[elem] + h[elem], twom = nump[elem] - h[elem];
      if (twop < 0 || twom < 0 || twop % 2 == 1 || twom % 2 == 1) {
        flag = true;
        break;
      }
      vecestp[elem] = twop / 2, vecestm[elem] = twom / 2;
    }
    if (flag) {
      cout << "NO"
           << "\n";
      continue;
    }
    for (auto ite = madis.begin(); ite != madis.end(); ++ite) {
      ll nowdis = ite->first;
      vector<int> &nowinds = ite->second;
      for (int elem : nowinds) {
        ll motop = vecestp[elem], motom = vecestm[elem];
        ll becp = 0, becm = 0, cnt = 0;
        for (int to : G[elem]) {
          if (nowdis + 1 == dist[to]) {
            becp += vecestp[to];
            becm += vecestm[to];
            ++cnt;
          }
        }
        if (cnt > 0 && becm < motom - p[elem]) {
          flag = true;
          break;
        }
      }
      if (flag) break;
    }
    if (flag) {
      cout << "NO"
           << "\n";
      continue;
    } else {
      cout << "YES"
           << "\n";
    }
  }
}
