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.*;
import java.util.*;

public class Main implements Runnable{
    public static void main(String[] args){
        //new Thread(null,new Main(),"Thread-1",1024*1024*10).start();
        new Main().run();
    }
    boolean[][]a;
    BitSet[][]one,zero;
    int n,m;
    BitSet target;
    int[]ans;
    private void solve() throws Exception {
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
        n=in.nextInt();m=in.nextInt();
        one=new BitSet[n][m+1];
        zero=new BitSet[n][m+1];
        ans=new int[n];
        a=new boolean[n][m];
        for(int i=0;i<n;i++){
            for(int j=0;j<m;j++){
                a[i][j]=in.nextInt()==1;
                one[i][j]=new BitSet();
                zero[i][j]=new BitSet();
            }
            one[i][m]=new BitSet();
            zero[i][m]=new BitSet();
        }
        pre();
        boolean f=false;
        label:for(int i=0;i<n;i++){
            for(int j=0;j<=m;j++){
                ans[i]=0;
                target=zero[i][j];
                if(dfs(false,i-1)&&dfs(true,i+1)){
                    f=true;break label;
                }

                ans[i]=1;
                target=one[i][j];
                if(dfs(false,i-1)&&dfs(true,i+1)){
                    f=true;break label;
                }
            }
        }
        if(f){
            out.println("YES");
            for(int i=0;i<n;i++)out.print(ans[i]);
            out.println();
            for(int i=0;i<m;i++)out.print(target.get(i)?1:0);
            out.println();
        }else out.println("NO");
        out.flush();
    }
    boolean dfs(boolean f,int pos){
        if(pos==-1||pos==n)return true;
        if(f) {
            if (target.equals(one[pos][0])){
                ans[pos]=1;
            }else if(target.equals(zero[pos][0])){
                ans[pos]=0;
            }else return false;
        }else {
            if (target.equals(one[pos][m])){
                ans[pos]=1;
            }else if(target.equals(zero[pos][m])){
                ans[pos]=0;
            }else return false;
        }
        return dfs(f,pos+(f?1:-1));
    }
    void pre(){
        for(int i=0;i<n;i++){
            for(int j=0;j<=m;j++){
                for(int k=0;k<j;k++){
                    if(a[i][k])zero[i][j].set(k);
                    else one[i][j].set(k);
                }
                for(int k=j;k<m;k++){
                    if(a[i][k])one[i][j].set(k);
                    else zero[i][j].set(k);
                }
            }
        }
    }
    @Override
    public void run() {
        try {
            solve();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    class InputReader{
        StreamTokenizer tokenizer;
        public InputReader(InputStream stream){
            tokenizer=new StreamTokenizer(new BufferedReader(new InputStreamReader(stream)));
            tokenizer.ordinaryChars(33,126);
            tokenizer.wordChars(33,126);
        }
        public String next() throws IOException {
            tokenizer.nextToken();
            return tokenizer.sval;
        }
        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }
        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }
        public boolean hasNext() throws IOException {
            int res=tokenizer.nextToken();
            tokenizer.pushBack();
            return res!=tokenizer.TT_EOF;
        }
    }
}