#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
const long double pi = acos(-1.0);
const int_fast32_t mod = 1e9 + 7;
struct pr {
  int_fast32_t x;
  int_fast32_t y;
  int_fast32_t dst;
  pr() {}
  pr(int_fast32_t x, int_fast32_t y, int_fast32_t dst) : x(x), y(y), dst(dst) {}
  inline bool operator<(const pr& cmp2) const {
    if (dst != cmp2.dst) return dst < cmp2.dst;
    if (x != cmp2.x) return x < cmp2.x;
    return y < cmp2.y;
  }
  inline bool operator==(const pr& cmp2) const {
    return (cmp2.dst == dst) && (cmp2.x == x) && (cmp2.y == y);
  }
  inline bool operator>(const pr& cmp2) const {
    if (dst != cmp2.dst) return dst > cmp2.dst;
    if (x != cmp2.x) return x > cmp2.x;
    return y > cmp2.y;
  }
};
struct point {
  int_fast32_t x;
  int_fast32_t y;
  point() {}
  point(int_fast32_t x, int_fast32_t y) : x(x), y(y) {}
  inline bool operator<(const point& cmp2) const {
    if (cmp2.x != x) return cmp2.x < x;
    return cmp2.y < y;
  }
  inline bool operator==(const point& cmp2) const {
    return (cmp2.x == x) && (cmp2.y == y);
  }
  inline bool operator>(const point& cmp2) const {
    if (cmp2.x != x) return cmp2.x > x;
    return cmp2.y > y;
  }
};
namespace std {
template <typename T>
struct hash<vector<T> > {
  size_t operator()(const vector<T>& k) const {
    size_t ret = 0xf3ee477d;
    for (size_t i = 0; i != k.size(); ++i) ret ^= hash(hash(k[i]) + i);
    return ret;
  }
};
template <>
struct hash<pr> {
  size_t operator()(const pr& cmp1) const {
    return (hash<int_fast32_t>()(cmp1.x)) ^ (hash<int_fast32_t>()(cmp1.y)) ^
           (hash<int_fast32_t>()(cmp1.dst));
  }
};
template <>
struct hash<point> {
  size_t operator()(const point& cmp1) const {
    return (hash<int_fast32_t>()(cmp1.x)) ^ (hash<int_fast32_t>()(cmp1.y));
  }
};
}  // namespace std
inline bool spoint(const point& cmp1, const point& cmp2) {
  if (cmp1.x != cmp2.x) return cmp1.x < cmp2.x;
  return cmp1.y < cmp2.y;
}
inline bool spr(const pr& cmp1, const pr& cmp2) {
  if (cmp1.dst != cmp2.dst) return cmp1.dst < cmp2.dst;
  if (cmp1.x != cmp2.x) return cmp1.x < cmp2.x;
  return cmp1.y < cmp2.y;
}
int_fast32_t vis[100005];
int_fast32_t h[100005], p[100005];
vector<int_fast32_t> arr[100005];
point rek(int_fast32_t cur) {
  point tot = {0, 0};
  for (auto i : arr[cur]) {
    if (vis[i]) continue;
    vis[i] = 1;
    auto temp = rek(i);
    if (temp.x == -1) {
      return {-1, -1};
    }
    tot.x += temp.x;
    tot.y += temp.y;
  }
  if (tot.x + tot.y + p[cur] < h[cur]) {
    return {-1, -1};
  }
  if (tot.x - tot.y - p[cur] > h[cur]) {
    return {-1, -1};
  }
  int_fast32_t kanan = tot.x - h[cur];
  if (kanan > tot.y + p[cur]) {
    return {-1, -1};
  }
  if ((tot.y + p[cur] - kanan) % 2) {
    return {-1, -1};
  }
  point res = {0, 0};
  if (kanan > 0) {
    res.x = tot.x + (tot.y + p[cur] - kanan) / 2;
    res.y = kanan + (tot.y + p[cur] - kanan) / 2;
    assert(res.x - res.y == h[cur]);
  } else {
    kanan = abs(kanan);
    res.x = tot.x + kanan + (tot.y + p[cur] - kanan) / 2;
    res.y = (tot.y + p[cur] - kanan) / 2;
    assert(res.x - res.y == h[cur]);
  }
  return res;
}
void sub() {
  int_fast32_t n, m;
  cin >> n >> m;
  for (int_fast32_t i = (int_fast32_t)0; i < (int_fast32_t)n; ++i) {
    arr[i].clear();
    vis[i] = 0;
    cin >> p[i];
  }
  for (int_fast32_t i = (int_fast32_t)0; i < (int_fast32_t)n; ++i) cin >> h[i];
  for (int_fast32_t i = (int_fast32_t)0; i < (int_fast32_t)n - 1; ++i) {
    int_fast32_t u, v;
    cin >> u >> v;
    --u;
    --v;
    arr[u].push_back(v);
    arr[v].push_back(u);
  }
  vis[0] = 1;
  auto res = rek(0);
  if (res.x == -1) {
    cout << "NO" << endl;
  } else
    cout << "YES" << endl;
}
void solve() {
  int_fast32_t t;
  cin >> t;
  while (t--) sub();
}
void init() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  srand(time(0));
}
int main() {
  init();
  solve();
  return 0;
}
