#include <bits/stdc++.h>
using namespace std;
const int m_x[] = {-1, 0, 0, 1};
const int m_y[] = {0, -1, 1, 0};
template <typename T, typename S>
ostream& operator<<(ostream& output, const pair<T, S>& to_print) {
  output << to_print.first << ":" << to_print.second;
  return output;
}
template <typename T, typename S>
ostream& operator<<(ostream& output, const map<T, S>& to_print) {
  for (typename map<T, S>::const_iterator it = to_print.begin();
       it != to_print.end(); it++)
    output << *it << endl;
  return output;
}
template <typename T>
ostream& operator<<(ostream& output, const vector<T>& to_print) {
  for (typename vector<T>::const_iterator it = to_print.begin();
       it != to_print.end(); it++)
    cout << *it << " ";
  return output;
}
template <typename T>
ostream& operator<<(ostream& output, const set<T>& to_print) {
  for (typename set<T>::const_iterator it = to_print.begin();
       it != to_print.end(); it++)
    cout << *it << " ";
  return output;
}
struct info {
  long long plus, minus, neutral;
  info(long long p, long long m, long long n) : plus(p), minus(m), neutral(n) {}
  info() { plus = minus = neutral = 0; }
};
vector<pair<set<int>, info> > adj;
vector<bool> visited;
vector<int> leaves;
void dfs(int s) {
  visited[s] = true;
  for (auto i : adj[s].first)
    if (!visited[i]) dfs(i);
  if (adj[s].first.size() == 1 && s != 0) leaves.push_back(s);
}
bool check(info& in, int happ) {
  bool flag = true;
  if (in.plus - in.minus > happ) {
    in.minus += in.plus - happ;
    if (in.minus > in.neutral) flag = false;
    in.neutral -= in.minus;
  } else if (in.plus - in.minus < happ) {
    int diff = happ - (in.plus - in.minus);
    if (in.neutral < diff) flag = false;
    in.plus += diff;
    in.neutral -= diff;
  }
  if (in.neutral % 2 != 0) flag = false;
  if (in.plus - in.minus != happ) flag = false;
  in.plus += in.neutral / 2;
  in.minus += in.neutral / 2;
  return flag;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int t;
  cin >> t;
  while (t--) {
    int n, m;
    cin >> n >> m;
    adj.assign(n, pair<set<int>, info>());
    visited.assign(n, false);
    vector<int> p(n), h(n);
    for (int i = 0; i < n; i++) {
      cin >> p[i];
      adj[i].second.neutral += p[i];
    }
    for (int i = 0; i < n; i++) cin >> h[i];
    for (int i = 0; i < n - 1; i++) {
      int u, v;
      cin >> u >> v;
      u--, v--;
      adj[u].first.insert(v);
      adj[v].first.insert(u);
    }
    dfs(0);
    bool flag = true;
    while (leaves.size()) {
      vector<int> new_leaves;
      for (auto leaf : leaves) {
        int peop = p[leaf];
        int happ = h[leaf];
        info in = adj[leaf].second;
        bool happen = false;
        flag = check(in, happ);
        if (!flag) break;
        int parent = *adj[leaf].first.begin();
        adj[parent].first.erase(adj[parent].first.find(leaf));
        adj[parent].second.neutral += in.minus;
        adj[parent].second.plus += in.plus;
        if (adj[parent].first.size() <= 1 && parent != 0)
          new_leaves.push_back(parent);
      }
      if (!flag) break;
      leaves.clear();
      leaves = new_leaves;
    }
    if (flag) flag = check(adj[0].second, h[0]);
    if (flag)
      cout << "YES\n";
    else
      cout << "No\n";
    leaves.clear();
    visited.clear();
    adj.clear();
  }
  return 0;
}
