题目描述
Problem Background
This problem's score is set according to the original COCI contest, with a maximum score of $80$.
Problem Description
Do you enjoy playing crossword puzzles? If so, you might be familiar with the traditional beginner's game, as shown below:

- Horizontally:
-
Device used to cool computers
-
Solid state of water
-
Used to obtain
- Vertically:
-
Small, soft, and sweet fruit
-
Strong paper card
-
Fisherman's tool
Given six three-letter words, you need to place them in a $3\times 3$ grid such that these words appear both horizontally and vertically.
Input Format
The input consists of 6 lines, each containing a three-letter uppercase word. The words are guaranteed to be given in lexicographical order.
Output Format
If no solution exists, output $0$. Otherwise, output the letter matrix in a 3x3 format.
If there are multiple solutions, output the one with the smallest lexicographical order when the nine characters formed by concatenating the first and last characters of each row are considered.
Sample Input and Output
Sample Input #1
ANA
ANA
DAR
DAR
RAD
RAD
Sample Output #1
DAR
ANA
RAD
Sample Input #2
EVO
HEP
HIR
IVA
PAD
ROD
Sample Output #2
HEP
IVA
ROD
Sample Input #3
AKO
CES
DOC
DON
ESI
KES
Sample Output #3
0
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分