#include<bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
using namespace std;
const int N=1e5+10;
const ll inf=0x3f3f3f3f;
int n,m,head[N],cnt;
ll p[N],h[N],x[N],y[N],sz[N];
struct Node{int nxt,to;}edges[N*2];
void addedge(int u,int v){edges[++cnt]=Node{head[u],v},head[u]=cnt;}
bool dfs(int u,int f)
{
sz[u]=p[u];
for(int i=head[u];~i;i=edges[i].nxt)
{
int v=edges[i].to;
if(v!=f)
{
if(!dfs(v,u))return 0;
sz[u]+=sz[v];
}
}
if((h[u]+sz[u])&1)return 0;
x[u]=(h[u]+sz[u])/2,y[u]=x[u]-h[u];
if(x[u]<0||y[u]<0)return 0;
ll sonx=0;
for(int i=head[u];~i;i=edges[i].nxt)
{
int v=edges[i].to;
if(v!=f)sonx+=x[v];
}
return x[u]>=sonx+max(0LL,p[u]-y[u]);
}
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
cnt=0;
memset(head,-1,sizeof(head));
scanf("%d%d",&n,&m);
for(int i=1;i<=n;i++)scanf("%lld",&p[i]);
for(int i=1;i<=n;i++)scanf("%lld",&h[i]);
for(int i=1;i<n;i++)
{
int x,y;
scanf("%d%d",&x,&y);
addedge(x,y),addedge(y,x);
}
if(dfs(1,0))puts("YES");
else puts("NO");
}
return 0;
}