Indiana Jones Among the Zombies

No attempts yetTime limit6sMemory limit128 MB

Problem

Indiana Jones has finished his search for the Amulet of Body and Mind Control with mixed fortune. The good news is that he found the amulet. The bad news is that the labyrinth he is trapped in is full of zombies, and the amulet he planned to use against them does not work. Indiana has to fall back on the old way of fighting the undead: shooting them at close range with a Smith and Wesson revolver.

The labyrinth has NN chambers numbered from 11 to NN. Indiana is in chamber 11. Each of the other chambers initially holds exactly one zombie. Chambers are connected by two-way corridors.

Every turn, each surviving zombie moves one step along a corridor to the next chamber on a shortest path from its current chamber to Indiana's chamber (chamber 11). If no path leads from a zombie's chamber to Indiana's chamber, that zombie stays where it is. If a chamber has several shortest paths toward Indiana's chamber, the zombies there take the corridor that appears first in the input.

Indiana's revolver holds KK bullets. If at most KK zombies arrive in Indiana's chamber during a turn, he shoots them all. Otherwise he is eaten.

Determine whether Indiana escapes unharmed, and if not, find the turn in which he is eaten.

Input

The first line contains one natural number ZZ (1Z101 \le Z \le 10), the number of test sets. The test sets follow.

The first line of each test set contains three space-separated natural numbers NN, MM, and KK (1N,M,K1061 \le N, M, K \le 10^6): NN is the number of chambers, MM the number of corridors, and KK the capacity of Indiana's revolver.

Each of the next MM lines describes one corridor as a pair of distinct natural numbers AA and BB (1A,BN1 \le A, B \le N), meaning a two-way corridor connects chambers AA and BB. Every pair of chambers is joined by at most one corridor.

Output

For each test set, print on its own line the turn in which Indiana is eaten (the zombies make their first move on turn 11), or the word hurray! if Indiana survives.