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>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
template <typename T>
void MACRO_VAR_Scan(T& t) {
  std::cin >> t;
}
template <typename First, typename... Rest>
void MACRO_VAR_Scan(First& first, Rest&... rest) {
  std::cin >> first;
  MACRO_VAR_Scan(rest...);
}
template <typename T>
void MACRO_VEC_ROW_Init(int n, T& t) {
  t.resize(n);
}
template <typename First, typename... Rest>
void MACRO_VEC_ROW_Init(int n, First& first, Rest&... rest) {
  first.resize(n);
  MACRO_VEC_ROW_Init(n, rest...);
}
template <typename T>
void MACRO_VEC_ROW_Scan(int p, T& t) {
  std::cin >> t[p];
}
template <typename First, typename... Rest>
void MACRO_VEC_ROW_Scan(int p, First& first, Rest&... rest) {
  std::cin >> first[p];
  MACRO_VEC_ROW_Scan(p, rest...);
}
template <class T>
inline T CHMAX(T& a, const T b) {
  return a = (a < b) ? b : a;
}
template <class T>
inline T CHMIN(T& a, const T b) {
  return a = (a > b) ? b : a;
}
template <class T>
using V = std::vector<T>;
template <class T>
using VV = V<V<T>>;
template <typename S, typename T>
std::ostream& operator<<(std::ostream& os, std::pair<S, T> p) {
  os << "(" << p.first << ", " << p.second << ")";
  return os;
}
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using PAIR = std::pair<ll, ll>;
using PAIRLL = std::pair<ll, ll>;
constexpr ll INFINT = (1 << 30) - 1;
constexpr ll INFINT_LIM = (1LL << 31) - 1;
constexpr ll INFLL = 1LL << 60;
constexpr ll INFLL_LIM = (1LL << 62) - 1 + (1LL << 62);
constexpr double EPS = 1e-10;
constexpr ll MOD = 1000000007;
constexpr double PI = 3.141592653589793238462643383279;
template <class T, size_t N>
void FILL(T (&a)[N], const T& val) {
  for (auto& x : a) x = val;
}
template <class ARY, size_t N, size_t M, class T>
void FILL(ARY (&a)[N][M], const T& val) {
  for (auto& b : a) FILL(b, val);
}
template <class T>
void FILL(std::vector<T>& a, const T& val) {
  for (auto& x : a) x = val;
}
template <class ARY, class T>
void FILL(std::vector<std::vector<ARY>>& a, const T& val) {
  for (auto& b : a) FILL(b, val);
}
signed main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  ;
  auto system_now = std::chrono::system_clock::now();
  std::mt19937 mt(std::chrono::duration_cast<std::chrono::microseconds>(
                      system_now.time_since_epoch())
                      .count());
  std::uniform_int_distribution<> rand(0, 1);
  ll n, m;
  MACRO_VAR_Scan(n, m);
  ;
  std::vector<std::vector<ll>> a(n, std::vector<ll>(m));
  for (auto& R : a)
    for (auto& w : R) std::cin >> w;
  ;
  for (ll I = ll(n + 1) - 1; I >= 0; --I) {
    ll pi = 0;
    if (pi == I) ++pi;
    if (pi >= n) continue;
    bool ok = true;
    V<ll> row(n);
    for (ll i = 0; i < ll(n); ++i)
      if (i != I) {
        ll cnt[] = {0, 0};
        for (ll j = 0; j < ll(m); ++j) {
          ll t = a[i][j] ^ a[pi][j];
          ++cnt[t];
        }
        if (cnt[0] && cnt[1]) {
          ok = false;
          break;
        }
        if (cnt[0])
          row[i] = 0;
        else
          row[i] = 1;
      }
    if (ok) {
      auto col(a[pi]);
      if (I < n) {
        auto ta(a[I]);
        for (ll j = 0; j < ll(m); ++j) ta[j] ^= col[j];
        auto A(ta);
        std::sort((A).begin(), (A).end());
        row[I] = -1;
        if (A == ta) {
          row[I] = 0;
        }
        std::reverse((A).begin(), (A).end());
        if (A == ta) {
          row[I] = 1;
        }
        if (row[I] == -1) continue;
      }
      std::cout << ("YES");
      std::cout << "\n";
      ;
      {
        auto b(a);
        for (ll i = 0; i < ll(n); ++i)
          for (ll j = 0; j < ll(m); ++j) {
            b[i][j] ^= row[i] ^ col[j];
          }
        if (b[0][0] == 1 && b[n - 1][m - 1] == 0) {
          for (ll i = 0; i < ll(n); ++i) row[i] ^= 1;
          for (ll i = 0; i < ll(n); ++i)
            for (ll j = 0; j < ll(m); ++j) b[i][j] ^= 1;
        }
        for (ll i = 0; i < ll(n); ++i) {
          if (i > I && b[i][0] == 0) {
            row[i] ^= 1;
            for (ll j = 0; j < ll(m); ++j) b[i][j] ^= 1;
          }
        }
      }
      for (ll i = 0; i < ll(n); ++i) {
        std::cout << (row[i]);
        ;
      }
      std::cout << "\n";
      ;
      for (ll j = 0; j < ll(m); ++j) {
        std::cout << (col[j]);
        ;
      }
      std::cout << "\n";
      ;
      return 0;
    }
  }
  std::cout << ("NO");
  std::cout << "\n";
  ;
  return 0;
}