#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie();cout.tie();
#define FILE_READ_IN freopen("input.txt","r",stdin);
#define FILE_READ_OUT freopen("output.txt","w",stdout);
using namespace std;
typedef long long ll;
vector<vector<int>> adj;
vector<bool> vis;
bool ans=true;
ll dfs(int v,ll *p,ll *h,ll *B,int parent=-1){
	vis[v]=true;
	ll sum=0,total=p[v];
	for(int u:adj[v]){
		if(!vis[u]){
			total+=dfs(u,p,h,B,v);
			sum+=B[u];
		}
	}
	if((total-h[v])%2!=0) ans=false;
	B[v]=(total-h[v])/2;
	if(B[v]<0||B[v]>total) ans=false;
	if(sum<B[v]) ans=false;
	
	return total;
}

int main()
{
	int t; cin>>t;
	while(t--){
		ans=false;
		int n; cin>>n;
		adj.resize(n); vis.resize(n,false);
		ll m; cin>>m;
		ll p[n],h[n];
		for (int i = 0; i < n; i++)
		{
			cin>>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].push_back(v);
			adj[v].push_back(u);
		}
		ll B[n];
		dfs(0,p,h,B);
		if(ans) cout<<"YES\n";
		else cout<<"NO\n";
		adj.clear();
		vis.clear();
	}
}


