#include <bits/stdc++.h>
using namespace std;
vector<int> adj[200005], v;
int vis[200005], par[200005];
long long int sum[200005], hap[200005], people[200005], good[200005],
    bad[200005];
void dfs(int x) {
  vis[x] = 1;
  v.push_back(x);
  for (int i = 0; i < adj[x].size(); i++) {
    int y = adj[x][i];
    if (vis[y]) continue;
    par[y] = x;
    dfs(y);
    sum[x] += sum[y];
    good[x] = sum[x] + hap[x];
    bad[x] = sum[x] - hap[x];
  }
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, m;
    cin >> n >> m;
    v.clear();
    for (int i = 0; i <= n; i++) {
      adj[i].clear();
      vis[i] = 0;
      sum[i] = 0;
    }
    for (int i = 1; i <= n; i++) {
      cin >> people[i];
      sum[i] = people[i];
    }
    for (int i = 1; i <= n; i++) cin >> hap[i];
    for (int i = 1; i <= n; i++) {
      good[i] = sum[i] + hap[i];
      bad[i] = sum[i] - hap[i];
    }
    for (int i = 1; i < n; i++) {
      int x, y;
      cin >> x >> y;
      adj[x].push_back(y);
      adj[y].push_back(x);
    }
    par[1] = -1;
    dfs(1);
    bool pos = 1;
    for (int i = 0; i < v.size(); i++) {
      int x = v[i];
      if (good[x] < 0 || bad[x] < 0 || good[x] & 1 || bad[x] & 1) {
        pos = 0;
        break;
      }
      if (x > 1) {
        int y = par[x];
        if (good[x] > good[y]) {
          pos = 0;
          break;
        }
        good[y] -= good[x];
      }
    }
    if (pos)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
  return 0;
}
