Lenny is playing a game on a 3 × 3 grid of lights. In the beginning of the game all lights are switched on. Pressing any of the lights will toggle it and all side-adjacent lights. The goal of the game is to switch all the lights off. We consider the toggling as follows: if the light was switched on then it will be switched off, if it was switched off then it will be switched on.

Lenny has spent some time playing with the grid and by now he has pressed each light a certain number of times. Given the number of times each light is pressed, you have to print the current state of each light.
The input consists of three rows. Each row contains three integers each between 0 to 100 inclusive. The *j*-th number in the *i*-th row is the number of times the *j*-th light of the *i*-th row of the grid is pressed.
# https://codeforces.com/problemset/problem/275/A

"""
You have a 3x3 grid of lights.
At the start all lights are on
Pressing any of the lights will toggle all side-adjacent lights
(add 1 then mod 2)

The order in which you press the lights does not matter
As long as you press the same ones the same amount of times.

This is because consider an arbitrary point in the grid.
All it knows is whether it is on or off
This corresponds to how many moves have been performed on it.

If the total number of moves are performed on a bulb then its new state is
    1 + number of moves % 2
"""

import sys

matrix = []

for i in range(3):
    row = list(map(int, sys.stdin.readline().split()))
    matrix.append(row)

output_matrix = [
    [0, 0, 0],
    [0, 0, 0],
    [0, 0, 0]
]


def check(i, j):
    return 0 <= i <= 2 and 0 <= j <= 2


for i in range(3):
    for j in range(3):

        output = matrix[i][j]

        if check(i, j+1):
            output += matrix[i][j+1]
        if check(i, j-1):
            output += matrix[i][j-1]
        if check(i+1, j):
            output += matrix[i+1][j]
        if check(i-1, j):
            output += matrix[i-1][j]

        output_matrix[i][j] = (1 + output) % 2

for row in output_matrix:
    sys.stdout.write("".join(map(str, row)) + "\n")

