#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  cin >> n >> m;
  int a[n][m];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) cin >> a[i][j];
  for (int cnt = 0; cnt <= m; cnt++) {
    vector<int> row(n, 0), col(m, 0);
    for (int i = 0; i < m; i++) {
      if (i < cnt) {
        if (a[0][i] == 1) col[i] = 1;
      } else {
        if (a[0][i] == 0) col[i] = 1;
      }
    }
    bool flag = true;
    if (cnt < m) {
      for (int r = 1; r < n; r++) {
        int cnt0 = 0, cnt1 = 0;
        for (int c = 0; c < m; c++) {
          if (a[r][c] ^ col[c])
            cnt1++;
          else
            cnt0++;
        }
        if (!cnt0) continue;
        if (!cnt1)
          row[r] = 1;
        else
          flag = false;
      }
    } else {
      int idx = -1;
      for (int r = 1; r < n; r++) {
        int cnt0 = 0, cnt1 = 0;
        for (int c = 0; c < m; c++) {
          if (a[r][c] ^ col[c])
            cnt1++;
          else
            cnt0++;
        }
        if (cnt0 && cnt1) {
          if (idx == -1)
            idx = r;
          else
            flag = false;
        }
      }
      if (idx == -1) {
        for (int r = 1; r < n; r++) {
          int cnt0 = 0, cnt1 = 0;
          for (int c = 0; c < m; c++) {
            if (a[r][c] ^ col[c])
              cnt1++;
            else
              cnt0++;
          }
          if (cnt0) row[r] = 1;
        }
      } else {
        for (int r = 1; r < n; r++) {
          if (r == idx) continue;
          int cnt0 = 0, cnt1 = 0;
          for (int c = 0; c < m; c++) {
            if (a[r][c] ^ col[c])
              cnt1++;
            else
              cnt0++;
          }
          if (r < idx && cnt1) row[r] = 1;
          if (r > idx && cnt0) row[r] = 1;
        }
        if (a[idx][0] ^ col[0]) row[idx] = 1;
        for (int c = 1; c < m; c++) {
          if ((a[idx][c] ^ row[idx] ^ col[c]) <
              (a[idx][c - 1] ^ row[idx] ^ col[c - 1]))
            flag = false;
        }
      }
    }
    if (!flag) continue;
    cout << "YES\n";
    for (int x : row) cout << x;
    cout << "\n";
    for (int x : col) cout << x;
    return 0;
  }
  cout << "NO";
  return 0;
}
