#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 7;
long long n, m;
vector<long long> p(N);
vector<long long> h(N);
vector<long long> graf[N];
bool access = true;
long long a[N], g[N];
void dfs(long long v, long long anc = -1) {
  a[v] = p[v];
  long long sum = 0;
  for (long long to : graf[v]) {
    if (to == anc) continue;
    dfs(to, v);
    sum += g[to];
    a[v] += a[to];
  }
  if ((a[v] + h[v]) % 2 == 0) {
  } else
    access = false;
  g[v] = (a[v] + h[v]) / 2;
  if (g[v] >= 0 && g[v] <= a[v]) {
  } else
    access = false;
  if (sum <= g[v]) {
  } else
    access = false;
}
int main() {
  long long t;
  cin >> t;
  while (t--) {
    cin >> n >> m;
    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 a1, b1;
      cin >> a1 >> b1;
      a1--;
      b1--;
      graf[a1].push_back(b1);
      graf[b1].push_back(a1);
    }
    dfs(0);
    if (access)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
    access = true;
    for (long long i = 0; i < n; i++) graf[i].clear();
  }
  return 0;
}
