Problem: Uncle Bogdan is in captain Flint's crew for a long time and sometimes gets nostalgic for his homeland. Today he told you how his country introduced a happiness index.

There are n cities and n−1 undirected roads connecting pairs of cities. Citizens of any city can reach any other city traveling by these roads. Cities are numbered from 1 to n and the city 1 is a capital. In other words, the country has a tree structure.

There are m citizens living in the country. A p_i people live in the i-th city but all of them are working in the capital. At evening all citizens return to their home cities using the shortest paths. 

Every person has its own mood: somebody leaves his workplace in good mood but somebody are already in bad mood. Moreover any person can ruin his mood on the way to the hometown. If person is in bad mood he won't improve it.

Happiness detectors are installed in each city to monitor the happiness of each person who visits the city. The detector in the i-th city calculates a happiness index h_i as the number of people in good mood minus the number of people in bad mood. Let's say for the simplicity that mood of a person doesn't change inside the city.

Happiness detector is still in development, so there is a probability of a mistake in judging a person's happiness. One late evening, when all citizens successfully returned home, the government asked uncle Bogdan (the best programmer of the country) to check the correctness of the collected happiness indexes.

Uncle Bogdan successfully solved the problem. Can you do the same?

More formally, You need to check: "Is it possible that, after all people return home, for each city i the happiness index will be equal exactly to h_i".

Input

The first line contains a single integer t (1 ≤ t ≤ 10000) — the number of test cases.

The first line of each test case contains two integers n and m (1 ≤ n ≤ 10^5; 0 ≤ m ≤ 10^9) — the number of cities and citizens.

The second line of each test case contains n integers p_1, p_2, …, p_{n} (0 ≤ p_i ≤ m; p_1 + p_2 + … + p_{n} = m), where p_i is the number of people living in the i-th city.

The third line contains n integers h_1, h_2, …, h_{n} (-10^9 ≤ h_i ≤ 10^9), where h_i is the calculated happiness index of the i-th city.

Next n − 1 lines contain description of the roads, one per line. Each line contains two integers x_i and y_i (1 ≤ x_i, y_i ≤ n; x_i ≠ y_i), where x_i and y_i are cities connected by the i-th road.

It's guaranteed that the sum of n from all test cases doesn't exceed 2 ⋅ 10^5.

Output

For each test case, print YES, if the collected data is correct, or NO — otherwise. You can print characters in YES or NO in any case.

Examples

Input


2
7 4
1 0 1 1 0 1 0
4 0 0 -1 0 -1 0
1 2
1 3
1 4
3 5
3 6
3 7
5 11
1 2 5 2 1
-11 -2 -6 -2 -1
1 2
1 3
1 4
3 5


Output


YES
YES


Input


2
4 4
1 1 1 1
4 1 -3 -1
1 2
1 3
1 4
3 13
3 3 7
13 1 4
1 2
1 3


Output


NO
NO

Note

Let's look at the first test case of the first sample: 

<image>

At first, all citizens are in the capital. Let's describe one of possible scenarios: 

  * a person from city 1: he lives in the capital and is in good mood; 
  * a person from city 4: he visited cities 1 and 4, his mood was ruined between cities 1 and 4; 
  * a person from city 3: he visited cities 1 and 3 in good mood; 
  * a person from city 6: he visited cities 1, 3 and 6, his mood was ruined between cities 1 and 3; 

In total, 
  * h_1 = 4 - 0 = 4, 
  * h_2 = 0, 
  * h_3 = 1 - 1 = 0, 
  * h_4 = 0 - 1 = -1, 
  * h_5 = 0, 
  * h_6 = 0 - 1 = -1, 
  * h_7 = 0. 



The second case of the first test: 

<image>

All people have already started in bad mood in the capital — this is the only possible scenario.

The first case of the second test: 

<image>

The second case of the second test: 

<image>

It can be proven that there is no way to achieve given happiness indexes in both cases of the second test. 

Solution (in PYTHON3):

Solution:
 
# from math import factorial as fac
from collections import defaultdict
# from copy import deepcopy
import sys, math
f = None
try:
	f = open('q1.input', 'r')
except IOError:
	f = sys.stdin
if 'xrange' in dir(__builtins__):
	range = xrange
# print(f.readline())
# sys.setrecursionlimit(3*10**6)

	
def print_case_iterable(case_num, iterable):
	print("Case #{}: {}".format(case_num," ".join(map(str,iterable))))

def print_case_number(case_num, iterable):
	print("Case #{}: {}".format(case_num,iterable))

def print_iterable(A):
	print (' '.join(A))

def read_int():
	return int(f.readline().strip())
def read_int_array():
	return [int(x) for x in f.readline().strip().split(" ")]
def rns():
	a =  [x for x in f.readline().split(" ")]
	return int(a[0]), a[1].strip()
def read_string():
	return list(f.readline().strip())
def ri():
	return int(f.readline().strip())
def ria():
	return [int(x) for x in f.readline().strip().split(" ")]
def rns():
	a =  [x for x in f.readline().split(" ")]
	return int(a[0]), a[1].strip()
def rs():
	return list(f.readline().strip())
def bi(x):
	return bin(x)[2:]





from collections import deque
import math
NUMBER = 10**9 + 7
# NUMBER = 998244353
def factorial(n) : 
	M = NUMBER
	f = 1
  
	for i in range(1, n + 1):  
		f = (f * i) % M # Now f never can  
						# exceed 10^9+7  
	return f
def mult(a,b):
	return (a * b) % NUMBER

def minus(a , b):
	return (a - b) % NUMBER

def plus(a , b):
	return (a + b) % NUMBER

def egcd(a, b):
	if a == 0:
		return (b, 0, 1)
	else:
		g, y, x = egcd(b % a, a)
		return (g, x - (b // a) * y, y)

def modinv(a):
	m = NUMBER
	g, x, y = egcd(a, m)
	if g != 1:
		raise Exception('modular inverse does not exist')
	else:
		return x % m
def choose(n,k):
	if n < k:
		assert false
	return  mult(factorial(n), modinv(mult(factorial(k),factorial(n-k)))) % NUMBER
from collections import deque, defaultdict 
import heapq


from types import GeneratorType
def bootstrap(f, stack=[]):
	def wrappedfunc(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		else:
			to = f(*args, **kwargs)
			while True:
				if type(to) is GeneratorType:
					stack.append(to)
					to = next(to)
				else:
					stack.pop()
					if not stack:
						break
					to = stack[-1].send(to)
			return to

	return wrappedfunc


def dfs(g, timeIn, timeOut,depths,parents): 
	# assign In-time to node u 
	cnt = 0
	# node, neig_i, parent, depth
	stack = [[1,0,0,0]]
	while stack:
		v,neig_i,parent,depth = stack[-1]
		parents[v] = parent
		depths[v] = depth
		# print (v)
		if neig_i == 0:
			timeIn[v] = cnt    
			cnt+=1
		while neig_i < len(g[v]):
			u = g[v][neig_i]
			if u == parent:
				neig_i+=1
				continue
			stack[-1][1] = neig_i + 1
			stack.append([u,0,v,depth+1])
			break
		if neig_i == len(g[v]):
			stack.pop()
			timeOut[v] = cnt
			cnt += 1
  
# def isAncestor(u: int, v: int, timeIn: list, timeOut: list) -> str: 
# 	return timeIn[u] <= timeIn[v] and timeOut[v] <= timeOut[u] 

cnt = 0
@bootstrap
def dfs(v,adj,timeIn, timeOut,depths,parents,parent=0,depth=0):
	global cnt
	parents[v] = parent
	depths[v] = depth
	timeIn[v] = cnt
	cnt+=1
	for u in adj[v]:
		if u == parent:
			continue
		yield dfs(u,adj,timeIn,timeOut,depths,parents,v,depth+1)
	timeOut[v] = cnt
	cnt+=1
	yield 

def gcd(a,b): 
	if a == 0: 
		return b 
	return gcd(b % a, a) 
  
# Function to return LCM of two numbers 
def lcm(a,b): 
	return (a*b) / gcd(a,b) 
def get_num_2_5(n):
	twos = 0
	fives = 0
	while n>0 and n%2 == 0:
		n//=2
		twos+=1
	while n>0 and n%5 == 0:
		n//=5
		fives+=1
	return (twos,fives)
def shift(a,i,num):
	for _ in range(num):
		a[i],a[i+1],a[i+2] = a[i+2],a[i],a[i+1]

def equal(x,y):
	return abs(x-y) <= 1e-9
# def leq(x,y):
# 	return x-y <= 1e-9
def getAngle(a, b, c):
	ang = math.degrees(math.atan2(c[1]-b[1], c[0]-b[0]) - math.atan2(a[1]-b[1], a[0]-b[0]))
	return ang + 360 if ang < 0 else ang
def getLength(a,b):
	return math.sqrt((a[0]-b[0])**2 + (a[1]-b[1])**2)


from heapq import heapify, heappush, heappop

def bfs(adj):
	s = set()
	d = defaultdict(set)
	# print('\n'.join(map(str,E.items())))
	q = deque([])
	s.add(0)
	d[0].add(0)
	q.append((0,0))
	while len(q) > 0:
		v,depth = q.popleft()
		for u in adj[v]:
			if u not in s:
				s.add(u)
				d[depth+1].add(u)
				q.append((u,depth+1))
		# print(q)
	return d



def isSubsetSum(arr, n, summ): 
	  
	# The value of subarr[i][j] will be  
	# true if there is a 
	# subarr of arr[0..j-1] with summ equal to i 
	subarr =([[False for i in range(summ + 1)]  
			for i in range(n + 1)]) 
	  
	# If summ is 0, then answer is true  
	for i in range(n + 1): 
		subarr[i][0] = True
		  
	# If summ is not 0 and arr is empty,  
	# then answer is false  
	for i in range(1, summ + 1): 
		 subarr[0][i]= False
			  
	# Fill the subarr table in botton up manner 
	for i in range(1, n + 1): 
		for j in range(1, summ + 1): 
			if j<arr[i-1]: 
				subarr[i][j] = subarr[i-1][j] 
			if j>= arr[i-1]: 
				subarr[i][j] = (subarr[i-1][j] or 
								subarr[i - 1][j-arr[i-1]]) 
	  
	# uncomment this code to print table  
	# for i in range(n + 1): 
	# for j in range(summ + 1): 
	# print (subset[i][j], end =" ") 
	# print() 
	return subarr[n][summ] 



def bfs(v,adj,onpath):
	# d is a dict for depth
	s = set()
	d = defaultdict(set)
	q = deque([])
	s.add(0)
	d[0].add(0)
	q.append((0,0))
	while len(q) > 0:
		v,depth = q.popleft()
		for u in adj[v]:
			if u not in s:
				s.add(u)
				d[depth+1].add(u)
				q.append((u,depth+1))
		# print(q)
	return d



@bootstrap
def dfs(v,pa,adj,p,h):
	s = 0
	num = p[v]
	for u in adj[v]:
		if pa == u:
			continue
		x,y = yield dfs(u,v,adj,p,h)
		# if v == 0:
			# print(x)
		if x == -1:
			yield -1, -1
		num += x
		s += y
	# print(num,s)
	if (h[v] % 2 != num %2) or (h[v] < s-p[v]) or (h[v] >num) or (h[v] < -num):
		yield -1,-1
	yield num,h[v]

def solution(adj,n,p,m,h):
	x,y = dfs(0,-1,adj,p,h)
	if x == -1:
		return "No"
	return "Yes"


def main():
	T = 1
	T = ri()
	for i in range(T):
		# n = ri()
		n,m= ria()
		# a = ria()
		# s = rs()
		p = ria()
		h = ria()

		adj = [list() for _ in range(n)]
		for j in range(n-1):
			a,b = ria()
			a-=1;b-=1
			adj[a].append(b)
			adj[b].append(a)

		x = solution(adj,n,p,m,h)

		# continue
		if 'xrange' not in dir(__builtins__):
			print(x) # print("Case #"+str(i+1)+':',x)
		else:
			print >>output,str(x)
	if 'xrange' in dir(__builtins__):
		print(output.getvalue())
		output.close()

if 'xrange' in dir(__builtins__):
	import cStringIO
	output = cStringIO.StringIO()
#example usage:
#    for l in res:
#       print >>output, str(len(l)) + ' ' +  ' '.join(l)

if __name__ == '__main__':
	main()