#include <bits/stdc++.h>
using namespace std;
const int dx4[] = {-1, 0, 1, 0};
const int dy4[] = {0, 1, 0, -1};
int grid[11][11];
int gmap[11][11];
bool judge(int x, int y) {
  if (x >= 0 && x < 3 && y >= 0 && y < 3) return true;
  return false;
}
void solve1() {
  for (int i = 0; i < (int)(3); ++i)
    for (int j = 0; j < (int)(3); ++j) gmap[i][j] = 1;
  for (int i = 0; i < (int)(3); ++i) {
    for (int j = 0; j < (int)(3); ++j) {
      cin >> grid[i][j];
      grid[i][j] %= 2;
    }
  }
  for (int i = 0; i < (int)(3); ++i) {
    for (int j = 0; j < (int)(3); ++j) {
      if (grid[i][j]) {
        gmap[i][j] ^= 1;
        for (int k = 0; k < (int)(4); ++k) {
          int x = i + dx4[k];
          int y = j + dy4[k];
          if (judge(x, y)) gmap[x][y] ^= 1;
        }
      }
    }
  }
}
void solve2() {
  for (int i = 0; i < (int)(3); ++i)
    for (int j = 0; j < (int)(3); ++j) gmap[i][j] = 1;
  int t;
  for (int i = 0; i < (int)(3); ++i) {
    for (int j = 0; j < (int)(3); ++j) {
      cin >> t;
      if (t % 2 == 1) {
        for (int x = max(0, i - 1); x <= min(i + 1, 2); x++)
          gmap[x][j] = !gmap[x][j];
        for (int y = max(0, j - 1); y <= min(j + 1, 2); y++)
          gmap[i][y] = !gmap[i][y];
        gmap[i][j] = !gmap[i][j];
      }
    }
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  solve1();
  for (int i = 0; i < 3; i++, cout << endl) {
    for (int j = 0; j < (int)(3); ++j) cout << gmap[i][j];
  }
  return 0;
}
