#include <bits/stdc++.h>
using namespace std;
bool light[3][3];
int main() {
  for (int i = 0; i < 3; ++i) {
    light[i][0] = true;
    light[i][1] = true;
    light[i][2] = true;
  }
  int a[3][3];
  int b[3][3];
  for (int i = 0; i < 3; ++i) {
    cin >> a[i][0];
    cin >> a[i][1];
    cin >> a[i][2];
    b[i][0] = 0;
    b[i][1] = 0;
    b[i][2] = 0;
  }
  b[0][0] = a[0][0] + a[0][1] + a[1][0];
  b[0][1] = a[0][1] + a[0][0] + a[1][1] + a[0][2];
  b[0][2] = a[0][2] + a[0][1] + a[1][2];
  b[1][0] = a[0][0] + a[2][0] + a[1][1] + a[1][0];
  b[1][1] = a[1][2] + a[0][1] + a[1][0] + a[1][1] + a[2][1];
  b[1][2] = a[1][2] + a[0][2] + a[1][1] + a[2][2];
  b[2][0] = a[2][0] + a[1][0] + a[2][1];
  b[2][1] = a[2][1] + a[2][0] + a[2][2] + a[1][1];
  b[2][2] = a[2][2] + a[1][2] + a[2][1];
  for (int i = 0; i < 3; ++i) {
    if (b[i][0] % 2)
      cout << "0";
    else
      cout << "1";
    if (b[i][1] % 2)
      cout << "0";
    else
      cout << "1";
    if (b[i][2] % 2)
      cout << "0";
    else
      cout << "1";
    cout << endl;
  }
  return 0;
}
