"Say my Name".
Todd Alquist is being taught the process of cooking methamphetamine, but to see whether he's really capable of learning it, Walt gives him a problem to solve. Since he can't solve it, he asks you for help.
You are given a tree with $N$ vertices (numbered $1$ through $N$), rooted at the vertex $1$. There is an integer written at each vertex; for each valid $i$, the value of vertex $i$ is $A$$i$.There also exists a special integer $K$. 
Choose any leaf node, denoted by $X$, and go down a simple path from $root$ to $X$.
Let $S$ denote the set of all nodes lying on the simple path from $root$ to $X$.
For all $ i $ $\epsilon $ $ S $, choose an integer $D$ $\epsilon$ $[2^{A[i]-1},2^{A[i]})$.

Informally, for every node $i$ lying on the simple path from $root$ to $X$, you have to choose an integer $D$ such that  $2^{A[i]-1}\leq D < 2^{A[i]}$.  
You now have to perform one of the two following operations :   
- Bitwise XOR of all chosen integers.  
- Bitwise AND of all chosen integers.   
You have to determine whether you can choose the values in such a way that after performing one of the given operations you can get an integer equal to $K$.  
- Note : A leaf is a node of the tree without any child nodes.
Determine if it is possible to obtain the value $K$ by performing the given operations.

-----Input:-----
- First line will contain $T$, number of testcases. Then the testcases follow. 
- First line of each testcase contains two space separated integers $N, K$ denoting the number of nodes and the value of the special integer .
- $N-1$ lines follow , each line contains two space separated integers $u,v$ denoting an edge between $u$ and $v$. 
- A single line follows containing $N$ space separated integers denoting the value of nodes.

-----Output:-----
For each testcase, output in a single line "YES"(without quotes) or "NO"(without quotes).

-----Constraints-----
- $1 \leq T \leq 10000$
- $2 \leq N \leq 5*10^5$
- $1 \leq K \leq 10^{18}$
- $1 \leq u,v \leq N$
- $ 1\leq A[i] \leq 64$
- Sum of $N$ over all test cases does not exceed 1e6.

-----Sample Input:-----
1
6 85
1 2
2 3
2 4
4 5
3 6
3 5 4 7 1 9

-----Sample Output:-----
YES

-----EXPLANATION:-----
There are two leaf nodes, 5 and 6
considering path from root to 5
we have nodes
1->2->4->5
we can select the values
5,26,75,1 and perform operation 1 that is XOR of all numbers to get 85

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

ns = {"__name__": "__main__"}
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = 'import sys,collections\ninput=sys.stdin.readline\ndef main():\n T=int(input())\n for _ in range(T):\n  N,K=map(int,input().split())\n  Tree={}\n  for j in range(N):\n   Tree[j]=[]\n   \n  for i in range(N-1):\n   u,v=map(int,input().split())\n   Tree[u-1].append(v-1)\n   Tree[v-1].append(u-1)\n   \n  A=list(map(int,input().split()))\n \n  vis=[0 for i in range(N)] #to mark visited vertices 0 for visited and \xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa01 for not visited\n  maxval=[[0,0] for i in range(N)] #Nx2 list where each i stores max \xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0value till now and its count \n  minval=[0 for i in range(N)] #Nx2 list where each i stores min value \xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0till now \n  lfnode=[] #list to store leaf nodes\n  \n  #Appending node 1\n  vis[0]=1\n  Q=collections.deque([0])\n  maxval[0][0],maxval[0][1]=A[0],1\n  minval[0]=A[0]\n \n  \n  while(len(Q)!=0):\n   a=Q.pop()\n   mv1=maxval[a][0]\n   mv2=minval[a]\n   \n   flag=0 #to check leaf node\n   \n   for i in Tree[a]:\n    if (vis[i]==0):\n     vis[i]=1\n     flag=1 #not a leaf node\n     v=A[i]\n     Q.append(i)\n \n     #Comparing maximum value of parent node\n     if (mv1<v):\n      maxval[i][0],maxval[i][1]=v,1\n      \n     elif(mv1==v):\n      maxval[i][0],maxval[i][1]=mv1,maxval[a][1]+1\n \n     else:\n      maxval[i][0],maxval[i][1]=maxval[a][0],maxval[a][1]\n \n      \n     #Comparing minimum value of parent node\n     if (mv2>v):\n      minval[i]=v\n     elif(v==mv2):\n      minval[i]=mv2\n     else:\n      minval[i]=minval[a]\n   \n \n   if (flag==0):\n    lfnode.append(a)\n \n  \n  flag=0 #For answer if 0 then NO else YES\n \n  K1=len(bin(K))-2 #length of K\n  \n  #print(lfnode,val)\n  for i in lfnode:\n   v1,v2=maxval[i][0],maxval[i][1]\n   \n   if (v1>K1 and v2%2==0):\n    flag=1\n   elif(v1==K1 and v2%2==1):\n    flag=1\n \n \n   v11=minval[i]\n   if (v11>K1 and v11!=v1):\n    flag=1\n   elif(v11==K1):\n    flag=1\n    \n   \n   if(flag==1):\n    break\n   \n  if (flag==1):\n   print("YES")\n  else:\n   print("NO")\nmain()'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 15329