func_code_string: #include <bits/stdc++.h>   #pragma GCC optimize( Ofast )   #pragma GCC target( avx,avx2,fma )   using namespace std;   const long long MOD = 1e9 + 7;   const long long mxN = 1e5 + 3;   vector<long long> g[mxN];   long long good[mxN];   long long total[mxN], people[mxN];   long long h[mxN];   bool ok[mxN];   void dfs1(long long u, long long par) {     long long sum = 0;     for (long long i : g[u]) {       if (i != par) {         dfs1(i, u);         sum += total[i];       }     }     total[u] = sum + people[u];   }   bool dfs2(long long u, long long par) {     bool ret = true;     if (ok[u] == false) return false;     long long cnt = 0;     for (long long i : g[u]) {       if (i != par) {         cnt++;         ret = (ret && dfs2(i, u));       }     }     if (ret == true) {       long long su = 0;       for (long long ii : g[u]) {         if (ii != par) {           su += good[ii];         }       }       if (su > good[u])         return false;       else         return true;     }     return false;   }   void solve() {     long long n;     cin >> n;     for (long long i = 0; i <= n; ++i) {       g[i].clear();       good[i] = 0;       total[i] = 0;       people[i] = 0;       h[i] = 0;       ok[i] = true;     }     long long m;     cin >> m;     for (long long i = 1; i <= n; ++i) {       cin >> people[i];     }     for (long long i = 1; i <= n; ++i) {       cin >> h[i];     }     long long u, v;     for (long long i = 1; i < n; ++i) {       cin >> u >> v;       g[u].push_back(v);       g[v].push_back(u);     }     dfs1(1, -1);     for (long long i = 1; i <= n; ++i) {       long long g2 = (total[i] + h[i]);       long long b2 = (total[i] - h[i]);       if (g2 & 1) {         ok[i] = false;         continue;       }       if (b2 & 1) {         ok[i] = false;         continue;       }       long long go = g2 / 2;       long long b = b2 / 2;       if (go > total[i] or b > total[i] or go < 0 or b < 0) {         ok[i] = false;         continue;       }       good[i] = go;     }     bool ans = dfs2(1, -1);     if (ans)       cout <<  YES             <<   n ;     else       cout <<  NO             <<   n ;   }   int32_t main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     long long nT = 1;     cin >> nT;     for (long long i = 1; i <= nT; ++i) solve();     return 0;   }   