12021202
6 1 8 | 5 3 7 | 4 9 2 |
5 9 4 | 1 8 2 | 6 3 7 |
2 3 7 | 4 6 9 | 8 5 1 |
3 7 2 | 6 5 1 | 9 x 8 |
9 4 5 | 3 x 8 | 1 x 6 |
1 8 6 | 2 9 4 | 5 7 3 |
7 6 3 | 8 4 5 | 2 1 9 |
8 5 1 | 9 2 3 | 7 6 4 |
4 2 9 | 7 1 6 | 3 8 5 |
6 1 8 | 5 3 7 | 4 9 2 |
5 9 4 | 1 8 2 | 6 3 7 |
2 3 7 | 4 6 9 | 8 5 1 |
3 7 2 | 6 5 1 | 9 4 8 |
9 4 5 | 3 7 8 | 1 2 6 |
1 8 6 | 2 9 4 | 5 7 3 |
7 6 3 | 8 4 5 | 2 1 9 |
8 5 1 | 9 2 3 | 7 6 4 |
4 2 9 | 7 1 6 | 3 8 5 |
'Special blank' means that its row has been filled with 8 numbers, or its column has been filled with 8 numbers, or its 3*3 subgrid has been filled with 8 numbers.
For the sample input, you can choose the order (5,5),(4,8),(5,8) to fill the blank. Initially, (5,5) and (4,8) are the 'special blanks', since that (5,5)'s 3*3 subgrid and (4,8)'s row have already been filled with eight numbers. When (5,5) is filled, (5,8) becomes a new 'special blank'. After filling (4,8) and (5,8), the sudoku is completed.
6 1 8 | 5 3 7 | 4 9 2 |
5 9 4 | 1 x x | 6 3 7 |
2 3 7 | 4 6 9 | 8 5 1 |
3 7 2 | 6 5 1 | 9 4 8 |
9 4 5 | 3 x x | 1 2 6 |
1 8 6 | 2 9 4 | 5 7 3 |
7 6 3 | 8 4 5 | 2 1 9 |
8 5 1 | 9 2 3 | 7 6 4 |
4 2 9 | 7 1 6 | 3 8 x |
For this test case, the most lower-right x is the first 'special blank' that we seek. However, after filling that, you can not find any other 'special blank', so just print 'The test data is incorrect!'