#include <bits/stdc++.h>
using namespace std;
int NMAX = 1000000;
vector<vector<int>> edg(NMAX);
vector<int> a(NMAX), h(NMAX);
vector<int> temp(NMAX), fake(NMAX);
int ans = 1;
void dfs(int u, int v) {
  temp[u] = a[u];
  int subtree = 0;
  for (int i = 0; i < edg[u].size(); i++) {
    if (edg[u][i] == v) {
      continue;
    }
    dfs(edg[u][i], u);
    temp[u] += temp[edg[u][i]];
    subtree += fake[edg[u][i]];
  }
  if ((temp[u] + h[u]) % 2 == 0) {
  } else {
    ans = 0;
  }
  fake[u] = (temp[u] + h[u]) / 2;
  if (fake[u] >= 0 && fake[u] <= temp[u]) {
  } else {
    ans = 0;
  }
  if (subtree <= fake[u]) {
  } else {
    ans = 0;
  }
}
void solve() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> h[i];
  }
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    cin >> u >> v;
    u--;
    v--;
    edg[u].push_back(v);
    edg[v].push_back(u);
  }
  dfs(0, -1);
  if (ans) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  for (int i = 0; i < n; i++) {
    edg[i].clear();
  }
}
int main() {
  int t;
  cin >> t;
  while (t) {
    t--;
    ans = 1;
    solve();
  }
}
