시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 4 0 0 0.000%

문제

In Mini Sudoku X, there are 6 x 6 boxes to be filled with digits so that each row, column, main diagonal, and 2 x 3 square contains all the digits from 1 to 6. An example of a solution is as follows with the main diagonals shaded:

Write a program that reads a series of 36 digits representing a solution for
Mini Sudoku X, and determines whether the solution is correct.

입력

The first line has a positive integer T, T <= 100000, denoting the number of test cases. This is followed by each test case per line.

Each test case consists of six lines. Each line of the test case contains six 1-digit integers separated by a space. 

출력

For each test case, the output contains a line in the format Case #x: M, where x is the case number (starting from 1) and M is either 0 or 1. 1 if the test case represents a correct solution and 0 otherwise. 

예제 입력

10
1 1 4 3 6 4
3 2 3 5 2 1
4 2 3 2 2 3
2 6 4 3 3 2
2 3 1 2 3 3
4 6 3 1 3 5
2 5 3 3 5 2
2 1 6 4 4 4
5 6 1 1 5 2
1 4 3 4 1 1
6 1 5 3 4 3
4 1 3 2 5 1
2 6 4 3 4 4
1 2 2 4 5 3
1 3 3 2 6 1
2 6 3 2 2 4
4 3 5 1 1 2
4 3 6 2 5 5
4 1 6 2 4 3
3 1 1 1 1 1
1 2 1 1 6 1
4 6 3 5 1 5
5 3 2 2 1 1
4 6 4 1 2 3
2 1 6 1 1 2
3 5 4 2 3 4
3 2 4 2 5 3
3 3 2 4 4 6
4 4 4 3 4 3
4 4 3 1 4 3
3 4 1 6 2 5
6 5 2 4 3 1
1 3 4 2 5 6
5 2 6 1 4 3
2 1 3 5 6 4
4 6 5 3 1 2
3 5 4 2 3 1
5 2 1 3 2 4
4 1 3 6 2 6
2 3 4 1 2 4
3 2 4 4 3 1
5 2 5 4 2 4
3 2 1 3 2 5
2 4 4 4 2 2
1 6 4 5 1 5
6 6 3 3 6 3
1 4 4 6 3 2
3 3 1 2 4 1
1 3 4 4 3 2
3 6 1 4 1 1
3 4 5 1 2 5
2 1 5 1 3 2
2 6 3 1 2 2
4 2 2 2 2 1
4 1 3 5 3 4
1 5 4 4 3 3
4 5 1 2 5 1
4 1 5 5 1 2
3 5 3 6 2 6
3 4 6 3 3 5

예제 출력

Case#1: 0
Case#2: 0
Case#3: 0
Case#4: 0
Case#5: 0
Case#6: 1
Case#7: 0
Case#8: 0
Case#9: 0
Case#10: 0

힌트