#include <bits/stdc++.h>
using namespace std;
const long long int N = 1e5 + 5;
vector<long long int> adj[N];
bool poss = 1;
long long int p[N], h[N], tot[N], b[N], g[N];
void dfs(long long int z, long long int par) {
  long long int badchild = 0;
  tot[z] = p[z];
  for (long long int x : adj[z]) {
    if (x == par) continue;
    dfs(x, z);
    tot[z] += tot[x];
    badchild += b[x];
  }
  if (h[z] > tot[z]) poss = 0;
  if (h[z] < -tot[z]) poss = 0;
  if ((tot[z] + h[z]) % 2) poss = 0;
  g[z] = (tot[z] + h[z]) / 2;
  b[z] = (tot[z] - h[z]) / 2;
  if (b[z] > p[z] + badchild) poss = 0;
}
void solve() {
  long long int n, m, i;
  cin >> n >> m;
  poss = 1;
  for (i = 1; i <= n; i++) {
    adj[i].clear();
    cin >> p[i];
  }
  for (i = 1; i <= n; i++) cin >> h[i];
  for (i = 0; i < n - 1; i++) {
    long long int u, v;
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  dfs(1, 0);
  if (poss == 0)
    cout << "NO"
         << "\n";
  else
    cout << "YES"
         << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long int t = 1;
  cin >> t;
  while (t--) solve();
  return 0;
}
