#include <bits/stdc++.h>
using namespace std;
bool flag = true;
void fast() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}
void dfs(vector<vector<long long>> &adj, vector<long long> &h,
         vector<long long> &p, long long srt, long long par,
         vector<long long> &g) {
  for (long long i = 0; i < adj[srt].size(); i++) {
    if (adj[srt][i] == par) continue;
    dfs(adj, h, p, adj[srt][i], srt, g);
    p[srt] += p[adj[srt][i]];
  }
  if (llabs(p[srt] + h[srt]) % 2 == 1) flag = false;
  g[srt] = (p[srt] + h[srt]) / 2;
}
bool DFS(vector<vector<long long>> &adj, vector<long long> &h,
         vector<long long> &p, long long srt, long long par,
         vector<long long> &g) {
  long long g1 = 0;
  for (long long i = 0; i < adj[srt].size(); i++) {
    if (adj[srt][i] == par) continue;
    if (!DFS(adj, h, p, adj[srt][i], srt, g)) return false;
    g1 += g[adj[srt][i]];
  }
  if (g1 > g[srt] || llabs(h[srt]) > p[srt]) return false;
  return true;
}
int main() {
  fast();
  int t = 1;
  cin >> t;
  for (int T = 0; T < t; T++) {
    flag = true;
    long long n, m;
    cin >> n >> m;
    vector<long long> p(n + 1), p1(n + 1), h(n + 1), g(n + 1);
    for (long long i = 1; i <= n; i++) cin >> p[i];
    for (long long i = 1; i <= n; i++) cin >> h[i];
    vector<vector<long long>> adj(n + 1);
    for (long long i = 0; i < n - 1; i++) {
      long long x, y;
      cin >> x >> y;
      adj[x].push_back(y);
      adj[y].push_back(x);
    }
    dfs(adj, h, p, 1, -1, g);
    if (!flag) {
      cout << "NO" << endl;
      continue;
    }
    if (DFS(adj, h, p, 1, -1, g))
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}
