#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[9];
  int b[9];
  for (int i = 0; i < 9; i++) cin >> a[i];
  b[0] = a[0] + a[1] + a[3];
  b[1] = a[0] + a[1] + a[2] + a[4];
  b[2] = a[1] + a[2] + a[5];
  b[3] = a[0] + a[3] + a[4] + a[6];
  b[4] = a[1] + a[3] + a[4] + a[5] + a[7];
  b[5] = a[2] + a[4] + a[5] + a[8];
  b[6] = a[3] + a[6] + a[7];
  b[7] = a[4] + a[6] + a[7] + a[8];
  b[8] = a[5] + a[7] + a[8];
  for (int i = 0; i < 9; i++) {
    if (b[i] % 2 == 0) cout << 1;
    if (b[i] % 2 == 1) cout << 0;
    if ((i + 1) % 3 == 0) cout << endl;
  }
  return 0;
}
