#include <bits/stdc++.h>
using namespace std;
unsigned long long mymax = 1;
unsigned long long maxof(unsigned long long a, unsigned long long b) {
  return a > b ? a : b;
}
int minof(int a, int b) { return a < b ? a : b; }
int abs(int a) { return a < 0 ? -a : a; }
unsigned long long mypow(unsigned long long a, unsigned long long N) {
  if (N == 0)
    return 1;
  else if (N == 1)
    return a % 998244353;
  else if (N % 2 == 0)
    return mypow((a * a) % 998244353, N / 2);
  else
    return (a * mypow((a * a) % 998244353, (N - 1) / 2)) % 998244353;
}
unsigned long long inv(unsigned long long a) { return mypow(a, 998244353 - 2); }
void ins(unsigned long long N) {
  if (mymax < N) mymax = N;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int T;
  cin >> T;
  while (T--) {
    int N, M;
    cin >> N >> M;
    vector<int> ppl(N + 1);
    for (int i = 1; i <= N; ++i) cin >> ppl[i];
    vector<int> h(N + 1);
    for (int i = 1; i <= N; ++i) cin >> h[i];
    vector<vector<int> > adj(N + 1);
    int a, b;
    for (int i = 1; i < N; ++i) {
      cin >> a >> b;
      adj[a].push_back(b);
      adj[b].push_back(a);
    }
    vector<bool> visited(N + 1, false);
    vector<int> tq;
    tq.push_back(1);
    visited[1] = true;
    vector<int> cop(ppl);
    for (int curr = 0; curr < tq.size(); ++curr) {
      for (int j = 0; j < adj[tq[curr]].size(); ++j) {
        if (visited[adj[tq[curr]][j]] == false) {
          tq.push_back(adj[tq[curr]][j]);
          visited[adj[tq[curr]][j]] = true;
        }
      }
    }
    bool ans = true;
    vector<int> limY(N + 1, 0);
    vector<int> limX(N + 1, 0);
    for (int curr = tq.size() - 1; curr >= 0; --curr) {
      if (ans == false) break;
      int i = tq[curr];
      int X, Y;
      X = (ppl[i] + h[i]) / 2;
      Y = (ppl[i] - h[i]) / 2;
      if (((X + Y) == ppl[i]) && ((X - Y) == h[i]) && (X >= 0) && (Y >= 0)) {
      } else {
        ans = false;
        break;
      }
      if ((i == 1) || (adj[i].size() > 1)) {
        if (Y > limY[i])
          if ((Y - limY[i]) > cop[i]) {
            ans = false;
            break;
          }
      }
      for (int j = 0; j < adj[i].size(); ++j) {
        ppl[adj[i][j]] += (X + Y);
        limY[adj[i][j]] += Y;
        limX[adj[i][j]] += X;
      }
    }
    if (ans)
      cout << "YES\n";
    else {
      cout << "NO\n";
    }
  }
  return 0;
}
