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

Solution:
#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
const int MAXH = 200;
const int MAXW = 200;
int h, w;
int a[MAXH][MAXW];
bool invcol[MAXW];
bool invrow[MAXH];
int b[MAXH][MAXW];
bool solveb() {
  int diffrow = -1;
  for (int x = (0); x < (h); ++x) {
    bool allsame = true;
    for (int y = (1); y < (w); ++y)
      if (b[x][y] != b[x][0]) allsame = false;
    if (allsame) continue;
    if (diffrow == -1)
      diffrow = x;
    else
      diffrow = -2;
  }
  if (diffrow == -2) return false;
  if (diffrow == -1) {
    for (int x = (0); x < (h); ++x) invrow[x] = b[x][0] == 1;
  } else {
    for (int x = (0); x < (h); ++x)
      invrow[x] = x <= diffrow ? b[x][0] == 1 : b[x][0] == 0;
  }
  return true;
}
bool solve() {
  invcol[0] = false;
  for (int y = (1); y < (w); ++y) invcol[y] = (a[0][y] != a[0][0]);
  for (int x = (0); x < (h); ++x)
    for (int y = (0); y < (w); ++y) {
      b[x][y] = a[x][y];
      if (invcol[y]) b[x][y] = 1 - b[x][y];
    }
  for (int y = (1); y < (w); ++y) assert(b[0][y] == b[0][0]);
  if (solveb()) return true;
  assert(h >= 2);
  invcol[0] = false;
  for (int y = (1); y < (w); ++y) invcol[y] = (a[1][y] != a[1][0]);
  for (int x = (0); x < (h); ++x)
    for (int y = (0); y < (w); ++y) {
      b[x][y] = a[x][y];
      if (invcol[y]) b[x][y] = 1 - b[x][y];
    }
  for (int y = (1); y < (w); ++y) assert(b[1][y] == b[1][0]);
  if (solveb()) return true;
  return false;
}
void run() {
  scanf("%d%d", &h, &w);
  for (int x = (0); x < (h); ++x)
    for (int y = (0); y < (w); ++y) scanf("%d", &a[x][y]);
  if (!solve()) {
    printf("NO\n");
    return;
  }
  printf("YES\n");
  for (int x = (0); x < (h); ++x) printf("%c", invrow[x] ? '1' : '0');
  puts("");
  for (int y = (0); y < (w); ++y) printf("%c", invcol[y] ? '1' : '0');
  puts("");
}
int main() {
  run();
  return 0;
}