The Road to the Classroom

No attempts yetTime limit3sMemory limit128 MB

Problem

A class has KK students in total, and some of them dislike each other intensely. Students who dislike each other never want to run into one another anywhere outside the classroom on their way to school. Every student starts at intersection 11 and walks to intersection 22, where the classroom is. Determine whether the students can be assigned KK distinct routes such that, apart from the start (11) and the destination (22), no two routes share any intersection or any road.

Input

The input consists of several test cases.

The first line of each test case contains the number of routes to assign, KK, and the number of intersections, NN. The intersections are numbered from 11 to NN. Among the following NN lines, the ii-th line lists, in increasing order, the numbers of the intersections directly connected to intersection ii. Every intersection is connected to at least one other intersection.

The last line of the input is 0 0, which should not be processed.

1K1001 \le K \le 100 and 2N50002 \le N \le 5000. Every student starts at intersection 11, and the classroom is at intersection 22.

Output

For each test case, first print the case number xx in the format Case x: (numbering starts at 11). On the next line, print Possible if KK routes satisfying the condition can be assigned, or Impossible otherwise.

After the result of each test case, print one blank line.