#include <bits/stdc++.h>
using namespace std;
long long rd() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
int x = 0, y = 0, n, m;
int r[1010], c[1010];
int main() {
  n = rd();
  m = rd();
  vector<vector<int> > a(n, vector<int>(m));
  vector<vector<int> > b(n, vector<int>(m, 1));
  for (int i = 0; i <= (int)n - 1; i++)
    for (int j = 0; j <= (int)m - 1; j++) a[i][j] = rd();
  for (int k = 1; k <= (int)n * m; k++) {
    int flag = 0;
    for (int i = 0; i <= (int)m - 1; i++) c[i] = a[0][i] ^ b[0][i];
    for (int i = 1; i <= (int)n - 1; i++) {
      r[i] = c[0] ^ a[i][0] ^ b[i][0];
      for (int j = 1; j <= (int)m - 1; j++)
        if (c[j] ^ r[i] ^ b[i][j] != a[i][j]) {
          flag = 1;
          break;
        }
      if (flag) break;
    }
    if (!flag) {
      printf("YES\n");
      for (int i = 0; i <= (int)n - 1; i++) printf("%d", r[i]);
      printf("\n");
      for (int i = 0; i <= (int)m - 1; i++) printf("%d", c[i]);
      return 0;
    }
    b[x][y] = 0;
    if (y == m - 1) {
      x++;
      y = 0;
    } else
      y++;
  }
  printf("NO\n");
}
