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 JAVA):

Solution:
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashSet;
import java.util.InputMismatchException;
import java.util.Set;

public class ORInMatrix {
    InputStream is;
    PrintWriter pw;
    String INPUT = "";
    long L_INF = (1L << 60L);

    void solve() {
        int n = ni(), m = ni();
        int a[][] = new int[n][m];
        for (int i = 0; i < n; i++) {
            a[i] = na(m);
        }
        if (n == 1 && m == 1) {
            pw.println("YES");
            pw.println(a[0][0]);
            return;
        } else if (n == 1) {
            for (int i = 1; i < m; i++) {
                if (a[0][i] != a[0][i - 1]) {
                    pw.println("NO");
                    return;
                }
            }
            pw.println("YES");
            printMat(a, n, m);
            return;
        } else if (m == 1) {
            for (int i = 1; i < n; i++) {
                if (a[i][0] != a[i - 1][0]) {
                    pw.println("NO");
                    return;
                }
            }
            pw.println("YES");
            printMat(a, n, m);
            return;
        }
        int one=0;
        boolean possible = true;
        int b[][] = new int[n][m];
        for (int i = 0; i < n; i++) {
            Arrays.fill(b[i],1);
        }
        Set<Integer> rowz = new HashSet<>();
        Set<Integer> colz = new HashSet<>();
        for (int i = 0; i < n - 1; i++) {
            for (int j = 0; j < m - 1; j++) {
                if (a[i][j] == 1) {
                    if (a[i + 1][j] == 0 && a[i][j + 1] == 0)
                        possible = false;
                    one++;
                }
                else{
                    rowz.add(i);
                    colz.add(j);
                }
            }
        }
        for (int i = 0; i < m - 1; i++) {
            if (a[n - 1][i] == 1) {
                if (a[n - 1][i + 1] == 0 && a[n - 2][i] == 0)
                    possible = false;
                one++;
            }
            else{
                rowz.add(n-1);
                colz.add(i);
            }
        }
        for (int i = 0; i < n - 1; i++) {
            if (a[i][m - 1] == 1) {
                if (a[i + 1][m - 1] == 0 && a[i][m - 2] == 0)
                    possible = false;
                one++;
            }
            else{
                rowz.add(i);
                colz.add(m-1);
            }
        }
        //for right bottom corner
        if (a[n - 1][m - 1] == 1) {
            if (a[n - 2][m - 1] == 0 && a[n - 1][m - 2] == 0)
                possible = false;
            one++;
        }
        else{
            rowz.add(n-1);
            colz.add(m-1);
        }
        if(one==0){
            pw.println("YES");
            printMat(a,n,m);
            return;
        }
        if (!possible || rowz.size()==n || colz.size()==m)
            pw.println("NO");
        else {
            pw.println("YES");
            for (int r:rowz) {
                for (int i = 0; i < m; i++) {
                    b[r][i]=0;
                }
            }
            for (int c:colz) {
                for (int i = 0; i < n; i++) {
                    b[i][c]=0;
                }
            }
            printMat(b, n, m);
        }
    }

    private void printMat(int[][] a, int n, int m) {
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                pw.print(a[i][j] + " ");
            }
            pw.println();
        }
    }

    void run() throws Exception {
//		is = oj ? System.in : new ByteArrayInputStream(INPUT.getBytes());
        is = System.in;
        pw = new PrintWriter(System.out);

        long s = System.currentTimeMillis();
//        int t = ni();
//        while (t-- > 0)
        solve();
        pw.flush();
        tr(System.currentTimeMillis() - s + "ms");
    }

    public static void main(String[] args) throws Exception {
        new ORInMatrix().run();
    }

    private byte[] inbuf = new byte[1024];
    private int lenbuf = 0, ptrbuf = 0;

    private int readByte() {
        if (lenbuf == -1) throw new InputMismatchException();
        if (ptrbuf >= lenbuf) {
            ptrbuf = 0;
            try {
                lenbuf = is.read(inbuf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (lenbuf <= 0) return -1;
        }
        return inbuf[ptrbuf++];
    }

    private boolean isSpaceChar(int c) {
        return !(c >= 33 && c <= 126);
    }

    private int skip() {
        int b;
        while ((b = readByte()) != -1 && isSpaceChar(b)) ;
        return b;
    }

    private double nd() {
        return Double.parseDouble(ns());
    }

    private char nc() {
        return (char) skip();
    }

    private String ns() {
        int b = skip();
        StringBuilder sb = new StringBuilder();
        while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != ' ')
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    private char[] ns(int n) {
        char[] buf = new char[n];
        int b = skip(), p = 0;
        while (p < n && !(isSpaceChar(b))) {
            buf[p++] = (char) b;
            b = readByte();
        }
        return n == p ? buf : Arrays.copyOf(buf, p);
    }

    private char[][] nm(int n, int m) {
        char[][] map = new char[n][];
        for (int i = 0; i < n; i++) map[i] = ns(m);
        return map;
    }

    private int[] na(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++) a[i] = ni();
        return a;
    }

    private int ni() {
        int num = 0, b;
        boolean minus = false;
        while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ;
        if (b == '-') {
            minus = true;
            b = readByte();
        }

        while (true) {
            if (b >= '0' && b <= '9') {
                num = num * 10 + (b - '0');
            } else {
                return minus ? -num : num;
            }
            b = readByte();
        }
    }

    private long nl() {
        long num = 0;
        int b;
        boolean minus = false;
        while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ;
        if (b == '-') {
            minus = true;
            b = readByte();
        }

        while (true) {
            if (b >= '0' && b <= '9') {
                num = num * 10 + (b - '0');
            } else {
                return minus ? -num : num;
            }
            b = readByte();
        }
    }

    private boolean oj = System.getProperty("ONLINE_JUDGE") != null;

    private void tr(Object... o) {
        if (!oj) System.out.println(Arrays.deepToString(o));
    }
}