#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(a) (a).begin(),(a).end()
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
const int INF=2e9;
double EPS=1e-10;
char fld[8][8];
char rev(char c){
      return c=='o'?'x':'o';
}
char turn(int k){
      return k==0?'x':'o';
}
bool pos(int x,int y){
      return 0<=x&&x<8&&0<=y&&y<8;
}
int cnt(int x,int y,int dx,int dy,char k){
      int res=0;
      char l=rev(k);
      x+=dx;y+=dy;
      while(1){
            if(fld[x][y]==l)res++;
            else break;
            x+=dx;y+=dy;
            if(!pos(x,y)){
                  return 0;
            }
      }
      if(fld[x][y]==k){
            //cout<<"ok"<<endl;
            return res;
      }
      //cout<<"ok"<<endl;
      return 0;
}
int rec(int x,int y,char k){
      //cout<<x<<" "<<y<<" "<<k<<endl;;
      int res=0;
      for(int i=-1;i<=1;i++){
            for(int j=-1;j<=1;j++){
                  if(i==0&&j==0)continue;
                  //cout<<"ok"<<endl;
                  res+=cnt(x,y,i,j,k);
                  //if(x==2&&y==4)cout<<res<<" ";
            }
      }
      //if(x==2&&y==4)cout<<endl;
      return res;
}
void change(int x,int y,char k){
      //cout<<x<<" "<<y<<" "<<k<<endl;
      for(int i=-1;i<=1;i++){
            for(int j=-1;j<=1;j++){
                  if(i==0&&j==0)continue;
                  int res=cnt(x,y,i,j,k);
                  //cout<<res<<endl;
                  if(res==0)continue;
                  REP(l,res+1){
                        fld[x+i*l][y+j*l]=k;
                  }
            }
      }
      return;
}
int main(){
      REP(i,8)REP(j,8)cin>>fld[j][i];
      int t=1;
      int c=0;//d=0;
      while(1){
            //d++;
            int ma=0,mx,my;
            //cout<<turn(t)<<endl;
            if(t==1){
                  for(int i=7;i>=0;i--)for(int j=7;j>=0;j--){
                        if(fld[j][i]!='.')continue;
                        int res=rec(j,i,turn(t));
                        //cout<<res<<" ";
                        //if(res==0)continue;
                        if(res>=ma){
                              mx=j;my=i;ma=res;
                        }
                  }
            }else{
                  REP(i,8)REP(j,8){
                        if(fld[j][i]!='.')continue;
                        int res=rec(j,i,turn(t));
                        //cout<<res<<" ";
                        //if(res==0)continue;
                        if(res>=ma){
                              mx=j;my=i;ma=res;
                        }
                  }
            }
            //REP(i,8)REP(j,8)printf("%c%c",fld[j][i],j==7?'\n':' ');cout<<endl;
            //cout<<endl<<mx<<" "<<my<<" "<<ma<<" "<<turn(t)<<endl;
            if(ma==0){
                  //cout<<1<<endl;
                  c++;
                  t^=1;
                  //cout<<c<<endl;
                  if(c>=2)break;
                  continue;
            }else c=0;
            //REP(i,8)REP(j,8)printf("%c%c",fld[j][i],j==7?'\n':' ');cout<<endl;
            //cout<<1<<endl;
            //fld[mx][my]=turn(t);
            change(mx,my,turn(t));
            //REP(i,8){REP(j,8)printf("%c",fld[j][i]);cout<<endl;}
            //cout<<endl;
            t^=1;
            //if(d>10)break;
      }
      REP(i,8){REP(j,8)printf("%c",fld[j][i]);cout<<endl;}
}

Measured memory_bytes: 1128