#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
long long p[N], h[N], happy[N], cnt[N];
bool ans = true;
void dfs(vector<int>* tree, int curr, int par) {
  long long happy_below = 0;
  long long countNodes = 0;
  for (int child : tree[curr]) {
    if (child == par) continue;
    dfs(tree, child, curr);
    if (!ans) return;
    happy_below += happy[child];
    countNodes += cnt[child];
  }
  cnt[curr] = countNodes + p[curr];
  if ((cnt[curr] + h[curr]) < 0 || (cnt[curr] - h[curr]) < 0) ans = false;
  if ((cnt[curr] + h[curr]) % 2 != 0) ans = false;
  happy[curr] = (cnt[curr] + h[curr]) / 2;
  if (happy_below > happy[curr]) ans = false;
  return;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, m;
    cin >> n >> m;
    vector<int> tree[n + 1];
    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 a, b;
      cin >> a >> b;
      tree[a].push_back(b);
      tree[b].push_back(a);
    }
    dfs(tree, 1, -1);
    if (ans == false)
      cout << "NO" << endl;
    else
      cout << "YES" << endl;
    for (int i = 1; i <= n; i++) {
      p[i] = 0;
      h[i] = 0;
      happy[i] = 0;
      cnt[i] = 0;
      ans = true;
    }
  }
}
