#include <bits/stdc++.h>
using namespace std;

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr(i,n) for(int i=(int)(n-1);i>=0;i--)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout << #x" = " << x << endl
#define print(x) cout << x << endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
typedef pair<int, P> PIP;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;
typedef set<int> S;

#define INF INT_MAX/3
#define MAX_N 1000000001

char table[8][8];
int dx[] = {1, 1, 0, -1, -1, -1, 0, 1};
int dy[] = {0, 1, 1, 1, 0, -1, -1, -1};

bool range(int x, int y) {
    return 0 <= x && x < 8 && 0 <= y && y < 8;
}

int change(char c, P p) {
    int count = 0;
    rep(i, 8) {
        int x = p.se + dx[i], y = p.fi + dy[i];
        int tmp = 0;
        while(range(x, y) && c != table[y][x] && table[y][x] != '.') {
            tmp++;
            y += dy[i], x += dx[i];
        }
        if (range(x, y) && table[y][x] == c) count += tmp;
    }
    return count;
}

int main(){
    cin.sync_with_stdio(false);
    rep(i, 8)rep(j, 8) cin >> table[i][j];
    bool mami = true;
    int fin = 0;
    while(fin < 2) {
        int maxi = 0;
        P p;
        if (mami) {
            char c = 'o';
            rep(i, 8)rep(j, 8) {
                if (table[i][j] != '.') continue;
                int cnt = change(c, P(i, j));
                if (cnt > maxi) {
                    p = P(i, j);
                    maxi = cnt;
                }
            }
            if (maxi > 0) {
                fin = 0;
                table[p.fi][p.se] = c;
                rep(i, 8) {
                    int x = p.se + dx[i], y = p.fi + dy[i];
                    while(range(x, y) && c != table[y][x] && table[y][x] != '.') {
                        y += dy[i], x += dx[i];
                    }
                    if (range(x, y) && table[y][x] == c) {
                        x = p.se + dx[i], y = p.fi + dy[i];
                        while(range(x, y) && c != table[y][x] && table[y][x] != '.') {
                            table[y][x] = c;
                            y += dy[i], x += dx[i];
                        }
                    }
                }
            } else {
                fin++;
            }
        } else {
            char c = 'x';
            repr(i, 8)repr(j, 8) {
                if (table[i][j] != '.') continue;
                int cnt = change(c, P(i, j));
                if (cnt > maxi) {
                    p = P(i, j);
                    maxi = cnt;
                }
            }
            if (maxi > 0) {
                fin = 0;
                table[p.fi][p.se] = c;
                rep(i, 8) {
                    int x = p.se + dx[i], y = p.fi + dy[i];
                    while(range(x, y) && c != table[y][x] && table[y][x] != '.') {
                        y += dy[i], x += dx[i];
                    }
                    if (range(x, y) && table[y][x] == c) {
                        x = p.se + dx[i], y = p.fi + dy[i];
                        while(range(x, y) && c != table[y][x] && table[y][x] != '.') {
                            table[y][x] = c;
                            y += dy[i], x += dx[i];
                        }
                    }
                }
            } else {
                fin++;
            }
        }

        mami = !mami;
    }

    rep(i, 8) {
        rep(j, 8) cout << table[i][j];
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 3216