Problem2380--Tournament Result

2380: Tournament Result

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 128 MB

Description

Time Limit: 2 sec / Memory Limit: 1024 MB

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 A_{i,j}Ai,j denote the element at the ii-th row and jj-th column of AA.
A_{i,j}Ai,j is - if i=ji=j, and W, L, or D otherwise.
A_{i,j}Ai,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

  • 2 \leq N \leq 10002N1000
  • A_{i,i}Ai,i is -.
  • A_{i,j}Ai,j is W, L, or D, for i\neq ji=j.

Input

Input is given from Standard Input in the following format:
NNA_{1,1}A_{1,2}\ldots A_{1,N}A1,1A1,2A1,NA_{2,1}A_{2,2}\ldots A_{2,N}A2,1A2,2A2,N\vdotsA_{N,1}A_{N,2}\ldots A_{N,N}AN,1AN,2AN,N

Output

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

Sample Input Copy

4
-WWW
L-DD
LD-W
LDW-

Sample Output Copy

incorrect

HINT

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

Source/Category