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

// region template
#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define trav(a, x) for (auto &a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;

ll gcd(ll a, ll b) { return __gcd(a, b); }

ll euclid(ll a, ll b, ll &x, ll &y) {
    if (b) {
        ll d = euclid(b, a % b, y, x);
        return y -= a / b * x, d;
    }
    return x = 1, y = 0, a;
}

typedef unsigned long long ull;
typedef long double ld;
ull mod_mul(ull a, ull b, ull M) {
    ll ret = a * b - M * ull(ld(a) * ld(b) / ld(M));
    return ret + M * (ret < 0) - M * (ret >= (ll)M);
}
ull mod_pow(ull b, ull e, ull mod) {
    ull ans = 1;
    for (; e; b = mod_mul(b, b, mod), e /= 2)
        if (e & 1)
            ans = mod_mul(ans, b, mod);
    return ans;
}

const ll mod = 1000000007;
struct Mod {
    ll x;
    Mod(ll xx) : x(xx) {}
    Mod operator+(Mod b) { return Mod((x + b.x) % mod); }
    Mod operator-(Mod b) { return Mod((x - b.x) % mod); }
    Mod operator*(Mod b) { return Mod((x * b.x) % mod); }
    Mod operator/(Mod b) { return *this * invert(b); }
    Mod invert(Mod a) {
        ll x, y, g = euclid(a.x, mod, x, y);
        assert(g == 1);
        return Mod((x + mod) % mod);
    }
    Mod operator^(ll e) {
        if (!e)
            return Mod(1);
        Mod r = *this ^ (e / 2);
        r = r * r;
        return e & 1 ? *this * r : r;
    }
};
// endregion

char board[8][8], board2[8][8];
const int dir[8][2] = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}, {-1, -1}, {-1, 1}, {1, -1}, {1, 1}};

void apply(char board[8][8], int i, int j, char player) {
    board[i][j] = player;
    rep(d, 0, 8) {
        int ii, jj;
        for (ii = i + dir[d][0], jj = j + dir[d][1]; 0 <= ii && ii < 8 && 0 <= jj && jj < 8 && board[ii][jj] == (player ^ 'x' ^ 'o'); ii += dir[d][0], jj += dir[d][1]) ;
        // cout << dir[d][0] << " " << dir[d][1] << " " << ii << " " << jj << endl;
        if (!(0 <= ii && ii < 8 && 0 <= jj && jj < 8 && board[ii][jj] == player)) {
            continue;
        }
        for (int p = i, q = j; p != ii || q != jj; p += dir[d][0], q += dir[d][1])
            board[p][q] = player;
    }
}

int score(int i, int j, char player) {
    if (board[i][j] != '.')
        return -100;
    char other = player ^ 'x' ^ 'o';
    int before = 0, after = 0;
    rep(i, 0, 8) rep(j, 0, 8) if (board[i][j] == other) before++;
    rep(i, 0, 8) rep(j, 0, 8) board2[i][j] = board[i][j];
    apply(board2, i, j, player);
    rep(i, 0, 8) rep(j, 0, 8) if (board2[i][j] == other) after++;
    return before - after;
}

int main() {
    rep(i, 0, 8) rep(j, 0, 8) cin >> skipws >> board[i][j];

    char player = 'o';
    int fail = 0;

    while (true) {
        int mi = 0, mj = 0, ms = -100;
        rep(i, 0, 8) rep(j, 0, 8) {
            int s = score(i, j, player);
            if (player == 'o' && s > ms || player == 'x' && s >= ms)
                ms = s, mi = i, mj = j;
        }
        if (ms <= 0) {
            fail++;
            player = player ^ 'x' ^ 'o';
            if (fail >= 2) {
                break;
            }
            continue;
        } else fail = 0;

        apply(board, mi, mj, player);

        player = player ^ 'x' ^ 'o';
    }
    rep(i, 0, 8) {
        rep(j, 0, 8) cout << board[i][j];
        cout << endl;
    }
}


Measured memory_bytes: 3112