425. Control function

Time limit per test: 1 second(s)
Memory limit: 262144 kilobytes
input: standard
output: standard



A matrix T of non-negative integers with n rows and m columns is called a control matrix when its first row is different from all other rows. Formally speaking, T1jTij.

A function f from non-negative integers to non-negative integers is called a control function for the given control matrix T when the matrix f(T) obtained by applying f to every element of T is also a control matrix. Formally speaking, f(T1j) ≠ f(Tij).

Find a control function with all values not exceeding 50 for the given control matrix T.

Input
The first line of the input file contains two integers n and m (1 ≤ n, m ≤ 1000). The next n lines contain m integers each, representing the matrix Tij (). It is guaranteed that the matrix T is a control matrix.

Output
Output "Yes" (without quotes) to the first line of the output file if such a function exists, and "No" (without quotes) otherwise. If the answer is positive, then output the function via "key -> value" pairs (without quotes). Order keys in increasing order. All different numbers from matrix T must appear as a key exactly once, and no other keys should be printed.

Example(s)
sample input
sample output
1 5
1 2 3 4 5
Yes
1 -> 0
2 -> 0
3 -> 0
4 -> 0
5 -> 0

sample input
sample output
2 2
1 2
1 3
Yes
1 -> 1
2 -> 1
3 -> 0

sample input
sample output
4 2
0 2
4 5
7 6
3 1
Yes
0 -> 1
1 -> 0
2 -> 1
3 -> 0
4 -> 1
5 -> 0
6 -> 1
7 -> 0




Online Contester Team © 2002 - 2010. All rights reserved.