#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> v(100005);
long long people[100005], happy[100005], sub[100005], good[100005], par[100005];
long long dfs(int u, int p) {
  par[u] = p;
  long long sum = people[u];
  for (auto it : v[u]) {
    if (it != p) {
      sum += dfs(it, u);
    }
  }
  sub[u] = sum;
  return sum;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, m;
    cin >> n >> m;
    for (int i = 1; i <= n; i++) {
      cin >> people[i];
      sub[i] = 0;
      v[i].clear();
    }
    for (int i = 1; i <= n; i++) {
      cin >> happy[i];
    }
    for (int i = 1; i <= n - 1; i++) {
      int x, y;
      cin >> x >> y;
      v[x].push_back(y);
      v[y].push_back(x);
    }
    long long total = dfs(1, -1);
    int ch = 0;
    for (int i = 1; i <= n; i++) {
      long long total = sub[i] + happy[i];
      if (total % 2 != 0) {
        ch++;
        break;
      }
      long long x1 = total / 2;
      if (x1 < 0 || x1 > sub[i]) {
        ch++;
        break;
      }
      long long x2 = 0;
      for (auto it : v[i]) {
        if (it != par[i]) {
          long long total2 = sub[it] + happy[it];
          if (total2 % 2 != 0) {
            ch++;
            break;
          }
          long long temp = total2 / 2;
          if (temp < 0 || temp > sub[it]) {
            ch++;
            break;
          }
          x2 += total2 / 2;
        }
      }
      if (x2 > x1) {
        ch++;
        break;
      }
    }
    if (ch == 0) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
}
