#include <bits/stdc++.h>
using namespace std;
long long happy(long long pt, long long hi) {
  if ((pt + hi) % 2 != 0)
    return -1;
  else
    return (pt + hi) / 2;
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long t;
  cin >> t;
  while (t--) {
    long long n, k;
    cin >> n >> k;
    vector<long long> pops(n + 1, 0);
    vector<long long> hindex(n + 1, 0);
    vector<long long> freqs(n + 1, 0);
    vector<long long> pathsthru(n + 1, 0);
    for (long long i = 1; i <= n; ++i) {
      cin >> pops[i];
      pathsthru[i] = pops[i];
    }
    for (long long i = 1; i <= n; ++i) cin >> hindex[i];
    vector<long long> adj[n + 1];
    for (long long i = 0; i < n - 1; ++i) {
      long long a, b;
      cin >> a >> b;
      adj[a].push_back(b);
      adj[b].push_back(a);
      freqs[a]++;
      freqs[b]++;
    }
    vector<long long> leaves;
    for (long long i = 1; i <= n; ++i) {
      if (freqs[i] == 1) {
        leaves.push_back(i);
      }
    }
    queue<long long> q;
    vector<bool> visited(n + 1, 0);
    visited[1] = true;
    vector<long long> parent(n + 1, -1);
    parent[1] = 0;
    q.push(1);
    while (!q.empty()) {
      long long cur = q.front();
      q.pop();
      long long s = adj[cur].size();
      for (long long i = 0; i < adj[cur].size(); ++i) {
        long long next = adj[cur][i];
        if (!visited[next]) {
          visited[next] = true;
          parent[next] = cur;
          q.push(next);
        }
      }
    }
    vector<long long> visitedq(n + 1, 0);
    queue<long long> qq;
    for (long long l : leaves) {
      qq.push(l);
    }
    while (!qq.empty()) {
      long long cur = qq.front();
      qq.pop();
      long long p = parent[cur];
      visitedq[p]++;
      pathsthru[p] += pathsthru[cur];
      if (cur != 1 && visitedq[p] == freqs[p] - 1) {
        qq.push(parent[cur]);
      }
    }
    vector<long long> happynum(n + 1, 0);
    for (long long i = 1; i <= n; ++i) {
      happynum[i] = happy(pathsthru[i], hindex[i]);
    }
    queue<long long> qqq;
    vector<bool> visitedqq(n + 1, 0);
    visitedqq[1] = true;
    qqq.push(1);
    bool answer = true;
    while (!qqq.empty()) {
      long long cur = qqq.front();
      qqq.pop();
      if (!answer) continue;
      long long s = adj[cur].size();
      long long temp = 0;
      for (long long i = 0; i < s; ++i) {
        if (adj[cur][i] != parent[cur]) {
          temp += happynum[adj[cur][i]];
        }
      }
      if (happynum[cur] < temp || happynum[cur] > pathsthru[cur]) {
        answer = false;
      }
      for (long long i = 0; i < adj[cur].size(); ++i) {
        long long next = adj[cur][i];
        if (!visitedqq[next]) {
          visitedqq[next] = true;
          qqq.push(next);
        }
      }
    }
    if (answer)
      cout << "YES" << '\n';
    else
      cout << "NO" << '\n';
  }
}
