P29843 [洛谷] "Wdoi-6" The Moon on the Other Side
提高+
题目描述

Problem Background

"One of humanity's dreams, lunar travel, has finally become possible for ordinary people!"
"Starting next month, various travel companies in Japan will begin to offer lunar tours."

However, the surface of the moon is separated from the desolate lifeless planet by a barrier surrounding the Lunar Capital. As long as this barrier exists, people can only see stones.

The cost of a lunar tour is far beyond the means of Renko and Merry, two college students. Yet, what they seek to explore is the highly advanced civilization of the Lunar Capital, hidden behind the barrier.

This is the moon on the other side. Merry has seen it. Rabbits pounding medicine, celestial maidens dressed in splendid attire, gracefully dancing in the sky.

"I say, Renko. If lunar travel is too expensive, shall we try to think of another way to get to the moon?"

Problem Description

Brief Overview

Given a tree with $n$ nodes (guaranteed $n \ge 2$), Hifuu and Luna take turns operating, with Hifuu starting first. Each turn, the player selects a node and deletes "that node" and "all edges connected to that node," forming several connected components. The player then retains one of these components. If only one node remains after a turn, the player in that turn loses, and the other player wins. Determine who has a winning strategy.

Detailed Description

However, the Lunar Capital is protected by a barrier, meaning Renko and Merry must break through this barrier to complete their lunar journey.

The barrier of the Lunar Capital consists of $n$ nodes and $n-1$ spiritual energy channels, forming a connected structure, with node numbers ranging from $1$ to $n$. The barrier has a central control system to prevent outsiders from breaking through and reaching the Lunar Capital. Renko and Merry need to interact with this control system to enter the Lunar Capital.

Specifically, Renko, Merry, and the central control system take turns operating, with Renko and Merry being the first movers. The operator can choose any node on the barrier, sever all spiritual energy channels connected to this node, and discard this node. This means the barrier is divided into several groups of nodes, with no spiritual energy channels between groups, but nodes within a group are connected by spiritual energy channels. Among these node groups, the operator can retain one group and discard all other nodes, meaning those discarded nodes can no longer be operated on.

Under these rules, if only one node remains after an operation, the operator loses, and the other player wins. Now, Renko and Merry want to know if they have a strategy that guarantees they can reach the Lunar Capital under these rules.

Input and Output Formats

Input Format

This problem contains multiple test cases. The first line contains a positive integer $T$, indicating the number of test cases. For each test case:

  • The first line contains a positive integer $n$.
  • The next $n-1$ lines each contain two positive integers $u_i, v_i$, indicating a bidirectional spiritual energy channel connecting nodes $u_i$ and $v_i$.

Output Format

For each test case, output whether Renko and Merry can reach the Lunar Capital. Specifically, if they have a strategy that guarantees they can reach the Lunar Capital, output $\texttt{Hifuu}$; otherwise, output $\texttt{Luna}$.

Sample Input and Output

Sample Input #1

1
5
2 4
1 2
3 1
5 2

Sample Output #1

Hifuu

Sample Input #2

1
11
1 2
1 3
1 4
2 5
2 6
4 7
5 8
5 9
9 10
9 11

Sample Output #2

Hifuu

Sample Input #3

1
2
1 2

Sample Output #3

Luna

Notes

Sample Explanation

Sample #1

Figure 1 shows the barrier. Figures 2 and 3 demonstrate one possible winning strategy for Renko and Merry: selecting node $2$, then retaining the connected component $\{1,3\}$, ensuring the central control system loses regardless of whether it chooses node $1$ or $3$.

Sample #2


Data Range

This problem uses batched testing.

$$ \def\arraystretch{1.5} \begin{array}{|c|c|c|c|c|}\hline \textbf{Subtask} & \textbf{\textsf{Points}} & \bm{n\le } & \textbf{\textsf{Special Conditions}} & \textbf{Subtask \textsf{Dependencies}}\cr\hline 1 & 15 & 8 & - & - \cr\hline 2 & 20 & 10^5 & \mathbf{A} & -\cr\hline 3 & 20 & 10^5 & \mathbf{B} & - \cr\hline 4 & 15 & 10^3 & - & 1 \cr\hline 5 & 30 & 10^5 & - & 2,3,4 \cr\hline \end{array} $$

  • Special condition $\mathbf{A}$: Guarantees the existence of a node with degree $n-1$.
  • Special condition $\mathbf{B}$: Guarantees $n=2^k-1, k \in \N^*$. The tree is a complete binary tree.

For $100\%$ of the data: $1 \leq T \leq 5$, $2 \le n \le 10^5$, the input data forms a tree.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
1 5 2 4 1 2 3 1 5 2
样例输出
Hifuu