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.
"""
starting pos of all lights is ON = 1.
in the 3x3 grid, each button press will toggle the lights side-adjacent to it too.
example-
originally, we have-
111
111
111
if i toggle light l[0][0], we get-
001
011
111
approach-
create 5x5 grid of all on lights
input grid.
add lists of ON lights to make the input grid a 5x5 grid.
iterate through the middle 3x3 grid of lights and use i+1, i-1, j+1, j-1 type operations
to toggle adjacent lights too according to whether or not the final number of presses
of a light is even or odd.
return final grid of 1,0 lights
"""
l=[]
for i in range(5): l.append([1,1,1,1,1])
k = []
for i in range(3):
    m = (list(map(int, input().split())))
    m.insert(0, 1), m.insert(4,1)
    k.append(m)
k.insert(0,[1,1,1,1,1])
k.append([1,1,1,1,1])
for i in k: print(i)

for i in range(1,4):
    for j in range(1,4):
        if k[i][j]%2 == 1:
            l[i][j] = 1 if l[i][j] == 0 else 0
            l[i][j+1] = 1 if l[i][j+1] == 0 else 0
            l[i][j-1] = 1 if l[i][j-1] == 0 else 0
            l[i+1][j] = 1 if l[i+1][j] == 0 else 0
            l[i-1][j] = 1 if l[i-1][j] == 0 else 0
print("")
for i in l: print(i)







