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;
const int N = 201;
int n, m, a[N][N], rep[4 * N + 1], odw[4 * N + 1], nr;
int val[4 * N + 1];
bool res[N][N], unsat;
vector<int> v[4 * N + 1], comp[4 * N + 1];
int opposite(int x) {
  if (x < n) return x + n;
  if (x < 2 * n) return x - n;
  if (x < 2 * n + m) return x + m;
  return x - m;
}
void bfs(int x) {
  queue<int> q;
  q.push(x);
  rep[x] = nr;
  comp[nr].push_back(x);
  odw[x] = 1;
  while (q.size()) {
    int y = q.front();
    q.pop();
    for (int i : v[y]) {
      if (!odw[i]) {
        odw[i] = 1;
        q.push(i);
        rep[i] = nr;
        comp[nr].push_back(i);
        if (rep[i] == rep[opposite(i)]) {
          unsat = 1;
          return;
        }
      }
    }
  }
}
bool two_sat() {
  for (int i = 0; i < 2 * n + 2 * m; ++i) {
    val[i] = -1;
    odw[i] = 0;
    rep[i] = -1;
    comp[i].clear();
  }
  nr = 0;
  unsat = 0;
  for (int i = 0; i < 2 * n + 2 * m; ++i) {
    if (!odw[i]) {
      bfs(i);
      if (unsat) return false;
      nr++;
    }
  }
  for (int i = 0; i < nr; ++i) {
    bool set_to = 0;
    for (int j : comp[i]) {
      if (val[j] == 1 || val[opposite(j)] == 0) {
        set_to = 1;
      }
    }
    for (int j : comp[i]) {
      val[j] = set_to;
    }
  }
  return true;
}
void output() {
  for (int i = 0; i < n; ++i) {
    cout << val[i];
  }
  cout << "\n";
  for (int i = 0; i < m; ++i) {
    cout << val[2 * n + i];
  }
}
void del(int x, int y) {
  for (int i = 0; i < (int)v[x].size(); ++i) {
    if (v[x][i] == y) {
      swap(v[x][i], v[x].back());
      v[x].pop_back();
    }
  }
  if (x < y) {
    del(y, x);
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      cin >> a[i][j];
      res[i][j] = 1;
    }
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      if (a[i][j] == res[i][j]) {
        v[i].push_back(2 * n + j);
        v[2 * n + m + j].push_back(n + i);
        v[n + i].push_back(2 * n + m + j);
        v[2 * n + j].push_back(i);
      } else {
        v[n + i].push_back(2 * n + j);
        v[2 * n + m + j].push_back(i);
        v[i].push_back(2 * n + m + j);
        v[2 * n + j].push_back(n + i);
      }
    }
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      if (two_sat()) {
        cout << "YES\n";
        output();
        return 0;
      }
      res[i][j] = 0;
      del(i, 2 * n + j);
      del(i, 2 * n + m + j);
      del(n + i, 2 * n + j);
      del(n + i, 2 * n + m + j);
      if (a[i][j] == res[i][j]) {
        v[i].push_back(2 * n + j);
        v[2 * n + m + j].push_back(n + i);
        v[n + i].push_back(2 * n + m + j);
        v[2 * n + j].push_back(i);
      } else {
        v[n + i].push_back(2 * n + j);
        v[2 * n + m + j].push_back(i);
        v[i].push_back(2 * n + m + j);
        v[2 * n + j].push_back(n + i);
      }
    }
  }
  if (two_sat()) {
    cout << "YES\n";
    output();
    return 0;
  }
  cout << "NO";
}