思考题 for no one

# Tour

You are given a tree of N nodes. Given another integer array A of length M.

Little CMJ chooses M sequences of nodes. The i-th of them is

Can all the nodes be visited after choosing the M sequences?

## Example

### Example 1

Tree={[1,2],[2,3],[2,4],[4,7],[1,5],[1,6]}

M={3,4,2,2}

Answer:

YES

Explain:

{1,2,3} {1,2,4,7} {1,5} {1,6} is chosen

### Example 2

Tree={[1,2],[2,3],[2,4],[4,7],[1,5],[1,6]}

M={6,2,2}

Answer:

YES

Explain:

{1,2,3,2,4,7} {1,5} {1,6} is chosen

### Example 3

Tree={[1,2],[2,3],[2,4],[4,7],[1,5],[1,6]}

M={9}

Answer:

NO

Explain:

if M={10}, then possible: {1,5,1,6,1,2,3,2,4,7}