#include <bits/stdc++.h>
using namespace std;
vector<long long> h;
vector<long long> p;
vector<vector<long long> > graph;
vector<long long> cnt;
bool flag;
vector<bool> used;
void speed_up() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}
struct vect {
  long long sad = 0;
  long long good = 0;
  long long col = 0;
};
vect dfs(long long ind) {
  used[ind] = true;
  long long d = 0, sad = 0, good = 0;
  for (auto i : graph[ind]) {
    if (used[i]) continue;
    vect ans = dfs(i);
    d += ans.col;
    sad += ans.sad;
    good += ans.good;
  }
  cnt[ind] = d + p[ind];
  vect now;
  now.col = d + p[ind];
  if ((now.col + h[ind]) % 2 != 0) {
    flag = true;
  }
  now.good = (now.col + h[ind]) / 2;
  now.sad = now.col - now.good;
  if (good + sad != d || now.sad < 0 || now.good < 0 || now.good < good) {
    flag = true;
  }
  return now;
}
signed main() {
  speed_up();
  long long t;
  cin >> t;
  for (long long _ = 0; _ < t; _++) {
    long long n, m;
    cin >> n >> m;
    h.resize(n);
    p.resize(n);
    graph.clear();
    graph.resize(n);
    cnt.resize(n);
    used.assign(n, false);
    flag = false;
    for (long long i = 0; i < n; i++) cin >> p[i];
    for (long long i = 0; i < n; i++) cin >> h[i];
    for (long long i = 0; i < n - 1; i++) {
      long long x, y;
      cin >> x >> y;
      x--;
      y--;
      graph[x].push_back(y);
      graph[y].push_back(x);
    }
    dfs(0);
    if (flag) {
      cout << "NO\n";
    } else {
      cout << "YES\n";
    }
  }
}
