#P8296. [COCI 2012/2013 #2] KRIZALJKA
[COCI 2012/2013 #2] KRIZALJKA
Background
The score for this problem follows the original COCI setting, with a full score of .
Problem Description
Do you like playing crossword puzzles? If so, you may know the traditional beginner puzzle shown below:

-
Horizontally:
-
A device used to cool a computer
-
Solid water
-
Used to obtain
-
-
Vertically:
-
A small, soft, sweet fruit
-
A powerful playing card
-
A fisherman's tool
-
Given six three-letter words, you need to place them into a grid so that these words all appear both horizontally and vertically.
Input Format
The input consists of lines, each containing a three-letter word in uppercase letters. They are guaranteed to be given in lexicographical order.
Output Format
If no solution exists, output . Otherwise, output a matrix of letters in three lines.
If multiple solutions exist, output the solution with the smallest lexicographical order of the nine characters formed by concatenating each row end-to-end.
ANA
ANA
DAR
DAR
RAD
RAD
DAR
ANA
RAD
EVO
HEP
HIR
IVA
PAD
ROD
HEP
IVA
ROD
AKO
CES
DOC
DON
ESI
KES
0
Hint
Translated by ChatGPT 5