#ABC261B. [ABC261B] Tournament Result

[ABC261B] Tournament Result

Score : 200200 points

Problem Statement

NN players played a round-robin tournament.

You are given an NN-by-NN table AA containing the results of the matches. Let Ai,jA_{i,j} denote the element at the ii-th row and jj-th column of AA. Ai,jA_{i,j} is - if i=ji=j, and W, L, or D otherwise. Ai,jA_{i,j} is W if Player ii beat Player jj, L if Player ii lost to Player jj, and D if Player ii drew with Player jj.

Determine whether the given table is contradictory.

The table is said to be contradictory when some of the following holds:

  • There is a pair (i,j)(i,j) such that Player ii beat Player jj, but Player jj did not lose to Player ii;
  • There is a pair (i,j)(i,j) such that Player ii lost to Player jj, but Player jj did not beat Player ii;
  • There is a pair (i,j)(i,j) such that Player ii drew with Player jj, but Player jj did not draw with Player ii.

Constraints

  • 2N10002 \leq N \leq 1000
  • Ai,iA_{i,i} is -.
  • Ai,jA_{i,j} is W, L, or D, for iji\neq j.

Input

Input is given from Standard Input in the following format:

NN

A1,1A1,2A1,NA_{1,1}A_{1,2}\ldots A_{1,N}

A2,1A2,2A2,NA_{2,1}A_{2,2}\ldots A_{2,N}

\vdots

AN,1AN,2AN,NA_{N,1}A_{N,2}\ldots A_{N,N}

Output

If the given table is not contradictory, print correct; if it is contradictory, print incorrect.

4
-WWW
L-DD
LD-W
LDW-
incorrect

Player 33 beat Player 44, while Player 44 also beat Player 33, which is contradictory.

2
-D
D-
correct

There is no contradiction.