시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB149964.286%

문제

Flow Free is a puzzle that is played on a 2D grid of cells, with some cells marked as endpoints of certain colors and the rest of cells being blank.

To solve the puzzle, you have to connect each pair of colored endpoints with a path, following these rules:

  • there is a path connecting two points with the same color, and that path also has that color
  • all cells in the grid are used and each cell belongs to exactly one path (of the same color as the endpoints of the path)

The rules imply that different colored paths cannot intersect.

The path is defined as a connected series of segments where each segment connects two neighbouring cells. Two cells are neighbours if they share a side (so all segments are either horizontal or vertical). By these definitions and rules above, each colored cell will be an endpoint of exactly one segment and each blank cell will be an endpoint of exactly two segments.

In this problem we will consider only the 4 × 4 puzzle, with 3 or 4 pairs of colored endpoints given.

Your task is to determine if a given puzzle is solvable or not.

입력

The input consists of 4 lines, each line containing 4 characters. Each character is from the set {R, G, B, Y, W} where W denotes the blank cells and the other characters denote endpoints with the specified color. You are guaranteed that there will be exactly 3 or 4 pairs of colored cells. If there are 3 colors in the grid, Y will be omitted.

출력

On a single line output either “solvable” or “not solvable” (without the quotes).

예제 입력 1

RGBW
WWWW
RGBY
YWWW

예제 출력 1

solvable

예제 입력 2

RGBW
WWWW
RGBW
YWWY

예제 출력 2

not solvable