#include <bits/stdc++.h>
using namespace std;
int dfs(int v, vector<vector<int> > &adj, vector<bool> &vis, vector<int> &p,
        vector<int> &q, vector<int> &h, bool &check) {
  vis[v] = true;
  q[v] = p[v];
  int sum = 0;
  for (int i = 0; i < adj[v].size(); i++)
    if (!vis[adj[v][i]]) {
      sum += dfs(adj[v][i], adj, vis, p, q, h, check);
      q[v] += q[adj[v][i]];
    }
  int curr = 0;
  if (q[v] % 2 == abs(h[v]) % 2 && q[v] + h[v] >= 0 && q[v] >= abs(h[v])) {
    curr = (q[v] + h[v]) / 2;
  } else
    check = false;
  if (curr < sum) check = false;
  return curr;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, m;
    cin >> n >> m;
    vector<int> p(n + 1), h(n + 1);
    for (int i = 1; i <= n; i++) cin >> p[i];
    for (int i = 1; i <= n; i++) cin >> h[i];
    vector<vector<int> > adj(n + 1);
    for (int i = 0; i < n - 1; i++) {
      int x, y;
      cin >> x >> y;
      adj[x].push_back(y);
      adj[y].push_back(x);
    }
    vector<int> q(n + 1);
    vector<bool> vis(n + 1);
    bool check = true;
    dfs(1, adj, vis, p, q, h, check);
    if (check)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}
