More Sudokus

Write a program to find all the possible solutions of a Sudoku.

Input

Input begins with a number nn, followed by nn Sudokus. Every Sudoku consists of 81 numbers between zero and nine, plus the characters shown in the examples. A zero indicates an unknown value. Except for zeros, there are no repeated numbers in any row, nor in any column, nor in any of the nine 3×33 \times 3 squares.

Output

For every Sudoku, print all the possible solutions in lexicographical order, each one followed by an empty line. Print “no solution” if there is no solution. Print a line with 30 asterisks after the output for every Sudoku.

Observation

The data tests are chosen so that a backtracking program that simply fills the rows from top to bottom and from left to right will be fast enough.

Problem information

Author: Unknown
Translator: Carlos Molina

Generation: 2026-01-25T12:03:05.393Z

© Jutge.org, 2006–2026.
https://jutge.org