#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)n; ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cout<<*i<<" "; cout<<endl; }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;
int trees[1000][1000];
int main(){
  int H, W;
  cin>>H>>W;
  int row[1000] = {};
  int col[1000] = {};
  REP(y, H) REP(x, W) {
    cin>>trees[y][x];
    row[y] ^= trees[y][x];
    col[x] ^= trees[y][x];
  }
  REP(y, H){
    REP(x, W){
      cout<< (row[y] ^ col[x] ^ trees[y][x] ^ 1);
      if(x == W - 1) cout<<endl;
      else cout<<" ";
    }
  }
  return 0;
}