#0000A0

z-sudoku

Little Z. is an expert for solving Sudoku. One time Vanja was visiting him and looked was very confused with what Mr. Little Z. was doing with this number game. Vanja asked Little Z. to teach him how to solve Sudoku puzzles, and the first step was to teach Vanja which of the Sudoku puzzes that Z. has already solved have a correct solution.


Sudoku is a game in which we have to fill out 9 different characters into a 9x9 mesh, with the following rules.:
• Every character has to be used exactly 9 times.
• There can not be 2 same characters in a single row.
• There can not be 2 same characters in a single column.
• There can not be 2 same characters in any of the 3x3 sub-squares (as shown on the figure below).


+-----+-----+-----+
|6 9 2|7 1 5|4 8 3|
|1 5 3|4 2 8|7 9 6|
|8 4 7|9 3 6|2 5 1|
+-----+-----+-----+
|2 8 5|3 6 1|9 7 4|
|3 7 4|5 8 9|6 1 2|
|9 6 1|2 7 4|5 3 8|
+-----+-----+-----+
|5 3 9|8 4 2|1 6 7|
|4 1 8|6 9 7|3 2 5|
|7 2 6|1 5 3|8 4 9|
+-----+-----+-----+


Help Vanja to determine if the Little Z's solutions are correct


InputFrom each of the first 9 lines of the standard input read 9 characters that represent the solution to the Sudoku puzzle. (the characters can be any ASCII characters with codes in the range 32..255] )

OutputTo the first line of the standard output write "YES" if the solution is correct, and write "NO" if it is not.
To the second line output all the characters that appear in the solution, sorted by their ASCII code.

Input:
113456789
asdfasdfa
fdsadfasd
654987321
qwerqwerq
6549 7521
4321lkj32
5;lk34;34
8grtez543

Output:
NO
 123456789;adefgjklqrstwz


Input:
!X54)ME0%
M)4E0%X!5
%E0!5XM4)
45E%M0)X!
0M%X!)5E4
X!)5E4%M0
5%X04E!)M
E4M)%!05X
)0!MX54%E

Output:
YES
!%)045EMX

Submit solution

Coming later

The grading service will be connected in a later migration step. You can inspect the task and your previous results now.