SUDOKU - Sudoku

题意翻译

## 题目大意 一个数独的网格是由$16*16$个小格组成的, 这些小格又被分为$4*4=16$个小组, 一些小格填入了从$A$至$P$(字母表前$16$个)的字母,不过一般填成数字。 游戏目的是将所有小格填满,而使每行,每列和每个$4*4$小组中不重复的包含这$16$个字母。 给出的初始状态满足以上要求且满足唯一解。 ## 输入输出格式: ### 输入格式: 第一行包含一个整数$K$($K<=10$),表示有$K$组数据. 每一组数据会有$16$字符一行,共$16$行字符串,其中以'-'表示空格. 每两组数据间由空行相隔. ### 输出格式: 对每组数据输出一个$16*16$的表格,要求按照原输入顺序和格式输出. 每两组数据间由空行相隔.

题目描述

A Sudoku grid is a 16x16 grid of cells grouped in sixteen 4x4 squares, where some cells are filled with letters from A to P (the first 16 capital letters of the English alphabet), as shown in the figure. The game is to fill all the empty grid cells with letters from A to P such that each letter from the grid occurs once only in the line, the column, and the 4x4 square it occupies. The initial content of the grid satisfies the constraints mentioned above and guarantees a unique solution. A C O I J A B P C G F H D F I E P G E L H M J E C G I K G A B E J D G P J F A E C B D P O E F M D L K A C O I L H P C F A B G O D J H K J H A P L B P E K A H B K F I C F C D H N

输入输出格式

输入格式


The first line of the input contains an integer K - determining the number of datasets (K<=10). Each data set encodes a grid and contains 16 strings on 16 consecutive lines as shown in the example input below. The ith string stands for the ith line of the grid, is 16 characters long, and starts from the first position of the line. String characters are from the set {A,B,…,P,-}, where – (minus) designates empty grid cells. The data sets are separated by single empty lines.

输出格式


For each data set in the input print the completed 16x16 Sudoku as specified by the rules above. The program prints the solution of the input encoded grids in the same format and order as used for input. The output for each data set should be separated by single empty lines.

输入输出样例

输入样例 #1

1
--A----C-----O-I 
-J--A-B-P-CGF-H-
--D--F-I-E----P-
-G-EL-H----M-J--
----E----C--G---
-I--K-GA-B---E-J 
D-GP--J-F----A--
-E---C-B--DP--O-
E--F-M--D--L-K-A 
-C--------O-I-L-
H-P-C--F-A--B---
---G-OD---J----H 
K---J----H-A-P-L 
--B--P--E--K--A-
-H--B--K--FI-C--
--F---C--D--H-N-

输出样例 #1

FPAHMJECNLBDKOGI 
OJMIANBDPKCGFLHE 
LNDKGFOIJEAHMBPC 
BGCELKHPOFIMAJDN 
MFHBELPOACKJGNID 
CILNKDGAHBMOPEFJ 
DOGPIHJMFNLECAKB 
JEKAFCNBGIDPLHOM 
EBOFPMIJDGHLNKCA 
NCJDHBAEKMOFIGLP 
HMPLCGKFIAENBDJO 
AKIGNODLBPJCEFMH 
KDEMJIFNCHGAOPBL 
GLBCDPMHEONKJIAF 
PHNOBALKMJFIDCEG 
IAFJOECGLDPBHMNK