#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> adj;
int *p;
int *h;
int *g;
int *a;
bool access = true;
void dfs(int s, int ancestor = -1) {
  a[s] = p[s];
  int s_g = 0;
  for (auto to : adj[s]) {
    if (to == ancestor) continue;
    dfs(to, s);
    s_g += g[to];
    a[s] += a[to];
  }
  int good = (h[s] + a[s]) / 2;
  if ((h[s] + a[s]) % 2 != 0 || good < 0 || good > a[s] || good < s_g) {
    access = false;
  }
  g[s] = good;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, m;
    int u, v;
    cin >> n >> m;
    adj.assign(n, vector<int>());
    p = new int[n];
    h = new int[n];
    g = new int[n];
    a = new int[n];
    for (int i = 0; i < n; i++) {
      cin >> p[i];
    }
    for (int i = 0; i < n; i++) {
      cin >> h[i];
    }
    for (int i = 0; i < n - 1; i++) {
      cin >> u >> v;
      u--;
      v--;
      adj[u].push_back(v);
      adj[v].push_back(u);
    }
    dfs(0);
    cout << (access ? "YES" : "NO") << endl;
    access = true;
  }
}
