#include <bits/stdc++.h>
using namespace std;
int n, m;
vector<int> p, h, st;
vector<vector<int>> adj;
int gst(int curr, int prev) {
  int res = p[curr];
  for (int next : adj[curr]) {
    if (next != prev) {
      res += gst(next, curr);
    }
  }
  return st[curr] = res;
}
int dfs(int curr, int prev, int& res) {
  int g = st[curr] + h[curr];
  if (g % 2) res = 0;
  int gv = g / 2;
  if (gv < 0 || gv > st[curr]) res = 0;
  int cgv = 0;
  for (int next : adj[curr]) {
    if (next != prev) {
      cgv += dfs(next, curr, res);
    }
  }
  if (cgv > gv) res = 0;
  return gv;
}
string solve() {
  cin >> n >> m;
  adj.clear();
  adj.resize(n + 1);
  p.assign(n + 1, 0);
  h.assign(n + 1, 0);
  st.assign(n + 1, 0);
  for (int i = 1; i <= n; i++) cin >> p[i];
  for (int i = 1; i <= n; i++) cin >> h[i];
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  gst(1, 0);
  int res = 1;
  dfs(1, 0, res);
  if (!res) return "NO";
  return "YES";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    cout << solve() << '\n';
  }
  return 0;
}
