#include <bits/stdc++.h>
using namespace std;
const long long nax = 1e5 + 7;
long long point[nax] = {0}, happy[nax], h[nax], p[nax], lo[nax];
vector<long long> edge[nax];
bool value = true;
void DFS(long long s, long long par = -1) {
  point[s] = p[s];
  for (auto it : edge[s]) {
    if (it != par) {
      DFS(it, s);
      point[s] += point[it];
    }
  }
  lo[s] = -point[s];
}
void DFS1(long long s, long long par = -1) {
  if (h[s] > point[s] || h[s] < lo[s] || (h[s] - lo[s]) % 2 != 0) {
    value = false;
    return;
  }
  happy[s] = (h[s] - lo[s]) / 2;
  long long dem = 0;
  for (auto it : edge[s]) {
    if (it != par) {
      DFS1(it, s);
      dem += happy[it];
    }
  }
  if (dem > happy[s]) value = false;
}
int main() {
  long long tc;
  cin >> tc;
  while (tc--) {
    long long n, m;
    cin >> n >> m;
    value = true;
    for (long long i = 0; i <= n; ++i) {
      edge[i].clear();
    }
    for (long long i = 1; i <= n; ++i) cin >> p[i];
    for (long long i = 1; i <= n; ++i) cin >> h[i];
    for (long long i = 0; i < n - 1; ++i) {
      long long a, b;
      cin >> a >> b;
      edge[a].push_back(b);
      edge[b].push_back(a);
    }
    DFS(1);
    DFS1(1);
    if (value)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
}
