#1082
Unrated
KRIZALJKA
시간 제한
1s
메모리 제한
32MB
제출
0
정답
0
맞힌 사람
0
정답 비율
0.0%

문제

Author: Adrian Satja Kurdija

Do you like to solve crosswords? If you do, you probably know the traditional lead-in for beginners – small 3 by 3 crosswords, like the following1:

1 2 3

2

3

Horizontal: 1. device used to cool a PC 2. solid water 3. to obtain

Vertical: 1. small, soft, sweet fruit 2. strong playing card 3. fisherman's tool

1Solve a crossword like this one! Not gonna happen? Fine, then at least put it together given six words that appear in it (three as horizontal and three as vertical).

입력

Each of the six lines of input contains a word consisting of three uppercase English letters. The words are given in a lexicographically sorted order.

출력

If it is impossible to put together a 3 by 3 crossword using the given six words, output 0. Otherwise, output the crossword in three lines. If there is more than one possible solution, output the one that is first in lexicographic order, where, for sorting purposes, the crossword is viewed as a nine-letter word obtained by concatenating its rows.

예제 입력 1

ANA
ANA
DAR
DAR
RAD
RAD

예제 출력 1

DAR
ANA
RAD

예제 입력 2

EVO
HEP
HIR
IVA
PAD
ROD

예제 출력 2

HEP
IVA
ROD

예제 입력 3

AKO
CES
DOC
DON
ESI
KES

예제 출력 3

0
코드 제출

코드를 제출하려면 로그인이 필요합니다.

로그인
내 제출
제출 내역이 없습니다.
맞은 사람
아직 맞은 사람이 없습니다.
난이도 투표
Unrated0명 투표
로그인 후 AC 받으면 투표할 수 있습니다.
전체 제출
제출 내역이 없습니다.