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.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Objects;
import java.util.StringTokenizer;

public class Main {
	static InputReader in = new InputReader(System.in);
	static OutputWriter out = new OutputWriter(System.out);

	public static void main(String[] args) {

		int n = in.nextInt(), m = in.nextInt(), ones = 0;
		int[] row = new int[n], col = new int[m];
		int[][] arr = new int[n][m];
		for (int i = 0; i < n; i++)
			for (int j = 0; j < m; j++)
				ones += arr[i][j] = in.nextInt();

		boolean solved = true;

		for (int j = 0; j < m; j++) {
			if (arr[0][j] != 0) {
				col[j] = 1 - col[j];
				for (int i = 0; i < n; i++) {
					ones += -2 * arr[i][j] + 1;
					arr[i][j] = 1 - arr[i][j];
				}
			}
		}

		for (int i = 1; i < n; i++) {
			int st0 = -1, st1 = -1, en0 = -1, en1 = -1;
			for (int j = 0; j < m; j++) {
				if (arr[i][j] == 0) {
					st0 = st0 == -1 ? j : st0;
					en0 = j;
				} else {
					st1 = st1 == -1 ? j : st1;
					en1 = j;
				}
			}
			if (st0 != -1 && st1 != -1 && ((st0 < en1 && st1 < en0) || arr[i - 1][m - 1] == 1)) {
				solved = false;
				break;
			}
			if ((st0 != -1 && st1 != -1 && en1 < st0) || (st0 == -1 && arr[i - 1][m - 1] == 0)
					|| (st1 == -1 && arr[i - 1][m - 1] == 1)) {
				row[i] = 1 - row[i];
				for (int j = 0; j < m; j++) {
					ones += -2 * arr[i][j] + 1;
					arr[i][j] = 1 - arr[i][j];
				}
			}
		}

		if (solved) {
			out.println("YES");
			for (int i = 0; i < n; i++)
				out.print(row[i]);
			out.print('\n');
			for (int j = 0; j < m; j++)
				out.print(col[j]);
			out.print('\n');
			out.flush();
			return;
		}
		
		solved = true;

		for (int j = 0; j < m; j++) {
			if (arr[n - 1][j] != 1) {
				col[j] = 1 - col[j];
				for (int i = 0; i < n; i++) {
					ones += -2 * arr[i][j] + 1;
					arr[i][j] = 1 - arr[i][j];
				}
			}
		}

		for (int i = n - 2; i >= 0; i--) {
			int st0 = -1, st1 = -1, en0 = -1, en1 = -1;
			for (int j = 0; j < m; j++) {
				if (arr[i][j] == 0) {
					st0 = st0 == -1 ? j : st0;
					en0 = j;
				} else {
					st1 = st1 == -1 ? j : st1;
					en1 = j;
				}
			}
			if (st0 != -1 && st1 != -1 && ((st0 < en1 && st1 < en0) || arr[i + 1][0] == 0)) {
				solved = false;
				break;
			}
			if ((st0 != -1 && st1 != -1 && en1 < st0) || (st0 == -1 && arr[i + 1][0] == 0)
					|| (st1 == -1 && arr[i + 1][0] == 1)) {
				row[i] = 1 - row[i];
				for (int j = 0; j < m; j++) {
					ones += -2 * arr[i][j] + 1;
					arr[i][j] = 1 - arr[i][j];
				}
			}
		}

		if (solved) {
			out.println("YES");
			for (int i = 0; i < n; i++)
				out.print(row[i]);
			out.print('\n');
			for (int j = 0; j < m; j++)
				out.print(col[j]);
			out.print('\n');
			out.flush();
			return;
		}

		out.println("NO");
		out.flush();

	}

	static class Pair<E extends Comparable, F extends Comparable> implements Comparable {
		E first;
		F second;

		public Pair(E first, F second) {
			this.first = first;
			this.second = second;
		}

		public int compareTo(Object o) {
			Pair p = (Pair) o;
			if (first.compareTo(p.first) == 0)
				return second.compareTo(p.second);
			return first.compareTo(p.first);
		}

		public int hashCode() {
			return Objects.hash(first, second);
		}

		public boolean equals(Object o) {
			Pair p = (Pair) o;
			return first.compareTo(p.first) == 0 && second.compareTo(p.second) == 0;
		}

		public String toString() {
			return String.format("(%s,%s)", first.toString(), second.toString());
		}

	}

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

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

		public String nextLine() {
			try {
				return reader.readLine();
			} catch (Exception e) {
				return tokenizer.nextToken();
			}
		}

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

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

		public double nextDouble() {
			return Double.parseDouble(next());
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

		public int[] nextIntArray(int n) {
			int[] array = new int[n];
			for (int i = 0; i < n; i++)
				array[i] = nextInt();
			return array;
		}

		public double[] nextDoubleArray(int n) {
			double[] array = new double[n];
			for (int i = 0; i < n; i++)
				array[i] = nextDouble();
			return array;
		}

		public long[] nextLongArray(int n) {
			long[] array = new long[n];
			for (int i = 0; i < n; i++)
				array[i] = nextLong();
			return array;
		}

	}

	static class OutputWriter {
		private PrintWriter writer;

		public OutputWriter(OutputStream outputStream) {
			writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
		}

		public void print(Object o) {
			writer.print(o.toString());
		}

		public void println(Object o) {
			writer.print(o.toString());
			writer.print('\n');
		}

		public void flush() {
			writer.flush();
		}

	}
}