#include<iostream>
using namespace std;
int main(){
int h=5,n,m;
int z[5][5];
for(int i=0;i<h;i++){
for(int j=0;j<h;j++){
cin>>z[i][j];
}
}
cin>>n>>m;
for(int i=0;i<h;i++){
for(int j=0;j<h;j++){
if(i==n-1&&j==m-1){
cout<<"+";
}
else{
if(z[i][j]==0){
cout<<"○";
}else if(z[i][j]==1){
cout<<"●";
}
}
cout<<" ";
}
cout<<endl;
}
cout<<"fire";
cout<<endl;
for(int i=0;i<h;i++){
for(int j=0;j<h;j++){
if(i==n-1&&j==m-1){
cout<<"+";
}
else{
if(z[i][j]==0 || i==n-1 || j==m-1){
cout<<"○";
}else if(z[i][j]==1){
cout<<"●";
}
}
cout<<" ";
}
cout<<endl;
}
}