#include <bits/stdc++.h>
using namespace std;
void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }
template <typename T, typename V>
void __print(const pair<T, V> &x) {
  cerr << '{';
  __print(x.first);
  cerr << ',';
  __print(x.second);
  cerr << '}';
}
template <typename T>
void __print(const T &x) {
  int f = 0;
  cerr << '{';
  for (auto &i : x) cerr << (f++ ? "," : ""), __print(i);
  cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
  __print(t);
  if (sizeof...(v)) cerr << ", ";
  _print(v...);
}
const int mod = 1e9 + 7;
const int N = 1e5 + 5;
bool f;
vector<int> adj[N];
vector<int> p(N), h(N), good(N);
void dfs(int ver, int par) {
  int cnt = 0;
  for (auto child : adj[ver]) {
    if (child == par) {
      continue;
    }
    dfs(child, ver);
    p[ver] += p[child];
    cnt += good[child];
  }
  if ((p[ver] + h[ver]) % 2) {
    f = 1;
  }
  good[ver] = (p[ver] + h[ver]) >> 1;
  if (good[ver] < cnt or good[ver] > p[ver]) {
    f = 1;
  }
}
void solve() {
  int n, m;
  cin >> n >> m;
  ;
  for (int i = 0; i <= n; i++) {
    adj[i].clear();
  }
  for (int i = 1; i <= n; i++) {
    cin >> p[i];
  }
  for (int i = 1; i <= n; i++) {
    cin >> h[i];
  }
  for (int i = 0; i < n - 1; i++) {
    int x, y;
    cin >> x >> y;
    ;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  f = 0;
  dfs(1, 0);
  if (f) {
    cout << "NO"
         << "\n";
    ;
    return;
  }
  cout << "YES"
       << "\n";
  ;
}
int32_t main() {
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
}
