CF1404B Tree Tag

Description

Alice and Bob are playing a fun game of tree tag. The game is played on a tree of $ n $ vertices numbered from $ 1 $ to $ n $ . Recall that a tree on $ n $ vertices is an undirected, connected graph with $ n-1 $ edges. Initially, Alice is located at vertex $ a $ , and Bob at vertex $ b $ . They take turns alternately, and Alice makes the first move. In a move, Alice can jump to a vertex with distance at most $ da $ from the current vertex. And in a move, Bob can jump to a vertex with distance at most $ db $ from the current vertex. The distance between two vertices is defined as the number of edges on the unique simple path between them. In particular, either player is allowed to stay at the same vertex in a move. Note that when performing a move, a player only occupies the starting and ending vertices of their move, not the vertices between them. If after at most $ 10^{100} $ moves, Alice and Bob occupy the same vertex, then Alice is declared the winner. Otherwise, Bob wins. Determine the winner if both players play optimally.

Input Format

N/A

Output Format

N/A

Explanation/Hint

In the first test case, Alice can win by moving to vertex $ 1 $ . Then wherever Bob moves next, Alice will be able to move to the same vertex on the next move. ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF1404B/49586895aed4babac3e35aba1e1c4162a3ac0674.png)In the second test case, Bob has the following strategy to win. Wherever Alice moves, Bob will always move to whichever of the two vertices $ 1 $ or $ 6 $ is farthest from Alice. ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF1404B/514885d88075ac42c59e9da88fb4903131f99500.png)