sudoku

Sudoku, also known as Number Place, is a logic-based placement puzzle. The aim of the puzzle is to enter a digit from 1 through 9 in each cell of a 9×9 grid made up of 3×3 subgrids (called "regions"), starting with various digits given in some cells. See the picture below (the regions are delimited by thick lines).


Each row, column, and region must contain only one instance of each digit. Completing the puzzle requires patience and logical ability. Although first published in a U. S. puzzle magazine in 1979, Sudoku initially caught on in Japan in 1986 and attained international popularity in 2005.

Task

Write a program that solves the sudoku puzzle.

Input data


Input file sudoku.in contains 9 lines, each line containing a sequence of 9 digits, corresponding to the rows of the board. Blank cells are denoted by zeros.

Output data

Output file sudoku.out will contain 9 lines, each line containing 9 nonzero distinct digits, representing the solution of the puzzle. The digits written on the same line will not be separated by spaces.

Constraints

Each test puzzle has a unique solution.

Example

sudoku.in sudoku.out
530070000
600195000
098000060
800060003
400803001
700020006
060000280
000419005
000080079

534678912
672195348
198342567
859761423
426853791
713924856
961537284
287419635
345286179

Time limit: 0.15 seconds

Prof. DSc Stoyan Kapralov
Technical University - Gabrovo, Bulgaria
Contact: s.kapralov@gmail.com