Sudoku 2
시간 제한1초메모리 제한512 MB
n^2 × n^2 크기의 유효한 스도쿠 판에서 행, 열, 부분 격자의 중복을 피하면서 빈칸을 최대한 많이 채운다.
문제
Fereydun, the legendary Persian hero whose prophecy was to overcome Zahhak, believes that he needs a powerful mind together with a powerful body. He has just learned a new brain teaser, called Sudoku, from a Japanese trader.
Sudoku is played on a board that is a grid of cells. The whole grid is also partitioned into sub-grids, each of size . Each cell can be empty or contain an integer from to (inclusive). A Sudoku board is valid if it meets the following conditions:
- All numbers in each row are distinct.
- All numbers in each column are distinct.
- All numbers in each sub-grid are distinct.
The following figure shows two valid Sudoku boards with no empty cells:

Fereydun has a valid board with some empty cells and has asked for your help. Your task is to fill as many empty cells as you can while keeping the board valid. It is guaranteed that there is at least one way to fill all the empty cells while keeping the board valid.
This is an output-only problem, so no source code submission is required. There are test cases. For each test case, you are given an input file containing a table as the initial state of a Sudoku board, and your task is to submit an output file containing a table as the final state of that Sudoku board after filling some of its empty cells. All and values (for ) are integers between and (inclusive), where value indicates an empty cell.
입력
The input is in the following format:
- line :
- line (for ):
출력
The output must be in the following format:
- line (for ):
제한
- ,
- ,
- The board is valid, and all of its empty cells can be filled while keeping it valid.