#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n, m;
  cin >> n >> m;
  vector<vector<int>> d(n, vector<int>(m));
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) cin >> d[i][j];
  for (int i = 0; i <= m; i++) {
    string s(n, '0'), t(m, '0');
    for (int j = m - 1; j > m - 1 - i; j--) {
      if (d[n - 1][j] == 0) t[j] = '1';
    }
    bool ok = 1;
    if (i != m) {
      for (int j = m - 1 - i; j >= 0; j--) {
        if (d[n - 1][j] == 1) t[j] = '1';
      }
      for (int j = n - 2; j >= 0; j--) {
        int cnt = 0;
        for (int k = m - 1; k >= 0; k--)
          if (d[j][k] == 0 && t[k] == '1')
            cnt++;
          else if (d[j][k] == 1 && t[k] == '0')
            cnt++;
        if (cnt == m)
          s[j] = '1';
        else if (cnt > 0)
          ok = 0;
      }
    } else {
      bool end = 0;
      for (int j = n - 2; j >= 0; j--) {
        if (end) {
          int cnt = 0;
          for (int k = m - 1; k >= 0; k--)
            if (d[j][k] == 0 && t[k] == '1')
              cnt++;
            else if (d[j][k] == 1 && t[k] == '0')
              cnt++;
          if (cnt == m)
            s[j] = '1';
          else if (cnt > 0)
            ok = 0;
        } else {
          int pref = 1;
          int cnt = 0;
          for (int k = m - 1; k >= 0; k--) {
            if (d[j][k] == 1 && t[k] == '1')
              cnt++;
            else if (d[j][k] == 0 && t[k] == '0')
              cnt++;
            if ((d[j][k] == 0 && t[k] == '1') && k != m - 1 &&
                ((d[j][k + 1] == 1 && t[k + 1] == '1') ||
                 (d[j][k + 1] == 0 && t[k + 1] == '0')))
              pref = 0;
            else if ((d[j][k] == 1 && t[k] == '0') && k != m - 1 &&
                     ((d[j][k + 1] == 1 && t[k + 1] == '1') ||
                      (d[j][k + 1] == 0 && t[k + 1] == '0')))
              pref = 0;
          }
          if (cnt == m)
            s[j] = '1';
          else if (cnt > 0 && pref)
            end = 1;
          else if (cnt > 0)
            ok = 0;
        }
      }
    }
    if (ok) {
      cout << "YES\n";
      cout << s << '\n';
      cout << t << '\n';
      return;
    }
  }
  for (int i = 0; i <= m; i++) {
    string s(n, '0'), t(m, '0');
    s[n - 1] = '1';
    for (int j = m - 1; j > m - 1 - i; j--) {
      if (d[n - 1][j] == 1) t[j] = '1';
    }
    bool ok = 1;
    if (i != m) {
      for (int j = m - 1 - i; j >= 0; j--) {
        if (d[n - 1][j] == 0) t[j] = '1';
      }
      for (int j = n - 2; j >= 0; j--) {
        int cnt = 0;
        for (int k = m - 1; k >= 0; k--)
          if (d[j][k] == 0 && t[k] == '1')
            cnt++;
          else if (d[j][k] == 1 && t[k] == '0')
            cnt++;
        if (cnt == m)
          s[j] = '1';
        else if (cnt > 0)
          ok = 0;
      }
    } else {
      bool end = 0;
      for (int j = n - 2; j >= 0; j--) {
        if (end) {
          int cnt = 0;
          for (int k = m - 1; k >= 0; k--)
            if (d[j][k] == 0 && t[k] == '1')
              cnt++;
            else if (d[j][k] == 1 && t[k] == '0')
              cnt++;
          if (cnt == m)
            s[j] = '1';
          else if (cnt > 0)
            ok = 0;
        } else {
          int pref = 1;
          int cnt = 0;
          for (int k = m - 1; k >= 0; k--) {
            if (d[j][k] == 1 && t[k] == '1')
              cnt++;
            else if (d[j][k] == 0 && t[k] == '0')
              cnt++;
            if ((d[j][k] == 0 && t[k] == '1') && k != m - 1 &&
                ((d[j][k + 1] == 1 && t[k + 1] == '1') ||
                 (d[j][k + 1] == 0 && t[k + 1] == '0')))
              pref = 0;
            else if ((d[j][k] == 1 && t[k] == '0') && k != m - 1 &&
                     ((d[j][k + 1] == 1 && t[k + 1] == '1') ||
                      (d[j][k + 1] == 0 && t[k + 1] == '0')))
              pref = 0;
          }
          if (cnt == m)
            s[j] = '1';
          else if (cnt > 0 && pref)
            end = 1;
          else if (cnt > 0)
            ok = 0;
        }
      }
    }
    if (ok) {
      cout << "YES\n";
      cout << s << '\n';
      cout << t << '\n';
      return;
    }
  }
  cout << "NO";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int q = 1;
  for (; q > 0; q--) {
    solve();
    cout << '\n';
  }
}
