#include <bits/stdc++.h>
using namespace std;
bool visited[100005];
vector<int> adj[100005];
int arr[100005];
int brr[100005];
long long flag;
void bfs(int n) {
  long long val = 0;
  visited[n] = true;
  val -= arr[n];
  for (int i = 0; i < adj[n].size(); i++) {
    if (!visited[adj[n][i]]) {
      bfs(adj[n][i]);
      arr[n] += arr[adj[n][i]];
      val += brr[adj[n][i]];
    }
  }
  if (brr[n] < val)
    flag = 1;
  else if (brr[n] > arr[n])
    flag = 1;
  else if ((brr[n] - val) & 1)
    flag = 1;
  else
    return;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t, n, m, u, v;
  cin >> t;
  while (t--) {
    cin >> n >> m;
    for (int i = 1; i <= n; i++) {
      adj[i].clear();
      visited[i] = false;
    }
    for (int i = 1; i <= n; i++) cin >> arr[i];
    for (int i = 1; i <= n; i++) cin >> brr[i];
    for (int i = 0; i < n - 1; i++) {
      cin >> u >> v;
      adj[u].push_back(v);
      adj[v].push_back(u);
    }
    if (brr[1] > m)
      cout << "NO"
           << "\n";
    else {
      flag = 0;
      bfs(1);
      if (flag)
        cout << "NO"
             << "\n";
      else
        cout << "YES"
             << "\n";
    }
  }
  return 0;
}
