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 ll = long long;
const ll MOD = 1e9 + 7;
const int N = 200;
struct Mat {
  bool data[N][N];
  bool f_row[N];
  bool f_col[N];
  int w, h, ones;
  Mat(int h, int w) {
    this->w = w;
    this->h = h;
    ones = 0;
    for (int i = 0; i < N; ++i) {
      f_row[i] = 0;
      f_col[i] = 0;
      for (int j = 0; j < N; ++j) {
        data[i][j] = 0;
      }
    }
  }
  void set(int y, int x, int v) {
    ones -= data[y][x] - v;
    data[y][x] = v;
  }
  bool get(int y, int x) { return data[y][x]; }
  void flip(int y, int x) { set(y, x, get(y, x) ^ 1); }
  void flipCol(int x) {
    for (int y = 0; y < h; ++y) flip(y, x);
    f_col[x] ^= 1;
  }
  void flipRow(int y) {
    for (int x = 0; x < w; ++x) flip(y, x);
    f_row[y] ^= 1;
  }
  void print() {
    cout << "YES\n";
    for (int y = 0; y < h; ++y) cout << f_row[y];
    cout << '\n';
    for (int x = 0; x < w; ++x) cout << f_col[x];
    cout << '\n';
  }
};
void fixCols(Mat& m) {
  for (int y = 1; y < m.h; ++y) {
    if (m.get(y, 0)) m.flipRow(y);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int h, w;
  cin >> h >> w;
  Mat m1(h, w);
  Mat m2(h, w);
  for (int y = 0; y < h; ++y) {
    for (int x = 0; x < w; ++x) {
      int b;
      cin >> b;
      m1.set(y, x, b);
      m2.set(y, x, b);
    }
  }
  m2.flipRow(0);
  for (int x = 0; x < w; ++x) {
    if (m1.get(0, x)) m1.flipCol(x);
    if (m2.get(0, x)) m2.flipCol(x);
  }
  fixCols(m1);
  fixCols(m2);
  for (int i = h * w - 1; i >= -1; --i) {
    if (m1.ones == 0) {
      m1.print();
      return 0;
    } else if (m2.ones == 0) {
      m2.print();
      return 0;
    } else {
      if (i == -1) {
        cout << "NO\n";
        return 0;
      }
      int x = i % w;
      int y = i / w;
      m1.flip(y, x);
      m2.flip(y, x);
      if (y == 0) {
        if (m1.get(y, x)) {
          m1.flipCol(x);
          if (x == 0) fixCols(m1);
        }
        if (m2.get(y, x)) {
          m2.flipCol(x);
          if (x == 0) fixCols(m2);
        }
      } else if (x == 0) {
        if (m1.get(y, x)) {
          m1.flipRow(y);
        }
        if (m2.get(y, x)) {
          m2.flipRow(y);
        }
      }
    }
  }
}