P27949 [洛谷] [CCPC 2023 Beijing Competition] Game
普及+
题目描述

Problem Description

Xiao I and Xiao J are playing a game again.

Xiao J has found a tree with $n$ nodes. Each edge in the tree has two states: open and closed. Initially, all edges in the tree are open.

A piece is initially placed on node $1$. Xiao I can move the piece with the goal of moving it to a node with exactly one adjacent edge; Xiao J can close edges in the tree with the goal of preventing Xiao I from moving the piece to a node with exactly one adjacent edge.

The game consists of several rounds, each with the following steps:

  1. Xiao I's task check: If the piece is on a node with exactly one adjacent edge, Xiao I wins; otherwise, proceed to step 2.
  2. Xiao J's action: Xiao J permanently closes an open edge. If there are no open edges, Xiao J skips this action and proceeds to step 3.
  3. Xiao I's action: Xiao I chooses an open edge connected to the current node of the piece and moves the piece to the other node of this edge. If there are no such edges, Xiao J wins; otherwise, a new round starts, returning to step 1.

Xiao J wants to know, if both Xiao I and Xiao J know the structure of the tree and are extremely intelligent, who will win.

Input Format

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

Output Format

If Xiao I wins, output You win, temporarily.; otherwise, output Wasted..

Sample Input and Output

Sample Input #1

6
1 2
2 3
2 4
1 5
5 6

Sample Output #1

Wasted.

Sample Input #2

7
1 2
2 3
2 4
1 5
5 6
5 7

Sample Output #2

You win, temporarily.

Notes

[Explanation of Sample 1]

Xiao J's strategy is as follows:

  • Xiao J closes edge $(1,2)$, forcing Xiao I to move to node $5$;
  • Xiao J closes edge $(5,6)$, forcing Xiao I to move back to node $1$;
  • Xiao J closes edge $(1,5)$, leaving Xiao I unable to move.
输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
6 1 2 2 3 2 4 1 5 5 6
样例输出
Wasted.