#include <bits/stdc++.h>
std::vector<int> g[7 << 14];
int p[7 << 14], h[7 << 14], n, i, j;
void f(int u, int x) {
  int s = 0;
  for (int v : g[u])
    if (v ^ x) f(v, u), p[u] += p[v], s += h[v];
  j = h[u] += p[u];
  i &= ~j & (s <= j && j <= 2 * p[u]);
}
int main() {
  for (scanf("%*d"); ~scanf("%d%*d", &n); i = j = 0) {
    while (i++ < n) scanf("%d", p + i), g[i].clear();
    while (j++ < n) scanf("%d", h + j);
    while (--n) scanf("%d%d", &i, &j), g[i].push_back(j), g[j].push_back(i);
    f(i = 1, 0);
    puts(i ? "YES" : "NO");
  }
}
