Puzzling Numbers

input file: puzzle.in

A simple form of number puzzle consists of nine rows of nine numbers or spaces each.   One possible number puzzle is given below:

7 _ 4
9 2 5
8 3 6
5 _ 8
7 3 _
4 1 2
3 6 _
1 _ _
_ 7 _
7 _ 4
9 2 5
8 3 6
5 _ 8
7 3 _
4 1 2
3 6 _
1 _ _
_ 7 _
7 _ 4
9 2 5
8 3 6
5 _ 8
7 3 _
4 1 2
3 6 _
1 _ _
_ 7 _

To solve the problems, numbers are filled into the blank spaces so that each row, each column, and each darkly shaded 3 by 3 box has the digits 1 through 9 in it exactly one time.  

Write a program to find a solution to this type of number puzzle.   The input will consist of puzzles with exactly one solution.

Input

The input consists of one or more test cases. Each test case will consist of nine lines with nine digits on each line.   There may be 0 or more blanks between the digits.   The digits '1' through '9' will represent a number and the digit '0' will represent a blank square.   The end of input is indicated by the end of the file.

Output

For each test case print, in the format shown below, the number of the case (preceded by the word 'Puzzle'), and the solved puzzle. Separate the digits by a single space and have a blank line after each puzzle.

Sample Input

023 456 789
406 789 123
780 123 456
234 067 891
567 801 234
891 230 567
345 678 012
678 912 305
912 345 670
7 0 4  5 0 8  3 6 0
9 2 5  7 3 0  1 0 0
8 3 6  4 1 2  0 7 0
6 7 0  1 2 4  8 5 0
3 0 1  0 0 0  6 2 0
0 5 8  0 0 0  7 4 0
4 0 3  6 8 0  2 1 7
1 8 0  2 4 0  5 3 6
5 0 2  3 7 1  4 0 8

Output corresponding to the Sample Input

Puzzle 1
1 2 3 4 5 6 7 8 9
4 5 6 7 8 9 1 2 3
7 8 9 1 2 3 4 5 6
2 3 4 5 6 7 8 9 1
5 6 7 8 9 1 2 3 4
8 9 1 2 3 4 5 6 7
3 4 5 6 7 8 9 1 2
6 7 8 9 1 2 3 4 5
9 1 2 3 4 5 6 7 8

Puzzle 2
7 1 4 5 9 8 3 6 2
9 2 5 7 3 6 1 8 4
8 3 6 4 1 2 9 7 5
6 7 9 1 2 4 8 5 3
3 4 1 8 5 7 6 2 9
2 5 8 9 6 3 7 4 1
4 9 3 6 8 5 2 1 7
1 8 7 2 4 9 5 3 6
5 6 2 3 7 1 4 9 8

Giving credit:

To find more Number Puzzles, look at Dell Magazine's Math Puzzles and Logic Problems.