#include <bits/stdc++.h>
using namespace std;
void past_code();
int y[6][6], q[6][6];
int main() {
  int x;
  for (int i = 2; i <= 4; i++) {
    for (int j = 2; j <= 4; j++) {
      cin >> y[i][j];
    }
  }
  for (int i = 2; i <= 4; i++) {
    for (int j = 2; j <= 4; j++) {
      q[i][j] = (y[i][j] + y[i - 1][j] + y[i][j - 1] + y[i][j + 1] +
                 y[i + 1][j] + 1) %
                2;
    }
  }
  for (int i = 2; i <= 4; i++) {
    for (int j = 2; j <= 4; j++) {
      cout << q[i][j];
    }
    cout << endl;
  }
  return 0;
}
