#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int t;
  cin >> t;
  while (t--) {
    long long int n, m, asd = 1;
    cin >> n >> m;
    vector<long long int> p(n + 5), h(n + 5), visited(n + 5);
    vector<long long int> edge[n + 5];
    for (long long int i = 1; i <= n; i++) {
      cin >> p[i];
    }
    for (long long int i = 1; i <= n; i++) {
      cin >> h[i];
    }
    for (long long int i = 1; i < n; i++) {
      long long int a, b;
      cin >> a >> b;
      edge[a].push_back(b);
      edge[b].push_back(a);
    }
    function<long long int(long long int)> dfs =
        [&](long long int node) -> long long int {
      if (visited[node]) return 0;
      long long int sum, happy;
      sum = happy = 0;
      visited[node] = 1;
      for (auto it : edge[node]) {
        if (visited[it]) continue;
        long long int tmp = dfs(it);
        happy += (tmp + h[it]) / 2;
        sum += tmp;
      }
      sum += p[node];
      if ((sum + h[node]) % 2 || (sum + h[node]) / 2 < 0 ||
          (sum + h[node]) / 2 > sum || happy > (sum + h[node]) / 2)
        asd = 0;
      return sum;
    };
    dfs(1);
    cout << (asd ? "YES\n" : "NO\n");
  }
}
