{$apptype console}

// (C) Timofey S. Chistyakov 2005

{$O-}

uses
  Types;

var
  n, ns: integer;
  fi, fo: textfile;
  i, j, sqi: integer;
  correct: boolean;
  cols, rows, squares: array of TBooleanDynArray;
  m: integer;
begin
  Read(n);
  ns := n * n;

  SetLength(cols, ns, ns);
  SetLength(rows, ns, ns);
  SetLength(squares, ns, ns);

  for i := 0 to n - 1 do begin
    FillChar(cols[i, 0], SizeOf(cols[i, 0]) * ns, false);
    FillChar(rows[i, 0], SizeOf(rows[i, 0]) * ns, false);
    FillChar(squares[i, 0], SizeOf(squares[i, 0]) * ns, false);
  end;

  correct := true;
  for i := 0 to ns - 1 do begin
    for j := 0 to ns - 1 do begin
      Read(m);
      Dec(m);
      sqi := (i div n) * n + j div n;
      if (m <> -1) then begin
        correct :=
          correct and
          (not rows[i, m]) and
          (not cols[j, m]) and
          (not squares[sqi, m]);
        if not correct then
          Break;

        rows[i, m] := true;
        cols[j, m] := true;
        squares[sqi, m] := true;
      end;
    end;
    if not correct then
      Break;
  end;

  if correct then
    Writeln('CORRECT')
  else
    Writeln('INCORRECT');
end.
