#P10039. [CCPC 2023 北京市赛] 游戏

[CCPC 2023 北京市赛] 游戏

Problem Description

Little I and Little J are playing a game again.

Little J brings a tree with nn nodes. Each edge on the tree has two states: open and closed. Initially, every edge on the tree is open.

Initially, there is a token placed on node 11. Little I can move the token, and the goal is to move the token to a node whose degree is exactly 11. Little J can close edges on the tree, and the goal is to prevent Little I from moving the token to a node whose degree is exactly 11.

The game consists of several rounds. Each round has the following steps:

  1. Little I win check: If the token is on a node whose degree is exactly 11, then Little I wins. Otherwise, go to step 2.
  2. Little J action: Little J chooses one currently open edge and permanently closes it, then go to step 3. If there is no open edge at the moment, skip this action and go directly to step 3.
  3. Little I action: Little I chooses one open edge that is connected to the node where the token currently is, and moves the token to the other endpoint of this edge. If there is no such edge, Little J wins. Otherwise, start a new round and return to step 1.

Little J wants to know: if both Little I and Little J know the shape of the tree and are extremely smart, who will win.

Input Format

The first line contains an integer n(1n105)n (1 \le n \le 10^5), denoting the number of nodes in the tree. The next n1n-1 lines each contain two integers u,v(1u,vn)u,v (1 \le u, v \le n), denoting an edge in the tree.

Output Format

If Little I wins, output You win, temporarily.. Otherwise, output Wasted..

6
1 2
2 3
2 4
1 5
5 6
Wasted.
7
1 2
2 3
2 4
1 5
5 6
5 7
You win, temporarily.

Hint

[Sample Explanation 1]

Little J's strategy is as follows:

  • Little J closes (1,2)(1,2), so Little I can only move to 55.
  • Little J closes (5,6)(5,6), so Little I has to move back to 11.
  • Little J closes (1,5)(1,5), so Little I cannot move.

Translated by ChatGPT 5