Trail Ledger Calibration
A survey network consists of a tree with vertices numbered from to . Vertex carries an integer label .
The route ledger from vertex to vertex is the multiset of labels on the unique simple path from to , including both endpoints. The order of entries in a route ledger is irrelevant, while repeated labels remain repeated.
Each request gives two routes, one from to and another from to , together with an allowance . You may change the labels of at most entries in the first route ledger. Each changed entry may receive any integer label between and , inclusive.
Determine whether the first route ledger can be made exactly equal to the second route ledger as a multiset.
Changes are hypothetical and apply only to the first ledger of the current request. They do not modify the tree or any other request. If the two routes share a vertex, its occurrence in each ledger is considered separately.
Input
The first line contains two integers and , the number of vertices and the number of requests, respectively.
The second line contains integers , where is the label of vertex .
Output
For each request, print YES if the first route ledger can be made equal to the second route ledger by changing at most entries. Otherwise, print NO.
The answer is case-sensitive.
Samples
Sample 1
Input
6 5 1 2 1 3 2 4 1 2 2 3 2 4 4 5 4 6 3 5 1 6 1 3 5 1 6 0 3 1 5 6 2 3 1 5 6 1 2 4 4 6 1
Output
YES NO YES NO YES
For the first two requests, the route ledgers are and . One change is sufficient, but zero changes are not. The next pair of route ledgers requires two changes. In the final request, changing the entry labeled to makes the ledgers equal.