You be The Judge, Again
시간 제한2초메모리 제한2048 MB
2^n 곱하기 2^n 격자가 주어질 때, 빈칸이 정확히 하나이고 나머지 칸을 서로 다른 L-트라이오미노가 모두 덮는지 판정한다.
문제
You are a judge, again! The contest you're judging includes the following problem:
You have one L-shaped triomino of each of different colors. Tile a by grid using each of these triominos such that there is exactly one blank square and all other squares are covered by exactly one square of such a triomino. All triominos must be used."
Your team is to write a checker for this problem. Validation of the input values and format has already taken place. You will be given a purported tiling of a by grid, where each square in the grid is either 0 or a positive integer from to representing one of the colors. Determine if it is, indeed, a covering of the grid with unique triominos and a single empty space.
L-shaped triominos look like this:

입력
The first line of input contains a single integer (), which is the of the description.
Each of the next lines contains integers (), where 0 represents an empty space, and any positive number is a unique identifier of a triomino.
출력
Output a single integer, which is if the given grid is covered with unique triominos and a single empty space. Otherwise, output .