#include <bits/stdc++.h>
using namespace std;
int num[5][5];
bool ans[5][5];
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};
int main() {
  memset(ans, true, sizeof(ans));
  for (int i = 1; i <= 3; i++)
    for (int j = 1; j <= 3; j++) scanf("%d", &num[i][j]);
  for (int i = 1; i <= 3; i++)
    for (int j = 1; j <= 3; j++) {
      if (num[i][j] & 1) ans[i][j] = !ans[i][j];
      for (int k = 0; k < 4; k++) {
        int nx = i + dx[k], ny = j + dy[k];
        if (nx >= 1 && nx <= 3 && ny >= 1 && ny <= 3)
          if (num[i][j] & 1) ans[nx][ny] = !ans[nx][ny];
      }
    }
  for (int i = 1; i <= 3; i++) {
    if (i > 1) printf("\n");
    for (int j = 1; j <= 3; j++)
      if (ans[i][j])
        printf("1");
      else
        printf("0");
  }
  printf("\n");
  return 0;
}
