#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
vector<int> adj[N];
int p[N];
int h[N];
int good[N];
int bad[N];
bool bb;
void dfs(int x, int par) {
  int g = 0, b = 0;
  for (auto nx : adj[x]) {
    if (nx == par) continue;
    dfs(nx, x);
    g += good[nx];
    b += bad[nx];
  }
  int cnt = b + g + p[x];
  int x1 = cnt + h[x];
  int x2 = cnt - h[x];
  if (x1 % 2 || x2 % 2) {
    bb = true;
  }
  if (abs(h[x]) > cnt) bb = true;
  int ng = x1 / 2;
  int nb = x2 / 2;
  if (ng < 0 || nb < 0) bb = true;
  if (g > ng) {
    bb = true;
  }
  good[x] = ng;
  bad[x] = nb;
}
int main() {
  ios_base::sync_with_stdio(false);
  int T;
  cin >> T;
  while (T--) {
    int n, m;
    cin >> n >> m;
    bb = false;
    for (int i = 0; i <= n; i++) {
      adj[i].clear();
      good[i] = bad[i] = 0;
    }
    for (int i = 1; i <= n; i++) cin >> p[i];
    for (int i = 1; i <= n; i++) cin >> h[i];
    for (int i = 1; i < n; i++) {
      int x, y;
      cin >> x >> y;
      adj[x].push_back(y);
      adj[y].push_back(x);
    }
    dfs(1, -1);
    if (!bb)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
  return 0;
}
