Problem: You are given a binary matrix a of size n × m. A binary matrix is a matrix where each element is either 0 or 1.

You may perform some (possibly zero) operations with this matrix. During each operation you can inverse the row of this matrix or a column of this matrix. Formally, inverting a row is changing all values in this row to the opposite (0 to 1, 1 to 0). Inverting a column is changing all values in this column to the opposite.

Your task is to sort the initial matrix by some sequence of such operations. The matrix is considered sorted if the array [a_{1, 1}, a_{1, 2}, ..., a_{1, m}, a_{2, 1}, a_{2, 2}, ..., a_{2, m}, ..., a_{n, m - 1}, a_{n, m}] is sorted in non-descending order.

Input

The first line of the input contains two integers n and m (1 ≤ n, m ≤ 200) — the number of rows and the number of columns in the matrix.

The next n lines contain m integers each. The j-th element in the i-th line is a_{i, j} (0 ≤ a_{i, j} ≤ 1) — the element of a at position (i, j).

Output

If it is impossible to obtain a sorted matrix, print "NO" in the first line.

Otherwise print "YES" in the first line. In the second line print a string r of length n. The i-th character r_i of this string should be '1' if the i-th row of the matrix is inverted and '0' otherwise. In the third line print a string c of length m. The j-th character c_j of this string should be '1' if the j-th column of the matrix is inverted and '0' otherwise. If there are multiple answers, you can print any.

Examples

Input


2 2
1 1
0 1


Output


YES
00
10


Input


3 4
0 0 0 1
0 0 0 0
1 1 1 1


Output


YES
010
0000


Input


3 3
0 0 0
1 0 1
1 1 0


Output


NO

Solution (in JAVA):

Solution:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.List;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
import java.util.ArrayList;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author cplayer
 */
public class Main {
    public static void main (String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        GInverseOfRowsAndColumns solver = new GInverseOfRowsAndColumns();
        solver.solve(1, in, out);
        out.close();
    }

    static class GInverseOfRowsAndColumns {
        int[] invLine;
        int[] invCol;

        private void invLine (int[][] mtx, int line) {
            for (int i = 0; i < mtx[line].length; ++i) {
                mtx[line][i] = 1 - mtx[line][i];
            }
        }

        private void invCol (int[][] mtx, int col) {
            for (int i = 0; i < mtx.length; ++i) {
                mtx[i][col] = 1 - mtx[i][col];
            }
        }

        private List<Integer> getList (int[][] mtx) {
            List<Integer> res = new ArrayList<>();
            for (int i = 0; i < mtx.length; ++i) {
                for (int j = 0; j < mtx[i].length; ++j) {
                    res.add(mtx[i][j]);
                }
            }
            return res;
        }

        private int[][] init (int[][] mtx, int n, int m) {
            int[][] mtxCpy = new int[n][m];
            Arrays.fill(invLine, 0);
            Arrays.fill(invCol, 0);
            for (int i = 0; i < n; ++i) {
                mtxCpy[i] = Arrays.copyOf(mtx[i], m);
            }
            return mtxCpy;
        }

        private boolean check (int[][] mtx) {
            List<Integer> res = getList(mtx);
            for (int i = 0; i < res.size() - 1; ++i) {
                if (res.get(i) > res.get(i + 1)) {
                    return false;
                }
            }
            return true;
        }

        private boolean checkAllZero (int[][] mtx, int line) {
            for (int i = 0; i < mtx[line].length; ++i) {
                if (mtx[line][i] == 1) {
                    return false;
                }
            }
            return true;
        }

        private boolean checkAllOne (int[][] mtx, int line) {
            for (int i = 0; i < mtx[line].length; ++i) {
                if (mtx[line][i] == 0) {
                    return false;
                }
            }
            return true;
        }

        private boolean checkBorder (int[][] mtx, int line) {
            int pt = 0, cnt0 = 0, cnt1 = 0;
            while (pt < mtx[line].length && mtx[line][pt] == 0) {
                cnt0++;
                pt++;
            }
            for (int i = pt; i < mtx[line].length; ++i) {
                if (mtx[line][i] == 0) {
                    return false;
                } else {
                    cnt1++;
                }
            }
            if (cnt1 == 0 || cnt0 == 0) {
                return false;
            }
            return true;
        }

        private boolean checkInvFirst (int[][] mtx, int n, int m) {
            int[][] mtxCpy = init(mtx, n, m);
            for (int i = 0; i < m; ++i) {
                if (mtxCpy[0][i] == 1) {
                    invCol[i] = 1;
                    invCol(mtxCpy, i);
                }
            }
            checkRest(mtxCpy, n);
            return check(mtxCpy);
        }

        private void checkRest (int[][] mtxCpy, int n) {
            boolean flg = false;
            for (int i = 0; i < n; ++i) {
                if (!flg) {
                    if (checkBorder(mtxCpy, i)) {
                        flg = true;
                    } else if (checkInvBorder(mtxCpy, i)) {
                        flg = true;
                        invLine[i] = 1;
                        invLine(mtxCpy, i);
                    } else if (checkAllOne(mtxCpy, i)) {
                        invLine[i] = 1;
                        invLine(mtxCpy, i);
                    }
                } else {
                    if (checkAllZero(mtxCpy, i)) {
                        invLine[i] = 1;
                        invLine(mtxCpy, i);
                    }
                }
            }
        }

        private boolean checkInvBorder (int[][] mtx, int line) {
            int pt = 0, cnt0 = 0, cnt1 = 0;
            while (pt < mtx[line].length && mtx[line][pt] == 1) {
                pt++;
                cnt1++;
            }
            for (int i = pt; i < mtx[line].length; ++i) {
                if (mtx[line][i] == 1) {
                    return false;
                } else {
                    cnt0++;
                }
            }
            if (cnt0 == 0 || cnt1 == 0) {
                return false;
            }
            return true;
        }

        public void solve (int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt(), m = in.nextInt();
            int[][] mtx = new int[n][m];
            for (int i = 0; i < n; ++i) {
                mtx[i] = in.nextIntArr(m);
            }
            invLine = new int[n];
            invCol = new int[m];
            if (checkInvFirst(mtx, n, m)) {
                out.println("YES");
                print(invLine, invCol, in, out);
            } else if (checkInvLast(mtx, n, m)) {
                out.println("YES");
                print(invLine, invCol, in, out);
            } else {
                out.println("NO");
            }
        }

        private void print (int[] line, int[] col, InputReader in, PrintWriter out) {
            for (int l : line) {
                out.print(l);
            }
            out.println();
            for (int c : col) {
                out.print(c);
            }
            out.println();
        }

        private boolean checkInvLast (int[][] mtx, int n, int m) {
            int[][] mtxCpy = init(mtx, n, m);
            for (int i = 0; i < m; ++i) {
                if (mtxCpy[n - 1][i] == 0) {
                    invCol[i] = 1;
                    invCol(mtxCpy, i);
                }
            }
            checkRest(mtxCpy, n);
            return check(mtxCpy);
        }

    }

    static class InputReader {
        private BufferedReader reader;
        private StringTokenizer tokenizer;

        public InputReader (InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            tokenizer = null;
        }

        public String next () {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return tokenizer.nextToken();
        }

        public int[] nextIntArr (int length) {
            int[] res = new int[length];
            for (int i = 0; i < length; ++i) {
                res[i] = nextInt();
            }
            return res;
        }

        public int nextInt () {
            return Integer.parseInt(next());
        }

    }
}