#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
string next_valid_bracket_sequence(const string &x) {
  string s = x;
  int n = s.size();
  int d = 0;
  for (int i = n - 1; i >= 1; i--) {
    if (s[i] == ')')
      d++;
    else {
      d--;
      if (d > 0) {
        s[i] = ')';
        s = s.substr(0, i + 1);
        for (int j = 0; j < (n - i - d) / 2; j++) {
          s += "(";
        }
        for (int j = 0; j < (n - i + d - 2) / 2; j++) {
          s += ")";
        }
        if (s.size() < n) return s + ")";
        return s;
      }
    }
  }
  return "";
}
long long modulo(long long x, long long m) {
  int r = x % m;
  return r < 0 ? r + m : r;
}
long long power(long long n, long long k, long long mod) {
  if (k == 0) return 1LL;
  n %= mod;
  long long ans = 1;
  while (k > 0) {
    if (k & 1) ans = (ans * n) % mod;
    n = (n * n) % mod;
    k /= 2;
  }
  return ans;
}
long long power(long long n, long long k) {
  if (k == 0) return 1LL;
  long long ans = 1;
  while (k > 0) {
    if (k & 1) ans *= n;
    n *= n;
    k /= 2;
  }
  return ans;
}
int number_of_divisors(int n) {
  int count = 1;
  vector<int> arr;
  int i = 2;
  while (i * i <= n) {
    if (n % i == 0) {
      arr.push_back(1);
      while (n % i == 0) {
        n /= i;
        arr.back()++;
      }
    }
    i++;
  }
  for (int x : arr) count *= x;
  if (n != 1) count *= 2;
  return count;
}
bool isPalindrome(const string &s) {
  int n = s.size();
  for (int i = 0; i < n / 2; i++) {
    if (s[i] != s[n - i - 1]) return false;
  }
  return true;
}
long long nchoosek(long long n, long long k, long long mod) {
  long long res = 1;
  for (long long i = 2; i <= k; i++) res = (res * i) % mod;
  res = power(res, mod - 2, mod) % mod;
  for (long long i = n; i >= n - k + 1; i--) res = (res * i) % mod;
  return res;
}
class allPerms {
 public:
  vector<vector<long long>> perm;
  int n;
  int mod = -1;
  allPerms(int n, int mod = -1) {
    this->mod = mod;
    this->n = n + 1;
    this->perm = vector<vector<long long>>(n + 1, vector<long long>(n + 1, 0));
    set();
  }
  void set() {
    for (int i = 0; i < n; i++) {
      perm[i][0] = 1;
    }
    if (mod > -1) {
      for (int i = 0; i < n - 1; i++) {
        for (int j = 0; j < i + 1; j++) {
          if (j > 0) perm[i + 1][j] = (perm[i + 1][j] + perm[i][j]) % mod;
          perm[i + 1][j + 1] = (perm[i + 1][j + 1] + perm[i][j]) % mod;
        }
      }
    } else {
      for (int i = 0; i < n - 1; i++) {
        for (int j = 0; j < i + 1; j++) {
          if (j > 0) perm[i + 1][j] += perm[i][j];
          perm[i + 1][j + 1] += perm[i][j];
        }
      }
    }
  }

 public:
  long long get(int i, int j) { return perm[i][j]; }
};
vector<vector<int>> E;
vector<int> peeps, happy, sub;
int subtree(int u, int p) {
  sub[u] = peeps[u];
  for (int v : E[u]) {
    if (v != p) sub[u] += subtree(v, u);
  }
  return sub[u];
}
bool bfs(int u, int p) {
  int val = 0;
  if ((sub[u] - happy[u]) % 2 == 1) return false;
  if ((sub[u] + happy[u]) % 2 == 1) return false;
  if ((sub[u] + happy[u]) / 2 < 0) return false;
  if ((sub[u] - happy[u]) / 2 < 0) return false;
  for (int v : E[u]) {
    if (v != p) val += (sub[v] - happy[v]) / 2;
  }
  if (max(0, ((sub[u] - happy[u]) / 2) - peeps[u]) > val) return false;
  for (int v : E[u]) {
    if (v != p && bfs(v, u) == false) return false;
  }
  return true;
}
void run() {
  int n, m;
  cin >> n >> m;
  peeps = vector<int>(n);
  happy = vector<int>(n);
  sub = vector<int>(n);
  E = vector<vector<int>>(n, vector<int>());
  for (int i = 0; i < n; i++) {
    cin >> peeps[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> happy[i];
  }
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    cin >> u >> v;
    E[u - 1].push_back(v - 1);
    E[v - 1].push_back(u - 1);
  }
  subtree(0, -1);
  string s;
  s = (bfs(0, -1)) ? "YES" : "NO";
  cout << s << endl;
}
int main() {
  cin.tie(NULL);
  ios_base::sync_with_stdio(false);
  int t = 1;
  cin >> t;
  while (t--) {
    run();
    cout.flush();
  }
}
