Breaking Bad

Time limit: 0.5s Memory limit: 256MB Input: Output:

Nah, come on, man. Some straight like you, ***** ***** ** *** *** all a sudden at age, what, 60, he's just gonna break bad?

  • Jesse, Breaking Bad

Walter White finally broke bad and finished building his drug empire.

There are 55 of them in the business right now: Walt, Jesse, Mike, Saul, and Todd. They divided Albuquerque into n×nn\times n cells, and they made ai,ja_{i, j} dollars in the area on the intersection of the ii-th row and jj-th column.

They want to choose nn cells to collect money from. To not cause Hank's suspicion, they want exactly one selected cell in each row and in each column. If the total money made in these cells is SS, they will split it evenly among the five of them, and will donate the remaining Smod5S\bmod 5 dollars to Ted Beneke.

Find all possible amounts of dollars that could have been donated to Ted Beneke.

Input data

The first line contains a single positive integer nn (1n1031 \leq n \leq 10^3) - the size of the grid.

The next nn lines contain nn integers ai,ja_{i, j} (0ai,j40 \leq a_{i, j} \leq 4) - the number of dollars made in the cell at the intersection of the ii-th row and jj-th column.

Output data

Output a string of exactly 5 letters Y or N. If it's possible to get Simod5S \equiv i \bmod 5 for (0i<5)(0 \le i < 5), the ii-th letter of the string must be Y, otherwise N.

Example 1

stdin

2
0 4
4 0

stdout

YNNYN

Example 2

stdin

2
1 1
1 1

stdout

NNYNN

Log in or sign up to be able to send submissions!