Shifting Paths (Small)

Count the steps of a walk that alternates between two outgoing edges at each revisit, or report Infinity when clearing N is never reached.

Medium6SimulationGraphNo attempts yetTime limit5sMemory limit512 MB

Problem

You have been walking in the woods for hours and you want to go home.

The woods contain NN clearings numbered 11 to NN. You are standing in clearing 11, and you leave the woods only when you reach clearing NN. Every clearing from 11 to N1N-1 has one left path and one right path leading out of it, plus any number of one way paths leading in.

The trees shift and block paths. On your kk-th visit to a clearing:

  • you must leave along the left path when kk is odd,
  • you must leave along the right path when kk is even.

Every path is one way and only one of the two outgoing paths is open, so you never have a choice at a clearing. You must follow the open path.

The first time you stand in clearing 11 you leave along its left path. If you come back to clearing 11, you leave along its right path, and on the third visit you leave along the left path again.

Count the paths you have to follow to get from clearing 11 to clearing NN.

Input

The first line contains the number of test cases TT.

Each test case begins with a line containing one integer NN. The next N1N-1 lines follow, and line ii contains two integers LiL_i and RiR_i. Here LiL_i is the clearing you arrive at after leaving clearing ii along the left path, and RiR_i is the clearing you arrive at after leaving it along the right path.

No paths are given for clearing NN because the walk ends there.

Output

For each test case, print one line in the form "Case #x: y", where xx is the test case number starting from 11 and yy is the number of paths you follow to reach clearing NN.

If you never reach clearing NN, print "Infinity" in place of yy.

Limits

  • 1T301 \le T \le 30
  • 2N102 \le N \le 10
  • 1Li,RiN1 \le L_i, R_i \le N

Hint

In the first test case of the first example, the route out of the woods is the following.

Paths followedClearingDirection taken
01left
12left
23left
32right
41right
51left
62left
73right
84arrived