#include <bits/stdc++.h>
using namespace std;
vector<vector<long long>> adj;
vector<long long> p, h;
vector<long long> pp, hh;
long long dfs1(long long s, long long par) {
  pp[s] = p[s];
  for (long long u : adj[s])
    if (u != par) {
      pp[s] += dfs1(u, s);
    }
  return pp[s];
}
bool flag = false;
long long dfs2(long long s, long long par) {
  long long x = 0;
  for (long long u : adj[s])
    if (u != par) {
      x += dfs2(u, s);
    }
  if (h[s] > pp[s] || h[s] < (x - p[s])) flag = true;
  if ((pp[s] % 2) != (abs(h[s]) % 2)) flag = true;
  return h[s];
}
signed main() {
  long long t = 1;
  cin >> t;
  while (t--) {
    long long n, m;
    cin >> n >> m;
    adj.clear();
    adj.assign(n + 1, vector<long long>());
    p.clear();
    h.clear();
    p.resize(n + 1);
    h.resize(n + 1);
    for (long long i = 1; i <= n; i++) cin >> p[i];
    for (long long i = 1; i <= n; i++) cin >> h[i];
    pp.clear();
    hh.clear();
    hh.resize(n + 1);
    pp.resize(n + 1);
    for (long long i = 0; i < n - 1; i++) {
      long long v, u;
      cin >> v >> u;
      adj[u].push_back(v);
      adj[v].push_back(u);
    }
    dfs1(1, -1);
    flag = false;
    dfs2(1, -1);
    if (flag)
      cout << "NO\n";
    else
      cout << "YES\n";
  }
}
