#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define LLINF 1000000000000000ll
#define sz(x) ((int)(x).size())
#define sq(x) ((x)*(x))
#define fi first
#define sec second
#define SORT(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
int f[10][10];
int dx[8]={0,0,1,1,1,-1,-1,-1};
int dy[8]={1,-1,1,-1,0,1,0,-1};
char str[4]="x.o";
bool inner(int x,int y){
    if(x<0||x>=8||y<0||y>=8)return false;
    return true;
}
int rev(int x,int y,int p){
    int ret = 0;
    for(int d=0;d<8;d++){
        int cnt=0;
        int nx = x, ny = y;
        while(1){
            nx += dx[d];
            ny += dy[d];
            if(!inner(nx,ny)){
                cnt = 0;
                break;
            }
            if(f[nx][ny]==p)break;
            else if(f[nx][ny]==-p)cnt++;
            else{
                cnt = 0;
                break;
            }
        }
        ret += cnt;
    }
    return ret;
}
void change(int x,int y,int p){
    for(int d=0;d<8;d++){
        int cnt=0;
        int nx = x, ny = y;
        while(1){
            nx += dx[d];
            ny += dy[d];
            if(!inner(nx,ny)){
                cnt = 0;
                break;
            }
            if(f[nx][ny]==p)break;
            else if(f[nx][ny]==-p)cnt++;
            else{
                cnt = 0;
                break;
            }
        }
        nx = x, ny = y;
        for(int i=0;i<cnt;i++){
            nx += dx[d];
            ny += dy[d];
            f[nx][ny]=p;
        }
    }
    f[x][y]=p;
    return;
}
int main(){
    string s;
    for(int i=0;i<8;i++){
        cin >> s;
        for(int j=0;j<8;j++){
            if(s[j]=='.')f[i][j]=0;
            else if(s[j]=='o')f[i][j]=1;
            else f[i][j]=-1;
        }
    }
    int p = 1;
    bool pass = false;
    for(;;){
        int max_rev = 0;
        int mx = -1, my = -1;
        if(p==1){
            for(int i=7;i>=0;i--){
                for(int j=7;j>=0;j--){
                    if(f[i][j]!=0)continue;
                    int r = rev(i,j,p);
                    if(max_rev <= r){
                        max_rev = r;
                        mx = i;
                        my = j;
                    }
                }
            }
        }else{
            for(int i=0;i<8;i++){
                for(int j=0;j<8;j++){
                    if(f[i][j]!=0)continue;
                    int r = rev(i,j,p);
                    if(max_rev <= r){
                        max_rev = r;
                        mx = i;
                        my = j;
                    }
                }
            }
        }
        if(max_rev == 0){
            if(pass)break;
            pass = true;
        }else{
            pass = false;
            change(mx,my,p);
        }
        p *= -1;
    }
    for(int i=0;i<8;i++){
        for(int j=0;j<8;j++){
            printf("%c",str[f[i][j]+1]);
        }
        printf("\n");
    }
    return 0;
}

Measured memory_bytes: 3216