| UNICAMP Freshman Contest 2025 |
|---|
| Finished |
After much thought, Po decided to leave his position as Dragon Warrior to study Computer Science at Unicamp. However, since the trip from China to Campinas is not cheap, he started to invest in the Tigrinho Game.
Po plays a simplified version of the Tigrinho Game, developed by Tigress's family. In this version, the player pays 5 reais to Tigrinho, who reveals a $$$3 \times 3$$$ matrix consisting of integers from 1 to 9 and possibly some wildcards. For each of the 3 rows and the 2 diagonals of the matrix, if the row or diagonal contains all equal numbers, the player gets 1 real back. Since wildcards are not numbers, they can be ignored, so, for example, a row with 2 equal numbers and a wildcard also pays 1 real back to the player.
At first, it may seem that the game depends purely on luck, but Po discovered that if he plays with strategy, he can predict the number of wildcards that will appear in the matrix. But since Po also doesn't want to take risks, he wants to know, given the number of wildcards in the matrix, what possible matrix will give him the lowest profit.
The input consists of a single integer $$$K$$$ ($$$0 \leq K \leq 9$$$) — the number of wildcards in the matrix.
Print 3 lines, each with 3 characters and a line break, representing the matrix with $$$K$$$ wildcards that gives the lowest profit. Use the character * (asterisk) to represent a wildcard and the digits 1 to 9 to represent the numbers in the matrix.
If there is more than one matrix with $$$K$$$ wildcards that gives the lowest profit, print any one of them.
Do not print spaces between the elements of the matrix.
1
*29 239 179
The matrix shown in the example does not pay any money back to Po. Note that, although the third column has $$$3$$$ equal numbers, only rows and diagonals give money.
| Name |
|---|


