From the unit blocks of three kinds one creates a cube N × N × N (1 < N < 10). Some minutes later all the unit blocks of the same kind with common faces glue together. So three details appeared.
Determine, if there is possible to separate all the details not destroying them.
Input
The input will consist of several input blocks. Each input block begins with the integer N, the size of the cube. Then there is an empty line. Then N series of N lines, determined N cube layers. Each line contains N letters (‘R’, ‘G’, ‘B’), defining the kind of the block. Each layer-series except the last one in the last input block is followed by an empty line. The last input block is followed by