CF1110G Tree-Tac-Toe

Description

The tic-tac-toe game is starting on a tree of $ n $ vertices. Some vertices are already colored in white while the remaining are uncolored. There are two players — white and black. The players make moves alternatively. The white player starts the game. In his turn, a player must select one uncolored vertex and paint it in his color. The player wins if he paints some path of three vertices in his color. In case all vertices are colored and neither player won, the game ends in a draw. Could you please find who will win the game or whether it ends as a draw, assuming both players play optimally?

Input Format

N/A

Output Format

N/A

Explanation/Hint

In the first example, vertex $ 4 $ is already colored in white. The white player can win by coloring the vertex $ 1 $ in white first and the remaining vertex on his second turn. The process is illustrated with the pictures below. ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF1110G/66766f770bbd5d6623a788ef15b807570e5f6f5a.png)In the second example, we can show that no player can enforce their victory.