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;
using ii = pair<int, int>;
using ll = long long int;
using vi = vector<int>;
using graph = vector<vi>;
const int INF = 0x3f3f3f3f;
const ll INFL = 0x3f3f3f3f3f3f3f3f;
const int MAXN = 212345;
int mat[222][222], aux[222][222], n, m;
void changeC(int col) {
  for (int i = 0; i < n; ++i) {
    mat[i][col] = !mat[i][col];
  }
}
void changeR(int row) {
  for (int j = 0; j < m; ++j) {
    mat[row][j] = !mat[row][j];
  }
}
bool check() {
  int last = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      if (mat[i][j] < last) {
        return 0;
      }
      last = mat[i][j];
    }
  }
  return 1;
}
void show() {
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      cout << mat[i][j] << ' ';
    }
    cout << '\n';
  }
  cout << '\n';
}
bool OneLine(int row) {
  for (int j = 0; j < m; ++j) {
    if (mat[row][j] == 0) return 0;
  }
  return 1;
}
bool changeAndCheck(string &rans, string &cans) {
  int start = n;
  for (int i = 0, stop = 0; i < n && !stop; ++i) {
    if (OneLine(i) && i != n - 1) {
      changeR(i);
      rans[i] = '1';
      continue;
    }
    for (int j = 0; j < m && !stop; ++j) {
      if (mat[i][j] == 1) {
        start = i + 1;
        if (j == 0) changeR(i), rans[i] = '1';
        stop = 1;
      }
    }
  }
  for (int i = start; i < n; ++i) {
    if (mat[i][0] == 0) {
      rans[i] = '1';
      changeR(i);
    }
  }
  if (check()) {
    cout << "YES\n";
    cout << rans << '\n';
    cout << cans << '\n';
    return 1;
  }
  return 0;
}
bool tryFirstLine() {
  string cans = string(m, '0');
  string rans = string(n, '0');
  for (int j = 0; j < m; ++j) {
    if (mat[0][j] == 1) {
      cans[j] = '1';
      changeC(j);
    }
  }
  return changeAndCheck(rans, cans);
}
bool tryLastLine() {
  string cans = string(m, '0');
  string rans = string(n, '0');
  for (int j = 0; j < m; ++j) {
    if (mat[n - 1][j] == 0) {
      cans[j] = '1';
      changeC(j);
    }
  }
  return changeAndCheck(rans, cans);
}
int main() {
  ios::sync_with_stdio(0);
  cin >> n >> m;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      cin >> mat[i][j];
      aux[i][j] = mat[i][j];
    }
  }
  if (tryFirstLine()) {
    return 0;
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      mat[i][j] = aux[i][j];
    }
  }
  if (tryLastLine()) {
    return 0;
  }
  cout << "NO\n";
}