Curling up the cube 

A paper cube can be made up from six paper squares Given an projection (map) of the cube, you are to determine its correctness. A projection is correct, if a cube can be made up from it.

The Input

The first line is the number of test cases, followed by a blank line.

Input for each test case, contains a projection represented as a 6*6 grid containing six ones and 30 zeroes, separated by spaces. 1s represent the paper squares. All squares are placed immediately to each other, so that each square is connected with at least one other square.

Each test case will be separated by a single line.

The Output

For each test case, your program should print "correct" if cube can be made up from the given project, or "incorrect" otherwise.

Print a blank line between the outputs for two consecutive test cases.

Sample Input

2

0 0 0 0 0 0
0 0 0 1 0 0
0 0 0 1 0 0
0 0 1 1 1 0
0 0 0 1 0 0
0 0 0 0 0 0

0 0 0 0 0 0
0 0 0 1 1 0
0 0 1 1 0 0
0 0 0 1 1 0
0 0 0 0 0 0
0 0 0 0 0 0

Sample Output

correct

incorrect

Alex Gevak
September 10, 2000 (Revised 2-10-00, Antonio Sanchez)