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

Solution:
import sys
sys.setrecursionlimit(2000)
from collections import Counter
from functools import reduce
# sys.stdin.readline()

def get_info(row):
    s = set(row)
    if(len(s) == 1):
        homogeneous = True
    else:
        homogeneous = False
    is_sorted = True
    for ind, val in enumerate(row[1:]):
        if(val < row[ind]):
            is_sorted = False
    is_reverse_sorted = True
    for ind in range(n-1, 1, -1):
        if(row[ind-1] > row[ind]):
            is_reversed_sorted = False
    return (homogeneous, is_sorted, 0 in s, 1 in s, is_reverse_sorted)

def mc(A, col):
    for row in A:
        row[col] = 1 - row[col]

def mr(A, row):
    for ind, val in enumerate(A[row]):
        A[row][ind] = 1 - A[row][ind]

def is_pos(A, flip, start_row, end_row, rows, cols):
    pos = True
    for row in range(start_row, end_row+1):
        info = get_info(A[row])
        if(info[0]):
            must_b = '0' if not flip else '1'
            if(must_b == '0'):
                if(info[2]):
                    pass
                else:
                    mr(A, row)
                    rows[row] = '1'
            else:
                if(info[3]):
                    pass
                else:
                    mr(A, row)
                    rows[row] = '1'
        else:
            if(flip):
                pos = False
                break
            elif(info[1]):
                flip = True
            elif(info[4]):
                mr(A, row)
                rows[row] = '1'
                flip = True
            else:
                pos = False
                break
    return pos        
 
def force_row_to_val(A, row, val, rows, cols):
    info = get_info(A[row])
    check_ind = 2 if val == 1 else 3
    if(info[0]):
        if(info[check_ind]):
            mr(A, row)
            rows[row] = '1'
        else:
            pass
    else:
        for i in range(m):
            if(A[row][i] != val):
                mc(A, i)
                cols[i] = '1'


if __name__ == "__main__":

    # single variables
    n, m = [int(val) for val in sys.stdin.readline().split()]
    A = [[int(val) for val in sys.stdin.readline().split()] for row in range(n)]

    # ans
    rows1 = ['0'] * n
    cols1 = ['0'] * m
    rows2 = ['0'] * n
    cols2 = ['0'] * m

    from copy import deepcopy
    A1 = deepcopy(A)
    A2 = deepcopy(A)

    force_row_to_val(A1, -1, 1, rows1, cols1) 
    pos1 = is_pos(A1, False, 0, n-2, rows1, cols1)
    
    force_row_to_val(A2, 0, 0, rows2, cols2) 
    pos2 = is_pos(A2, False, 1, n-1, rows2, cols2)

    if(pos1):
        cols = cols1
        rows = rows1
    elif(pos2):
        cols = cols2
        rows = rows2

    if(pos1 or pos2):
        print("YES")
        for val in rows:
            print(val, end='')
        print("")
        for val in cols:
            print(val, end='')
        print("")
    else:
        print("NO")