#include <bits/stdc++.h>
using namespace std;
const int N = 100001;
vector<int> a[N];
int n, p[N], h[N], nrd[N], nf[N];
bool viz[N], rez;
void dfs(int x) {
  viz[x] = true;
  nrd[x] = p[x];
  int sum_nf = 0;
  for (auto y : a[x]) {
    if (!viz[y]) {
      dfs(y);
      nrd[x] += nrd[y];
      sum_nf += nf[y];
    }
  }
  if ((nrd[x] + h[x]) % 2 != 0) {
    rez = false;
  }
  if (h[x] < -nrd[x] || h[x] > nrd[x]) {
    rez = false;
  }
  nf[x] = (nrd[x] - h[x]) / 2;
  if (nf[x] - p[x] > sum_nf) {
    rez = false;
  }
}
int main() {
  int t;
  cin >> t;
  for (int i = 0; i < t; i++) {
    int m;
    cin >> n >> m;
    for (int i = 1; i <= n; i++) {
      a[i].clear();
      viz[i] = false;
    }
    for (int i = 1; i <= n; i++) {
      cin >> p[i];
    }
    for (int i = 1; i <= n; i++) {
      cin >> h[i];
    }
    for (int i = 1; i < n; i++) {
      int x, y;
      cin >> x >> y;
      a[x].push_back(y);
      a[y].push_back(x);
    }
    rez = true;
    dfs(1);
    if (rez) {
      cout << "YES\n";
    } else {
      cout << "NO\n";
    }
  }
  return 0;
}
