#K80882. Sudoku Solver

    ID: 35629 Type: Default 1000ms 256MiB

Sudoku Solver

Sudoku Solver

Solve the classic Sudoku puzzle. You are given a 9×9 grid, where each row, column, and each of the three 3×3 subgrids (blocks) must contain the digits 1 through 9 exactly once. Empty cells are represented by a dot ('.'). It is guaranteed that the puzzle has a unique solution.

The constraint can be expressed in LaTeX as follows: Every row, column, and 3×3 subgrid satisfies $$ \{1,2,3,4,5,6,7,8,9\}. $$

Your task is to fill in the missing numbers and output the complete Sudoku grid.

inputFormat

The input consists of 9 lines. Each line contains 9 tokens separated by a space. Each token is either a digit from '1' to '9' or a dot ('.') representing an empty cell.

outputFormat

Output the completed Sudoku grid as 9 lines, each line having 9 digits separated by a single space. The output should exactly fill the Sudoku board.

## sample
5 3 . . 7 . . . .
6 . . 1 9 5 . . .
. 9 8 . . . . 6 .
8 . . . 6 . . . 3
4 . . 8 . 3 . . 1
7 . . . 2 . . . 6
. 6 . . . . 2 8 .
. . . 4 1 9 . . 5
. . . . 8 . . 7 9
5 3 4 6 7 8 9 1 2

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

</p>