<?xml version="1.0" encoding="Windows-1251"?>
<CATS version="1.2">
<Problem title="Sudoku Checker" lang="en" author="A. Klenin" tlimit="2" mlimit="8"
  inputFile="input.txt" outputFile="output.txt" stdChecker="strs">

<ProblemStatement>
 <p>The puzzle game of <i>Sudoku</i> is played on a board of $N^2 \times N^2$ cells.
 The cells are grouped in $N \times N$ squares of $N \times N$ cells each.
 Each cell is either empty or contains a number between $1$ and $N^2$.
 </p><p>
 The sudoku position is <i>correct</i> when numbers in
 each row, each column and each square are different. The goal of the game is, starting from 
 some correct position, fill all empty cells so that the final position is still correct.
 </p><p>This game is fairly popular in the Internet, and there are many sites which allow
 visitors to solve puzzles online. Such sites always have a subroutine to determine a correctness
 of a given position.
 </p><p>You are to write such a routine.</p>
</ProblemStatement>

<ProblemConstraints>
$1 \le N \le 10$.
</ProblemConstraints>

<InputFormat>
Input file contains integer $N$, followed by $N^4$ integers -- sudoku position.
Empty cells are denoted by zeroes.
</InputFormat>

<OutputFormat>
Output file must contain a single string 'CORRECT' or 'INCORRECT'.
</OutputFormat>

<Sample rank="1">
  <SampleIn>2
0 0 0 0
0 0 0 0
0 0 2 0
0 0 0 1
</SampleIn>
  <SampleOut>CORRECT</SampleOut>
</Sample>

<Sample rank="2">
  <SampleIn>2
2 1 3 0
3 2 4 0
1 3 2 4
0 0 0 1
</SampleIn>
  <SampleOut>INCORRECT</SampleOut>
</Sample>

<Generator name="g1" src="g1.dpr" outputFile="*STDOUT"/>
<Generator name="g2" src="g2.dpr" outputFile="*STDOUT"/>
<Generator name="g3" src="g3.dpr" outputFile="*STDOUT"/>

<Solution name="sol_ask" src="sudoku_ask.dpr"/>
<Solution name="sol_tim" src="sudoku_tim.dpr"/>

<TestRange from="1" to="7"><In src="%0n"/><Out src="%0n.a"/></TestRange>

<Test rank="8"><In use="g1" param="1 4 1"/><Out src="correct.a"/> </Test>
<Test rank="9"><In use="g1" param="1 5 1"/><Out src="correct.a"/> </Test>
<Test rank="10"><In use="g1" param="1 7 1"/><Out src="correct.a"/> </Test>
<Test rank="11"><In use="g1" param="1 10 1"/><Out src="correct.a"/> </Test>

<Test rank="12"><In use="g1" param="557 9 2"/><Out src="correct.a"/> </Test>
<Test rank="13"><In use="g1" param="558 8 3"/><Out src="correct.a"/> </Test>

<Test rank="14"><In use="g2" param="3 50"/><Out src="incorrect.a"/> </Test>
<Test rank="15"><In use="g2" param="4 230"/><Out src="incorrect.a"/> </Test>
<Test rank="16"><In use="g2" param="6 300"/><Out src="incorrect.a"/> </Test>
<Test rank="17"><In use="g2" param="9 6560"/><Out src="incorrect.a"/> </Test>
<Test rank="18"><In use="g2" param="10 9876"/><Out src="incorrect.a"/> </Test>

<Test rank="19"><In use="g3" param="378347 2"/><Out use="sol_tim"/> </Test>
<Test rank="20"><In use="g3" param="4434 4"/><Out use="sol_tim"/> </Test>
<Test rank="21"><In use="g3" param="342 10"/><Out use="sol_tim"/> </Test>

</Problem>
</CATS>
