#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 6;
bool flag = true;
vector<int> v[N];
int a[N], p[N], h[N], g[N];
void dfs(int u, int temp = -1) {
  a[u] = p[u];
  int sum = 0;
  for (auto x : v[u]) {
    if (x == temp) continue;
    dfs(x, u);
    sum += g[x];
    a[u] += a[x];
  }
  if ((a[u] + h[u]) % 2 != 0) flag = false;
  g[u] = (a[u] + h[u]) / 2;
  if (g[u] >= 0 and g[u] <= a[u]) {
  } else
    flag = false;
  if (sum > g[u]) flag = false;
}
int main() {
  long long int t;
  cin >> t;
  while (t--) {
    int n, m;
    cin >> n >> m;
    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++) {
      int a, b;
      cin >> a >> b;
      a--;
      b--;
      v[a].push_back(b);
      v[b].push_back(a);
    }
    dfs(0);
    cout << (flag ? "YES" : "NO") << endl;
    flag = true;
    for (int i = 0; i < n; i++) v[i].clear();
  }
}
