# n = int(input())
# x = 0
# y = (n+1)//2
# num = 0
# temp = 1
# arr = [[0 for j in range(n+1)]for i in range(n+1)]
#
# for i in range(n*n):
# num+=1
# arr[temp][y] = num
#
# if num%n == 0:
# temp += 1
# else:
# temp-=1
# y+=1
# if temp<1:
# temp = n
# if y > n:
# y = 1
#
#
# for i in range(1, n+1):
# for j in range(1, n+1):
# print(arr[i][j], end = ' ')
# print()
# n = int(input())
# x = n-1
# y = 0
# k = 1
# arr = [[0 for j in range(n+1)]for i in range(n+1)]
#
# while k!=n*(n+1)/2+1:
# while arr[x][y] == 0 and x>=0 and y < n:
# arr[x][y] = k
# k+=1
# x-=1
# y+=1
# x+=2
# y-=1
# while arr[x][y] == 0 and x<n and y >=0:
# arr[x][y] = k
# k+=1
# x+=1
# y-=1
# x-=1
# y+=2
# [1 0 1 0 0 0 0 0 0 ]
# for i in range(n):
# for j in range(n):
# print(arr[i][j], end = ' ')
# print()
# data = [[0 for i in range(26)]*26]
# for i in range(1, 10):
# v = list(map(int, input().split()))
# v.insert (0, 0)
# v.append (0)
# data.append(v)
# data.append([0 for i in range(11)])
# sum = 0
# for x in range(25):
# for y in range(25):
# def life(x,y) :
# #x,y의 주변 8칸의 생명의 갯수
# global data
# global sum
# data[x][y]=1
# if data[x - 1][y - 1] == 1:
# sum += 1
# if data[x - 1][y] == 1:
# sum += 1
# if data[x - 1][y + 1] == 1:
# sum += 1
#
# if data[x][y + 1] == 1:
# sum += 1
# if data[x][y - 1] == 1:
# sum += 1
#
# if data[x + 1][y + 1] == 1:
# sum += 1
# if data[x + 1][y - 1] == 1:
# sum += 1
# if data[x + 1][y] == 1:
# sum += 1
#
# for i in range(25):
# for j in range(25):
# if life(i, j)==3 and data[i][j] == 0:
# data[i][j] = 1
# if data[i][j] == 1 and life(i, j)>=4 or life(i, j)<=1:
# data[i][j] = 0
# if data[i][j] == 1 and life(i, j) == 2 or life(i, j) == 3:
# data[i][j] = 1
#
# for i in range():
# for j in range():
# print(data[i][j], end = ' ')
# print()
data = [[0 for i in range(26)]*26]
arr = []
for i in range(25):
v = list(map(int, input().split()))
v.insert (0, 0)
v.append (0)
arr.append(v)
data.append([0 for i in range(27)])
f = 0
for i in range(25):
for j in range(25):
f = arr[i-1][j-1] + arr[i-1][j] + arr[i-1][j+1] + arr[i][j-1] + arr[i][j+1] + arr[i+1][j-1] + arr[i+1][j] + arr[i+1][j+1]
if arr[i][j] == 0:
if f==3:
arr[i][j] = 1
elif arr[i][j] == 1:
if f==3 or f==2:
sum[i][j] = 1
elif f>=4 or f<=1:
sum[i][j] = 0
for i in range(1, 26):
for j in range(1, 26):
print(sum[i][j], end = ' ')
print()