#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define all(v) begin(v), end(v)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 2000000000
#define int long long int

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define LEQ(n, m) ((n) <= (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))
#define GEQ(n, m) ((n) + EPS >= (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

int const MOD = 1000000007;
ll mod_pow(ll x, ll n) {return (!n)?1:(mod_pow((x*x)%MOD,n/2)*((n&1)?x:1))%MOD;}
int madd(int a, int b) {return (a + b) % MOD;}
int msub(int a, int b) {return (a - b + MOD) % MOD;}
int mmul(int a, int b) {return (a * b) % MOD;}
int minv(int a) {return mod_pow(a, MOD-2);}
int mdiv(int a, int b) {return mmul(a, minv(b));}

namespace std {
    bool operator<(const P& a, const P& b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}

int dx[] = {0, 1, -1, 0, 1, -1, 1, -1};
int dy[] = {1, 1, 1, -1, -1, -1, 0, 0};
const int MAMI = 0;
const int WITCH = 1;
string pat = "ox";

bool comp(int turn, int a1, int b1, int a2, int b2) {
    if(turn == MAMI) {
        return a1 != a2 ? a1 < a2 : b1 < b2;
    }
    else if(turn == WITCH) {
        return a1 != a2 ? a1 > a2 : b1 > b2;
    }
}

void change(vector<string> &board, pii point, int turn, vector<int> dirs) {
    rep(k,0,dirs.size()) {
        int x = point.fr, y = point.sc;
        while(1) {
            board[x][y] = pat[turn];
            x = x + dx[ dirs[k] ], y = y + dy[ dirs[k] ];
            if(board[x][y] == pat[turn]) break;
        }
    }
}

void solve(vector<string> &prev, int turn=MAMI, int flag=0) {
    char ch = pat[turn];
    int ma = 0;
    pii point = pii(-1, 0);
    vector<int> dirs;
    rep(i,0,8) {
        rep(j,0,8) {
            if(prev[i][j] != '.') continue;
            int temp = 0;
            vector<int> vs;
            rep(k,0,8) {
                int cnt = 0;
                int x = i, y = j;
                while(1) {
                    x = x + dx[k], y = y + dy[k];
                    if(x < 0 || x >= 8 || y < 0 || y >= 8 || prev[x][y] == '.') {
                        cnt = 0;
                        break;
                    }
                    if(prev[x][y] == ch) {
                        vs.pb(k);
                        break;
                    }
                    cnt++;
                }
                temp += cnt;
            }
            if(temp && temp > ma) {
                ma = temp;
                point = pii(i, j);
                dirs = vs;
            }
            else if(temp && temp == ma) {
                if(comp(turn, i, j, point.fr, point.sc)) {
                    point = pii(i, j);
                    dirs = vs;
                }
            }
        }
    }

    if(point.fr >= 0) {
        change(prev, point, turn, dirs);
        flag = 0;
    }
    else {
        if(flag) return;
        flag = 1;
    }
    solve(prev, turn ^ 1, flag);
}

signed main() {
    vector<string> board(8);
    rep(i,0,8) cin >> board[i];
    solve(board);
    rep(i,0,8) {
        rep(j,0,8) {
            cout << board[i][j];
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 3224