Problem: Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner:

<image> where <image> is equal to 1 if some ai = 1, otherwise it is equal to 0.

Nam has a matrix A consisting of m rows and n columns. The rows are numbered from 1 to m, columns are numbered from 1 to n. Element at row i (1 ≤ i ≤ m) and column j (1 ≤ j ≤ n) is denoted as Aij. All elements of A are either 0 or 1. From matrix A, Nam creates another matrix B of the same size using formula:

<image>.

(Bij is OR of all elements in row i and column j of matrix A)

Nam gives you matrix B and challenges you to guess matrix A. Although Nam is smart, he could probably make a mistake while calculating matrix B, since size of A can be large.

Input

The first line contains two integer m and n (1 ≤ m, n ≤ 100), number of rows and number of columns of matrices respectively.

The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1).

Output

In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one.

Examples

Input

2 2
1 0
0 0


Output

NO


Input

2 3
1 1 1
1 1 1


Output

YES
1 1 1
1 1 1


Input

2 3
0 1 0
1 1 1


Output

YES
0 0 0
0 1 0

Solution (in PYTHON3):

Solution:
import sys
import string
import math
from collections import defaultdict
from functools import lru_cache
from collections import Counter

def mi(s):
    return map(int, s.strip().split())

def lmi(s):
    return list(mi(s))

def tmi(s):
    return tuple(mi(s))

def mf(f, s):
    return map(f, s)

def lmf(f, s):
    return list(mf(f, s))

def js(lst):
    return " ".join(str(d) for d in lst)

def line():
    return sys.stdin.readline().strip()

def linesp():
    return line().split()

def iline():
    return int(line())

def mat(n):
    matr = []
    for _ in range(n):
        matr.append(linesp())
    return matr

def mati(n):
    mat = []
    for _ in range(n):
       mat.append(lmi(line())) 
    return mat

def pmat(mat):
    for row in mat:
        print(js(row))

def dist(x, y):
    return ((x[0] - y[0])**2 + (x[1] - y[1])**2)**0.5

def fast_exp(x, n):
    if n == 0:
        return 1
    elif n % 2 == 1:
        return x * fast_exp(x, (n - 1) // 2)**2
    else:
        return fast_exp(x, n // 2)**2

def main(mat):
    z_col = set()
    z_row = set()

    for i in range(len(mat)):
        for j in range(len(mat[i])):
            if mat[i][j] == 0:
                    # Implies that the row and col
                    # must both be 0.
                    z_row.add(i)
                    z_col.add(j)

    ans = [[0 for _ in range(len(mat[i]))] for i in range(len(mat))]
    row_done = set()
    col_done = set()
    pending_row = set()
    pending_col = set()
    for i in range(len(mat)):
        for j in range(len(mat[i])):
            if mat[i][j] == 1:
                if i not in z_row and j not in z_col:
                    ans[i][j] = 1
                    row_done.add(i)
                    col_done.add(j)
                    if i in pending_row:
                        pending_row.remove(i)
                    if j in pending_col:
                        pending_col.remove(j)
                elif i not in z_row and j in z_col:
                    # Current column must be a 0.
                    # So this row must have a one.
                    if i not in row_done:
                        # Need to do i.
                        pending_row.add(i)
                elif i in z_row and j not in z_col:
                    if j not in col_done:
                        pending_col.add(j)
                else:
                    print("NO")
                    return

    # Try and complete the pending row.
    for i in pending_row:
        done = False
        for j in range(len(mat[i])):
            if j not in z_col:
                ans[i][j] = 1
                if j in pending_col:
                    pending_col.remove(j)
                done = True
        if not done:
            print("NO")
            return

    for j in pending_col:
        done = False
        for i in range(len(mat)):
            if i not in z_row:
                ans[i][j] = 1
                done = True
        if not done:
            print("NO")
            return

    print("YES")
    pmat(ans)

def main(mat):
    # Million times better solution.
    A = [[1 for _ in range(len(mat[i]))] for i in range(len(mat))]
    z_row = set()
    z_col = set()
    for i in range(len(mat)):
        for j in range(len(mat[i])):
            if mat[i][j] == 0:
                # Make row/col 0.
                z_row.add(i)
                z_col.add(j)

    for row in z_row:
        for j in range(len(mat[0])):
            A[row][j] = 0

    for col in z_col:
        for i in range(len(mat)):
            A[i][col] = 0

    # Use A to get mat.
    B = [[1 for _ in range(len(mat[i]))] for i in range(len(mat))]
    for i in range(len(A)):
        for j in range(len(A[i])):
            B[i][j] = 0
            for k in range(len(A)):
                B[i][j] |= A[k][j]

            for k in range(len(A[0])):
                B[i][j] |= A[i][k]

            if B[i][j] != mat[i][j]:
                print("NO")
                return

    print("YES")
    pmat(A)

if __name__ == "__main__":
    n, _ = mi(line())
    mat = mati(n)
    main(mat)