The Gourmet Club
Time Limit: 1 Second Memory Limit: 32768 KB
Special Judge
ABCD EFGH IJKL MNOP
AEIM BFJN CGKO DHLP
AFKP BGLM CHIN DEJO
The members of the gourmet club were identified by the letters A,B,C,...,P.
Each line represents one evening of seating with each set of four letters a single table. Thus on the first evening A dines with B, C and D etc. Write a program that will read from the input file the seating arrangement of the first three evenings and will either complete the schedule or determine that the Maitre D' screwed up.
Input
Each data set will be 3 lines. Each line will consist of four blocks, each 4 letters long. All letters will be in upper case. Blocks will be separated by "white space". Data sets will be separated by blank lines.
Output
For a successful schedule, echo the input and add two lines showing the successful schedule. If it is not possible to complete the schedule, do not echo the input, but print "It is not possible to complete this schedule." Separate output for each data set with a blank line.
Sample Input
ABCD EFGH IJKL MNOP AEIM BFJN CGKO DHLP AFKP BGLM CHIN DEJO
Sample Output
It is not possible to complete this schedule.Submit
Source: Pacific Northwest 1998