//=================================
// Created on: 2018/07/03 05:33:41
//=================================
#include <bits/stdc++.h>
using namespace std;
int main()
{
    vector<vector<int>> state(8, vector<int>(8, 0));
    for (int i = 0; i < 8; i++) {
        for (int j = 0; j < 8; j++) {
            char c;
            cin >> c, state[i][j] = c == '.' ? -1 : c == 'o' ? 1 : 0;
        }
    }
    auto next = [](vector<vector<int>>& state, const int turn) {
        int maxi = 0;
        vector<vector<int>> next_state;
        for (int ii = 0; ii < 8; ii++) {
            for (int jj = 0; jj < 8; jj++) {
                const int i = turn == 1 ? ii : 7 - ii;
                const int j = turn == 1 ? jj : 7 - jj;
                if (state[i][j] != -1) { continue; }
                auto prev = state;
                state[i][j] = turn;
                int u = 1, d = 1, l = 1, r = 1, ul = 1, ur = 1, dl = 1, dr = 1;
                for (; i - u >= 0 and state[i - u][j] == 1 - turn; u++) {}
                if (i - u < 0 or state[i - u][j] == -1) { u = 1; }
                u--;
                for (int k = 1; k <= u; k++) { state[i - k][j] = turn; }

                for (; i + d < 8 and state[i + d][j] == 1 - turn; d++) {}
                if (i + d >= 8 or state[i + d][j] == -1) { d = 1; }
                d--;
                for (int k = 1; k <= d; k++) { state[i + k][j] = turn; }

                for (; j - l >= 0 and state[i][j - l] == 1 - turn; l++) {}
                if (j - l < 0 or state[i][j - l] == -1) { l = 1; }
                l--;
                for (int k = 1; k <= l; k++) { state[i][j - k] = turn; }

                for (; j + r < 8 and state[i][j + r] == 1 - turn; r++) {}
                if (j + r >= 8 or state[i][j + r] == -1) { r = 1; }
                r--;
                for (int k = 1; k <= r; k++) { state[i][j + k] = turn; }

                for (; i - ul >= 0 and j - ul >= 0 and state[i - ul][j - ul] == 1 - turn; ul++) {}
                if (i - ul < 0 or j - ul < 0 or state[i - ul][j - ul] == -1) { ul = 1; }
                ul--;
                for (int k = 1; k <= ul; k++) { state[i - k][j - k] = turn; }

                for (; i - ur >= 0 and j + ur < 8 and state[i - ur][j + ur] == 1 - turn; ur++) {}
                if (i - ur < 0 or j + ur >= 8 or state[i - ur][j + ur] == -1) { ur = 1; }
                ur--;
                for (int k = 1; k <= ur; k++) { state[i - k][j + k] = turn; }

                for (; i + dl < 8 and j - dl >= 0 and state[i + dl][j - dl] == 1 - turn; dl++) {}
                if (i + dl >= 8 or j - dl < 0 or state[i + dl][j - dl] == -1) { dl = 1; }
                dl--;
                for (int k = 1; k <= dl; k++) { state[i + k][j - k] = turn; }

                for (; i + dr < 8 and j + dr < 8 and state[i + dr][j + dr] == 1 - turn; dr++) {}
                if (i + dr >= 8 or j + dr >= 8 or state[i + dr][j + dr] == -1) { dr = 1; }
                dr--;
                for (int k = 1; k <= dr; k++) { state[i + k][j + k] = turn; }

                const int sum = u + d + l + r + ul + ur + dl + dr;
                if (maxi < sum) { maxi = sum, next_state = state; }
                state = prev;
            }
        }
        if (maxi == 0) {
            return state;
        } else {
            return next_state;
        }
    };
    auto print = [&]() {
        for (int i = 0; i < 8; i++) {
            for (int j = 0; j < 8; j++) {
                cout << (state[i][j] == -1 ? '.' : state[i][j] == 0 ? 'x' : 'o');
            }
            cout << endl;
        }
    };
    bool passed = false;
    for (int turn = 1;; turn = 1 - turn) {
        auto prev = state;
        state = next(state, turn);
        //print();
        if (prev == state) {
            if (passed) { break; }
            passed = true;
        } else {
            passed = false;
        }
    }
    print();
    return 0;
}



Measured memory_bytes: 3172