#include <bits/stdc++.h>
using namespace std;
long long p[100001];
long long h[100001];
vector<int> v[100001];
long long score[100001];
bool f = true;
int dfs(int x, int pre) {
  long long temp = p[x];
  for (auto y : v[x]) {
    if (y == pre) continue;
    temp += dfs(y, x);
  }
  score[x] = temp;
  return temp;
}
int dfs2(int x, int pre) {
  long long temp = (score[x] - h[x]) / 2;
  long long temp2 = 0;
  for (auto y : v[x]) {
    if (y == pre) continue;
    temp2 += dfs2(y, x);
  }
  if (temp2 < (temp - p[x])) {
    f = false;
  }
  return temp;
}
void solve() {
  f = true;
  int n;
  long long m;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> p[i + 1];
    v[i + 1].clear();
    score[i + 1] = 0;
  }
  for (int i = 0; i < n; i++) {
    cin >> h[i + 1];
  }
  for (int i = 0; i < n - 1; i++) {
    int x, y;
    cin >> x >> y;
    v[x].push_back(y);
    v[y].push_back(x);
  }
  dfs(1, 1);
  for (int i = 0; i < n; i++) {
    if (abs(h[i + 1]) > score[i + 1] || abs(score[i + 1] - h[i + 1]) % 2 == 1) {
      cout << "NO"
           << "\n";
      return;
    }
  }
  dfs2(1, 1);
  if (f) {
    cout << "YES"
         << "\n";
  } else {
    cout << "NO"
         << "\n";
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
}
