#include <bits/stdc++.h>
using namespace std;
long long pop[100001], h[100001], tot[100001];
bool visited[100001];
vector<long long> adj[100001];
bool comp(pair<long long, long long> a, pair<long long, long long> b) {
  if (a.second == b.second) return a.first > b.first;
  return a.second > b.second;
}
long long countTotal(long long root) {
  visited[root] = true;
  tot[root] = pop[root];
  long long flag = 0;
  long long ans = 0;
  for (long long i = 0; i < adj[root].size(); i++) {
    long long sib = adj[root][i];
    if (!visited[sib]) {
      flag = 1;
      tot[root] += countTotal(sib);
    }
  }
  return tot[root];
}
pair<long long, long long> dfs(long long root) {
  visited[root] = true;
  long long flag = 0;
  long long ans = 0;
  long long totBad = 0;
  for (long long i = 0; i < adj[root].size(); i++) {
    long long sib = adj[root][i];
    if (!visited[sib]) {
      flag = 1;
      pair<long long, long long> pp = dfs(sib);
      if (pp.first != 1000000000000000) {
        ans += pp.first;
        totBad += pp.second;
      } else
        return make_pair(1000000000000000, 1000000000000000);
    }
  }
  if (!flag) {
    if (h[root] <= tot[root] && h[root] >= (0 - tot[root]) &&
        ((pop[root] - h[root]) % 2 == 0)) {
      long long good = (h[root] + tot[root]) % 2;
      long long bad = tot[root] - good;
      return make_pair(h[root], bad);
    } else
      return make_pair(1000000000000000, 1000000000000000);
  } else {
    if (h[root] <= tot[root] && h[root] >= (0 - tot[root]) &&
        h[root] >= (ans - pop[root]) && (h[root] + tot[root]) % 2 == 0) {
      long long good = (h[root] + tot[root]) % 2;
      long long bad = tot[root] - good;
      if (bad >= totBad) return make_pair(h[root], bad);
      return make_pair(1000000000000000, 1000000000000000);
    } else {
      return make_pair(1000000000000000, 1000000000000000);
    }
  }
}
int main() {
  long long t;
  cin >> t;
  while (t--) {
    memset(visited, false, sizeof(visited));
    for (long long i = 0; i < 100001; i++) adj[i].clear();
    long long n, m;
    cin >> n >> m;
    for (long long i = 1; i <= n; i++) cin >> pop[i];
    for (long long i = 1; i <= n; i++) cin >> h[i];
    for (long long i = 0; i < n - 1; i++) {
      long long l, r;
      cin >> l >> r;
      adj[l].push_back(r);
      adj[r].push_back(l);
    }
    countTotal(1);
    memset(visited, false, sizeof(visited));
    if (dfs(1).first != 1000000000000000)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
}
