#include <bits/stdc++.h>
using namespace std;
int n, m;
vector<string> checkWorks(vector<vector<bool>> arr) {
  vector<int> row = vector<int>(n, 2);
  vector<int> col = vector<int>(m, 2);
  row[0] = 0;
  for (int j = 0; j < m; j++) {
    col[j] = arr[0][j];
  }
  bool works = true;
  for (int i = 1; i < n; i++) {
    for (int j = 0; j < m; j++) {
      bool shouldBe = arr[i][j] ^ col[j];
      if (row[i] == 2) {
        row[i] = shouldBe;
      } else {
        if (row[i] != shouldBe) {
          works = false;
          break;
        }
      }
    }
    if (!works) break;
  }
  if (works) {
    string a;
    for (int i = 0; i < n; i++) {
      if (row[i])
        a.push_back('1');
      else
        a.push_back('0');
    }
    string b;
    for (int j = 0; j < m; j++) {
      if (col[j])
        b.push_back('1');
      else
        b.push_back('0');
    }
    vector<string> ans;
    ans.push_back(a);
    ans.push_back(b);
    return ans;
  }
  row[0] = 1;
  for (int j = 0; j < m; j++) {
    col[j] = !arr[0][j];
  }
  works = true;
  for (int i = 1; i < n; i++) {
    for (int j = 0; j < m; j++) {
      bool shouldBe = arr[i][j] ^ col[j];
      if (row[i] == 2) {
        row[i] = shouldBe;
      } else {
        if (row[i] != shouldBe) {
          works = false;
          break;
        }
      }
    }
    if (!works) break;
  }
  if (works) {
    string a;
    for (int i = 0; i < n; i++) {
      if (row[i])
        a.push_back('1');
      else
        a.push_back('0');
    }
    string b;
    for (int j = 0; j < m; j++) {
      if (col[j])
        b.push_back('1');
      else
        b.push_back('0');
    }
    vector<string> ans;
    ans.push_back(a);
    ans.push_back(b);
    return ans;
  }
  return vector<string>();
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> m;
  vector<vector<bool>> arr = vector<vector<bool>>(n, vector<bool>(m));
  vector<vector<bool>> arrCopy = vector<vector<bool>>(n, vector<bool>(m));
  int x;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> x;
      if (x) {
        arr[i][j] = false;
      } else {
        arr[i][j] = true;
      }
      arrCopy[i][j] = arr[i][j];
    }
  }
  vector<string> maybe = checkWorks(arr);
  if (maybe.size() > 0) {
    cout << "YES" << endl;
    cout << maybe[0] << endl;
    cout << maybe[1] << endl;
    return 0;
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      arrCopy[i][j] = !arr[i][j];
      maybe = checkWorks(arrCopy);
      if (maybe.size() > 0) {
        cout << "YES" << endl;
        cout << maybe[0] << endl;
        cout << maybe[1] << endl;
        return 0;
      }
    }
  }
  cout << "NO" << endl;
}
