402384: GYM100741 F Matrix
Description
You're given a matrix with n rows and n columns. A basic property of a square matrix is the main diagonal: all cells that have the same row and column number.
We consider all diagonals that are parallel to the main one. We consider them from left-low corner to the right-upper one. So, the first cell of each diagonal will be, in order: (n, 1) (n - 1, 1) ... (1, 1) (1, 2) ... (1, n).
You need to choose one number from each diagonal. More, all 2*n-1 numbers must be pairwise distinct.
InputThe first line contains number n (1 ≤ n ≤ 300). Next n lines contain n numbers, representing the elements of the matrix. All elements of the matrix are between 1 and 109.
OutputIf there is no solution, output "NO". Otherwise, output "YES". Next, on the same line, output 2n-1 numbers, separated by spaces. Each number represents the chosen value from a diagonal. Diagonals are considered in the order given by the problem.
ExamplesInput2Output
1 1
1 1
NO