#include <bits/stdc++.h>
using namespace std;
long long a[200005];
long long h[200005];
vector<long long> adj[100005];
long long cnt[100005];
long long vis[100005];
pair<long long, long long> v[200005];
long long l = 0;
void dfs(int node) {
  vis[node] = 1;
  cnt[node] = a[node];
  long long cnth = 0, cnts = 0;
  for (int i = 0; i < adj[node].size(); i++) {
    int child = adj[node][i];
    if (vis[child] == 0) {
      dfs(child);
      cnt[node] += cnt[child];
      cnth += v[child].first;
      cnts += v[child].second;
    }
  }
  long long q = cnt[node] - h[node] + 2;
  long long n1 = q / 2;
  long long ch = cnt[node] - (n1 - 1);
  long long cs = (n1 - 1);
  if (ch - cs != h[node] || ch < 0 || cs < 0) {
    l = 1;
    return;
  }
  v[node].first = ch;
  v[node].second = cs;
  long long p = cnt[node] - a[node];
  if (cnts + cnth > p) {
    l = 1;
    return;
  }
  if (cnth > ch) {
    l = 1;
    return;
  } else {
    long long p1 = p - cnth;
    if (cnts < p1 && p1 > 0) {
      l = 1;
      return;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    long long n, m;
    cin >> n >> m;
    l = 0;
    for (int i = 1; i <= n; i++) {
      vis[i] = 0;
      adj[i].clear();
      v[i].first = 0;
      v[i].second = 0;
      cnt[i] = 0;
    }
    for (int i = 1; i <= n; i++) {
      cin >> a[i];
    }
    for (int i = 1; i <= n; i++) {
      cin >> h[i];
    }
    for (int i = 0; i < n - 1; i++) {
      long long u, v;
      cin >> u >> v;
      adj[u].push_back(v);
      adj[v].push_back(u);
    }
    dfs(1);
    if (l == 0)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
}
