The first line of input consists of a single integer $T$ $(1 \leq T \leq 35)$, denoting the number of test cases. Each test case starts with a line of three integers $n, m, k$ $(2 \leq n \leq 10^4, 1 \leq m \leq 10^4, 2 \leq k \leq 6)$, denoting the number of rooms and the number of roads in the maze, and the number of gems he needed to collect, respectively. Each of the next $m$ lines contains three intergers $u, v, t$ $(1 \leq u, v \leq n, u \neq v, 1 \leq t \leq 10^8)$, specifying a road connecting the $u$th and the $v$th rooms, which took $t$ minutes to travel in either direction. No two roads connected the same pair of rooms.
There are at most 5 test cases with $\max\{n, m\} > 100$.