//#include<stdio.h>
//#include<string.h>
//int main()
//{
//
// char words[25] = {0};
//
// int i;
//
// scanf("%s",words);
//
// for(i=0; i<strlen(words); i++)
// {
// printf("\'%c\'",words[i]);
// printf("\n");
// }
//
//}
//#include<stdio.h>
//#include<string.h>
//int main()
//{
//
// char words[105] = {0};
//
// int i;
//
// int cnt[28] = {0};
//
// gets(words);
//
//
// for(i=0; i<strlen(words); i++)
// {
// if(words[i]>='a'&&words[i]<='z')
// {
// cnt[words[i]-'a']++;
// }
// }
// for(i=0; i<26; i++)
// {
// printf("%c:%d\n",i+'a',cnt[i]);
// }
//
//
//}
//#include<stdio.h>
//#include<string.h>
//int main()
//{
//
// char words[25] = {0};
//
// int i;
//
// scanf("%s",words);
//
// for(i=0; i<strlen(words); i++)
// {
// printf("%c",words[i]+2);
//
// }
// printf("\n");
// for(i=0; i<strlen(words); i++)
// {
// printf("%c",(words[i]*7)%80+48);
// }
//
//
//}
//#include<stdio.h>
//#include<string.h>
//int main()
//{
//
// char words[105] = {0};
//
// int i;
// int cnt1 = 0;
// int cnt2 = 0;
//
// scanf("%s",words);
//
// for(i=0; i<strlen(words); i++)
// {
// if(words[i]=='c' || words[i]=='C')
// {
// cnt1++;
// }
// }
// for(i=0; i<strlen(words); i++)
// {
// if(words[i]=='c' || words[i]=='C')
// {
// if(words[i+1]=='c' || words[i+1]=='C')
// {
// cnt2++;
// }
// }
// }
// printf("%d\n",cnt1);
// printf("%d",cnt2);
//
//
//}
//#include<stdio.h>
//#include<string.h>
//int main()
//{
//
// char words[15] = {0};
//
// int i;
//
// scanf("%s",words);
//
// for(i=0; i<strlen(words); i++)
// {
// if(words[i]=='t')
// {
// printf("%d ",i+1);
// }
// }
//
//
//}
//#include<stdio.h>
//#include<string.h>
//int main()
//{
//
// char words[105] = {0};
//
// int i;
//
// int cnt=0;
//
// gets(words);
//
// for(i=0; i<strlen(words); i++)
// {
// if(words[i]=='l')
// {
// if(words[i+1]=='o')
// {
// if(words[i+2]=='v')
// {
// if(words[i+3]=='e')
// {
// cnt++;
// }
// }
// }
// }
//
// }
// printf("%d",cnt);
//
//
//}
//#include<stdio.h>
//#include<string.h>
//int main()
//{
//
// char words[100] = {0};
//
// int i;
//
// scanf("%s",words);
//
// if(strlen(words)==3)
// {
// if(words[0]=='I')
// {
// if(words[1]=='O')
// {
// if(words[2]=='I')
// {
// printf("IOI is the International Olympiad in Informatics.");
// }
// else {
// printf("I don't care.");
// }
// }
// else {
// printf("I don't care.");
// }
// }
// else {
// printf("I don't care.");
// }
// }
// else {
// printf("I don't care.");
// }
//
//
//}
//#include<stdio.h>
//#include<string.h>
//int main()
//{
//
// char words[14] = {0};
//
// int i;
//
// scanf("%s",words);
//
// printf("welcome! ");
//
// for(i=0; i<strlen(words); i++)
// {
// printf("%c",words[i]);
// }
//
//
//}
//#include<stdio.h>
//#include<string.h>
//int main()
//{
//
// char words1[105] = {0};
// char words2[105] = {0};
//
// long long int i,n;
//
// scanf("%s %s",words1,words2);
//
// if(strlen(words1)>strlen(words2))
// {
// printf("%s %s",words2,words1);
// }
// else if(strlen(words1)==strlen(words2))
// {
// strlen(words1)==strlen(words2)==n;
// for(i=0; i<n; i++)
// {
// if(words1[i]>words2[i])
// {
// printf("%s %s",words2,words1);
// break;
// }
// else if(words1[i]<words2[i])
// {
// printf("%s %s",words1,words2);
// break;
// }
//
// }
//
//
// }
// else
// {
// printf("%s %s",words1,words2);
// }
//
//
//
//
//}
//#include<stdio.h>
//#include<string.h>
//int main()
//{
//
// char words[505] = {0};
//
// int i,sum=0;
//
// scanf("%s",words);
//
// for(i=0; i<strlen(words); i++)
// {
// sum += words[i];
// }
// if(sum%3==0)
// {
// printf("1");
// }
// else
// {
// printf("0");
// }
//
//
//}
//#include<stdio.h>
//#include<string.h>
//int main()
//{
//
// char words1[25] = {0};
// char words2[25] = {0};
// char words3[25] = {0};
//
// int i,a,b,c;
//
// scanf("%s",words1);
// scanf("%s",words2);
// scanf("%s",words3);
//
// strlen(words1)==a;
// strlen(words2)==b;
// strlen(words3)==c;
// if((words1[a-1]==words2[0]) && (words2[b-1]==words3[0]) && (words3[c-1]==words1[0]))
// {
// printf("good");
// }
// else
// {
// printf("bad");
// }
//
//
//}
#include<stdio.h>
int main()
{
int i,j,x,y,sum=0,k=0;
int map[27][27] = {0};
for(i=0; i<25; i++)
{
for(j=0; j<25; j++)
{
scanf("%d",&map[i][j]);
}
}
for(i=1; i<24; i++)
{
for(j=1; j<24; j++)
{
if(map[i][j]==0)
{
for(x=i-1; x<=i+1; x++)
{
for(y=j-1; y<=j+1; y++)
{
sum = sum+map[x][y];
}
}
if(sum==3)
{
map[i][j]=1;
sum=0;
}
else
{
map[i][j]=0;
sum=0;
}
}
}
}
for(i=0; i<25; i++)
{
for(j=0; j<25; j++)
{
printf("%d ",map[i][j]);
}
printf("\n");
}
}