#include <bits/stdc++.h>
using namespace std;
double pie = 3.14159265358979323846;
bool isPowerOfTwo(long long int n) {
  if (n == 0) return false;
  return (ceill(log2l(n)) == floorl(log2l(n)));
}
vector<long long int> g[100000];
long long int p[100000], ha[100000], h[100000], sc[100000];
long long int see = 0;
void dfs(long long int po, long long int anc = -1) {
  sc[po] = p[po];
  long long int j = 0;
  long long int sum = 0;
  j = 0;
  while (j < g[po].size()) {
    if (g[po][j] != anc) {
      dfs(g[po][j], po);
      sum += ha[g[po][j]];
      sc[po] += sc[g[po][j]];
    }
    j++;
  }
  if (((sc[po] + h[po]) % 2 + 2) % 2 == 1)
    see = 1;
  else {
    ha[po] = (sc[po] + h[po]) / 2;
    if (ha[po] < 0 || ha[po] > sc[po]) see = 1;
    if (sum > ha[po]) see = 1;
  }
}
void graph_input(long long int n) {
  long long int x, y, j;
  for (j = 0; j < n; j++) {
    cin >> x >> y;
    g[x - 1].push_back(y - 1);
    g[y - 1].push_back(x - 1);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int T, i, j, j1, k = 0, n, m, co = 0, check, mi, l, sum;
  long long int ans = 0;
  cin >> T;
  for (i = 0; i < T; i++) {
    cin >> n >> m;
    for (j = 0; j < n; j++) cin >> p[j];
    for (j = 0; j < n; j++) cin >> h[j];
    graph_input(n - 1);
    dfs(0);
    if (see == 0)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
    see = 0;
    for (j = 0; j < n; j++) g[j].clear();
  }
}
