#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int P[N], H[N], T[N], B[N], visited[N];
int dfs(vector<vector<int> >& E, int i) {
  visited[i] = 1;
  T[i] = P[i];
  for (auto& it : E[i])
    if (!visited[it]) T[i] += dfs(E, it);
  return T[i];
}
int main() {
  ios_base::sync_with_stdio(false);
  int t;
  cin >> t;
  while (t--) {
    int n, m;
    cin >> n >> m;
    for (int i(0), _n(n); i < _n; ++i) cin >> P[i];
    for (int i(0), _n(n); i < _n; ++i) cin >> H[i];
    vector<vector<int> > E(n);
    for (int i(0), _n(n - 1); i < _n; ++i) {
      int x, y;
      cin >> x >> y;
      --x, --y;
      E[x].push_back(y);
      E[y].push_back(x);
    }
    for (int i(0), _n(n); i < _n; ++i) T[i] = 0, visited[i] = 0;
    dfs(E, 0);
    int f = 1;
    for (int i(0), _n(n); i < _n; ++i) visited[i] = 0;
    deque<int> q;
    q.push_back(0);
    while (!q.empty()) {
      int i = q.front();
      visited[i] = 1;
      q.pop_front();
      if (abs(H[i]) > T[i] || abs(H[i]) % 2 != T[i] % 2) {
        f = 0;
        break;
      }
      B[i] = (T[i] - H[i]) / 2;
      for (auto& it : E[i])
        if (!visited[it]) q.push_back(it);
    }
    if (f == 0) {
      printf("NO\n");
      continue;
    }
    for (int i(0), _n(n); i < _n; ++i) visited[i] = 0;
    q.push_back(0);
    while (!q.empty()) {
      int i = q.front();
      visited[i] = 1;
      q.pop_front();
      long long cb = 0;
      for (auto& it : E[i])
        if (!visited[it]) {
          q.push_back(it);
          cb += B[it];
        }
      if (B[i] - P[i] > cb) {
        f = 0;
        break;
      }
    }
    if (f)
      printf("YES\n");
    else
      printf("NO\n");
  }
  return 0;
}
