408184: GYM103048 E Edge Game

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

E. Edge Gametime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

Cuber QQ know an Edge Game, in which two players move their tokens on edges alternatively. Specifically, the game starts with a fixed and given undirected tree. Player A and Player B each has a token on one node. They move in turn. In each step, the player moves his/her own token to a node adjacent to the current node located. Player A moves first. The player who first moves his/her token on the other's wins. Determine if A can win if each plays optimally.

Input

In the first line there is one integer $$$n\;(2\le n\le 10^5)$$$, representing the number of nodes in the tree.

In each of the next $$$n-1$$$ lines are two integers $$$u,v\;(1\le u,v\le n,\; u\neq v)$$$ each, representing there is an edge between node $$$u$$$ and node $$$v$$$.

In the last line are two integers $$$a,b\;(1\le a,b\le n,\; a\neq b)$$$, representing the node A's token and B's token is on initially.

Output

One line "Yes" or "No", denoting the winner.

ExamplesInput
3
1 2
1 3
1 3
Output
Yes
Input
3
1 2
1 3
2 3
Output
No

加入题单

上一题 下一题 算法标签: