P14987 [Kattis] Foldingacube
提高
题目描述

It is well known that a set of six unit squares that are attached together in a “cross” can be folded into a cube.

But what about other initial shapes? That is, given six unit squares that are attached together along some of their sides, can we form a unit cube by folding this arrangement?

-----Input-----
Input consists of $6$ lines each containing $6$ characters, describing the initial arrangement of unit squares. Each character is either a ., meaning it is empty, or a # meaning it is a unit square.

There are precisely $6$ occurrences of # indicating the unit squares. These form a connected component, meaning it is possible to reach any # from any other # without touching a . by making only horizontal and vertical movements. Furthermore, there is no $2 \times 2$ subsquare consisting of only #. That is, the pattern

does not appear in the input.

-----Output-----
If you can fold the unit squares into a cube, display can fold. Otherwise display cannot fold.

-----Examples-----
Sample Input 1:
......
......

......
......
......
Sample Output 1:
cannot fold

Sample Input 2:
......

.....

..

.....

......
......
Sample Output 2:
can fold

Sample Input 3:
..##..
...#..
..##..
...#..
......
......
Sample Output 3:
cannot fold

输入格式

见题面

输出格式

见题面

样例输入
...... ...... ###### ...... ...... ......
样例输出
cannot fold