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;
template <typename T>
void UpdateMax(T& a, T b) {
  if (a < b) a = b;
}
template <typename T>
void UpdateMin(T& a, T b) {
  if (a > b) a = b;
}
template <typename T>
inline void read(T& x) {
  x = 0;
  char c = getchar();
  int flag = 1;
  while (!isdigit(c)) {
    if (c == '-') flag = -1;
    c = getchar();
  }
  while (isdigit(c)) {
    x = x * 10 + c - '0';
    c = getchar();
  }
  x *= flag;
}
template <typename T>
void Unique(vector<T>& vec) {
  sort(vec.begin(), vec.end());
  vec.erase(unique(vec.begin(), vec.end()), vec.end());
}
template <typename T>
void Relabel(vector<T>& vec, T& value) {
  value = lower_bound(vec.begin(), vec.end(), value) - vec.begin() + 1;
}
template <typename T, typename V>
void Print(const pair<T, V>& x) {
  cout << x.first << " @ " << x.second << " | ";
}
template <typename T>
void Print(const T& x) {
  cout << x << " ";
}
template <typename T>
void Pcon(const T& x) {
  cout << "\nsize: " << x.size() << endl;
  for (const auto& item : x) Print(item);
}
std::vector<int> LABS;
template <typename T>
void Print(const T* x, int offset, int loop) {
  for (int i = 0; i <= loop; i++) {
    cout << "[";
    for (int item : LABS) cout << item - offset << ",";
    cout << i - offset << "]:";
    cout << x[i] << " ";
  }
}
template <typename T, typename... Args>
void Print(const T* f, int offset, int loop, Args... args) {
  for (int i = 0; i <= loop; i++) {
    LABS.push_back(i);
    Print(f[i], offset, args...);
    cout << endl;
    LABS.pop_back();
  }
}
template <typename T, typename V>
bool Has(T& cluster, const V& item) {
  return cluster.find(item) != cluster.end();
}
int Logn(long long x) {
  int cnt = 0;
  while (x) {
    ++cnt;
    x >>= 1;
  }
  return cnt;
}
const int MOD = 1e9 + 7;
const int N = 405;
const int dir[4][2] = {{-1, 0}, {0, -1}, {1, 0}, {1, 0}};
clock_t start_time;
int t, n, m;
int a[N][N];
int col[N], row[N];
inline void SetClock() { start_time = clock(); }
bool TimeOut(size_t ms) {
  if (1000 * (clock() - start_time) >= ms * ((clock_t)1000)) return true;
  return false;
}
inline pair<int, int> DeSerialize(int c) { return {(c) / m, (c) % m}; }
template <typename T, typename V>
inline void Add(T& v, const V& delta) {
  v += delta;
  if (v >= MOD) v -= MOD;
}
void PrintAns() {
  cout << "YES" << endl;
  for (int i = 0; i < n; i++) {
    cout << row[i];
  }
  cout << endl;
  for (int j = 0; j < m; j++) {
    cout << col[j];
  }
  cout << endl;
  exit(0);
}
int main() {
  srand(time(0));
  SetClock();
  cin.sync_with_stdio(false);
  cin >> n >> m;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) {
      cin >> a[i][j];
    }
  {
    for (int isSet = 0; isSet < 2; ++isSet) {
      row[0] = isSet;
      for (int j = 0; j < m; j++) {
        col[j] = isSet ^ a[0][j];
      }
      int not_all_same = -1;
      bool failed = false;
      for (int i = 1; i < n; i++) {
        for (int j = 1; j < m; j++) {
          if ((col[j] ^ a[i][j]) != (col[j - 1] ^ a[i][j - 1])) {
            if (not_all_same != -1) failed = true;
            not_all_same = i;
            break;
          }
        }
        if (failed) break;
      }
      if (!failed) {
        if (not_all_same != -1) {
          int c[N];
          for (int j = 0; j < m; j++) {
            c[j] = col[j] ^ a[not_all_same][j];
          }
          if (is_sorted(c, c + m) || is_sorted(c, c + m, greater<int>())) {
            for (int i = 1; i < n; i++) {
              row[i] = i == not_all_same
                           ? c[0]
                           : (i < not_all_same ? (a[i][0] ^ col[0])
                                               : (a[i][0] ^ col[0] ^ 1));
            }
            PrintAns();
          }
        } else {
          for (int i = 1; i < n; i++) {
            row[i] = a[i][0] ^ col[0];
          }
          PrintAns();
        }
      }
    }
  }
  {
    for (int isSet = 0; isSet < 2; isSet++) {
      row[n - 1] = isSet;
      for (int j = 0; j < m; j++) {
        col[j] = 1 ^ isSet ^ a[n - 1][j];
      }
      int not_all_same = -1;
      bool failed = false;
      for (int i = 0; i < n - 1; i++) {
        for (int j = 1; j < m; j++) {
          if ((col[j] ^ a[i][j]) != (col[j - 1] ^ a[i][j - 1])) {
            if (not_all_same != -1) failed = true;
            not_all_same = i;
            break;
          }
        }
        if (failed) break;
      }
      if (!failed) {
        if (not_all_same != -1) {
          int c[N];
          for (int j = 0; j < m; j++) {
            c[j] = col[j] ^ a[not_all_same][j];
          }
          if (is_sorted(c, c + m) || is_sorted(c, c + m, greater<int>())) {
            for (int i = 0; i < n - 1; i++) {
              row[i] = i == not_all_same
                           ? c[0]
                           : (i < not_all_same ? (a[i][0] ^ col[0])
                                               : (a[i][0] ^ col[0] ^ 1));
            }
            PrintAns();
          }
        } else {
          for (int i = 1; i < n; i++) {
            row[i] = a[i][0] ^ col[0];
          }
          PrintAns();
        }
      }
    }
  }
  cout << "NO" << endl;
}