Triangle Construction

Time Limit: 10 Seconds    Memory Limit: 32768 KB

A large triangle can be constructed with n^2 small triangles. What we really care about is that the neighboring edges should have the same color. Given n^2 small triangles, you are to write a program to check whether such construction is possible. Notice the small triangles can be freely rotated or turned over.


Input

There are multiple tests. Each test starts with two positive integers N ( 1 <= N <= 4 ) and M ( 1 <= M <= 10 ). The following N^2 lines contain three integers from 1 to M, the colors of the three edges. There is a blank line separating different tests.

Output

"Possible" or "Impossible" on a single line by itself for each test, indicating whether such construction exists.

Sample Input

2 3
1 3 2
2 1 3
2 1 3
1 1 2
 
2 2
1 1 1
1 1 1
1 1 1
2 2 2

Sample Output

Possible
Impossible
Submit

Source: ZOJ Monthly, December 2002