Sudoku
题号:NC216089
时间限制:C/C++/Rust/Pascal 3秒,其他语言6秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

Sudoku is a game that gives a 9*9 grid.

Your task is to fill a 9*9 grid with digits so that each column, each row, and each of the nine 3*3 sub-grid which compose the grid contain all of the digits from 1 to 9.

A grid with some digits will be given. Try to work out a solution. 

输入描述:

The first line contains one integerN. 
The nextN lines contains 3 integersX, Y, Z, representing the valueZin(X, Y).

输出描述:

Output a 9*9 grid.
示例1

输入

复制
25
1 2 6
1 3 5
1 9 7
2 1 7
2 5 2
2 7 6
2 9 4
3 1 2
3 4 1
4 6 2
4 7 5
5 2 4
5 3 2
5 4 8
5 7 1
6 4 9
6 6 7
7 3 7
7 5 5
8 1 5
8 4 2
8 8 8
8 9 9
9 1 6
9 3 8

输出

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

说明

The sample input is like: