A Latin Square is an
A Latin Square is in reduced form if the top row and leftmost column are sorted in increasing order.
Given an
Constraints
Input Specification
The first line contains a single positive integer
Each of the next
Output Specification
If the array is not a Latin Square, print No
on a single line.
If the array is a Latin Square, but not in reduced form, print Latin
on a single line.
If the array is a Latin Square in reduced form, print Reduced
on a single line.
Sample Input 1
3
012
120
201
Sample Output 1
Reduced
Sample Input 2
4
3210
0123
2301
1032
Sample Output 2
Latin
Sample Input 3
11
0123458372A
A9287346283
0285475A834
84738299A02
1947584037A
65848430002
038955873A8
947530200A8
93484721084
95539A92828
04553883568
Sample Output 3
No
Comments
Since the original data were weak, an additional test case was added, partials were disabled, and all submissions were rejudged.