#include <stdio.h>
#include <iostream>
#include <vector>
#include <list>
#include <cmath>
#include <fstream>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <iterator>
#include <cstdlib>
#include <cstring>
#include <sstream>

using namespace std;

#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) (EQ((a).real(),(b).real()) && EQ((a).imag(),(b).imag()))

typedef complex<double> P;
typedef long long ll;

const int MAX_SIZE = 10000;

const char mark[]={'o','x'};
const int dy[]={-1,-1,-1,0,0,0,1,1,1};
const int dx[]={-1,0,1,-1,0,1,-1,0,1};

void solve(){
    char field[10][10];
    for(int i = 0; i < 8; i++)
        for(int j = 0; j < 8; j++)
            cin>>field[i][j];
    int tern=0;
    int cnt=0;
    int tmp=0;
    while(1){
        tmp++;
        bool isRev=false;
        vector<pair<int,pair<int,int> > > vipii;
        for(int i = 7; i >= 0; i--){
            for(int j = 7; j >= 0; j--){
                if(field[i][j]=='.'){
                    // ツ各ツ陛サツ古シツづ可づつつ「ツづ陳イツづ猟づゥ
                    int sum=0;
                    for(int k = 0; k < 9; k++){
                        int ny=i+dy[k];
                        int nx=j+dx[k];
                        if(!(ny>=0&&nx>=0&&ny<8&&nx<8)||field[ny][nx]!=mark[(tern+1)%2])
                            continue;
                        int idx=0;
                        // ツづ債つウツづ慊づェツづつ「ツづゥツつゥツづつ、ツつゥツ陳イツづ猟づゥ
                        while(1){
                            idx++;
                            ny+=dy[k];nx+=dx[k];
                            if(!(ny>=0&&nx>=0&&ny<8&&nx<8))
                                break;
                            // ツづ債つウツづ慊づェツづづゥ
                            if(field[ny][nx]==mark[tern]){
                                sum+=idx;
                                break;
                            }
                            else if(field[ny][nx]=='.')
                                break;
                        }
                    }
                    if(sum!=0){
                        if(tern%2==0)
                            vipii.push_back(make_pair(sum,make_pair(-i,-j)));
                        else
                            vipii.push_back(make_pair(sum,make_pair(i,j)));
                    }
                }
            }
        }
        if(vipii.size()==0)
            cnt++;
        else
            cnt=0;
        if(cnt>=2)
            break;
        if(vipii.size()>=1){
            sort(vipii.begin(),vipii.end(),greater<pair<int,pair<int,int> > >());
            int y,x;
            if(tern%2==0){
                y=-vipii[0].second.first;
                x=-vipii[0].second.second;
            }
            else{
                y=vipii[0].second.first;
                x=vipii[0].second.second;
            }
            for(int k = 0; k < 9; k++){
                int ny=y+dy[k];
                int nx=x+dx[k];
                if(!(ny>=0&&nx>=0&&ny<8&&nx<8)||field[ny][nx]!=mark[(tern+1)%2])
                    continue;
                int idx=0;
                // ツづ債つウツづ慊づェツづつ「ツづゥツつゥツづつ、ツつゥツ陳イツづ猟づゥ
                while(1){
                    idx++;
                    ny+=dy[k];nx+=dx[k];
                    if(!(ny>=0&&nx>=0&&ny<8&&nx<8))
                        break;
                    // ツづ債つウツづ慊づェツづづゥ
                    if(field[ny][nx]==mark[tern]){
                        isRev=true;
                        // ツづ青づつュツづィツ陛板つオツづつ「ツつュ
                        int cx=nx;
                        int cy=ny;
                        while(1){
                            if(cx==x&&y==cy){
                                field[cy][cx]=mark[tern];
                                break;
                            }
                            field[cy][cx]=mark[tern];
                            cx-=dx[k];
                            cy-=dy[k];
                        }
                        break;
                    }
                    else if(field[ny][nx]=='.')
                        break;
                }
            }
        }
        tern=(tern+1)%2;
    }
    for(int i = 0; i < 8; i++){
        for(int j = 0; j < 8; j++){
            cout<<field[i][j];
        }
        cout<<endl;
    }
}

int main(){
    solve();
}

Measured memory_bytes: 0