#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
//#define EACH(i, c) for (auto &(i): c)
#define all(c) begin(c),end(c)
//#define EXIST(s, e) ((s).find(e)!=(s).end())
//#define SORT(c) sort(begin(c),end(c))
//#define pb emplace_back
//#define MP make_pair
//#define SZ(a) int((a).size())

//#define LOCAL 0
//#ifdef LOCAL
//#define DEBUG(s) cout << (s) << endl
//#define dump(x)  cerr << #x << " = " << (x) << endl
//#define BR cout << endl;
//#else
//#define DEBUG(s) do{}while(0)
//#define dump(x) do{}while(0)
//#define BR
//#endif


//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007
//ここから編集する
int H = 8, W = 8;
vector<string> vs(H);


int count_one(int h, int w, char mark, int dh, int dw) {
    char enemy = (mark == 'o') ? 'x' : 'o';

    string str = "";
    for (int i = h + dh, j = w + dw; j >= 0 && j < W && i >= 0 && i < H; i += dh, j += dw) {
        str += vs[i][j];
        if (vs[i][j] == enemy) {
            continue;
        } else {
            break;
        }
    }

    if (str.back() == mark) {
        return static_cast<int>(str.size() - 1);
    } else {
        return 0;
    }

}

int count(int h, int w, char mark) {
    int dh[] = {1, 1, 0, -1, -1, -1, 0, 1};
    int dw[] = {0, 1, 1, 1, 0, -1, -1, -1};
    int ret = 0;
    rep(i, 0, 8) {
        ret += count_one(h, w, mark, dh[i], dw[i]);
    }
    return ret;
}

void reverse(int h, int w, char mark, int dh, int dw) {
    char enemy = (mark == 'o') ? 'x' : 'o';
    for (
            int i = h + dh, j = w + dw;
            vs[i][j] != mark;
            i += dh, j += dw) {
        vs[i][j] = mark;
    }
}

void pt(int h, int w, char mark) {
    int dh[] = {1, 1, 0, -1, -1, -1, 0, 1};
    int dw[] = {0, 1, 1, 1, 0, -1, -1, -1};
    vs[h][w] = mark;
    rep(i, 0, 8) {
        if (count_one(h, w, mark, dh[i], dw[i]) > 0) {
            reverse(h, w, mark, dh[i], dw[i]);
        }
    }
}

bool solve() {

    rep(i, 0, H) {
        cin >> vs[i];
    }

    int turn = 1;
    int rest = 64;
    while (rest--) {
        int max_v = 0;
        int max_h = -1;
        int max_w = -1;
        bool put = false;
        if (turn) {
            for (int i = 0; i < H; i++) {
                for (int j = 0; j < W; j++) {
                    if (vs[i][j] == '.') {
                        int tmp = count(i, j, 'o');
                        put = true;
                        if (max_v < tmp) {
                            max_v = tmp;
                            max_h = i;
                            max_w = j;
                        }
                    }
                }
            }
            if (max_h != -1) {
                pt(max_h, max_w, 'o');
            }
        } else {
            for (int i = H - 1; i >= 0; i--) {
                for (int j = W - 1; j >= 0; j--) {
                    if (vs[i][j] == '.') {
                        int tmp = count(i, j, 'x');
                        put = true;
                        if (max_v < tmp) {
                            max_v = tmp;
                            max_h = i;
                            max_w = j;
                        }
                    }

                }
            }
            if (max_h != -1) {
                pt(max_h, max_w, 'x');
            }
        }

        turn ^= 1;

        if (false) {
            rep(i, 0, H) {
                cout << vs[i] << endl;
            }
            cout << "---" << endl;
        }
    }

    rep(i, 0, H) {
        cout << vs[i] << endl;
    }


    return true;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    solve();


    return 0;
}



Measured memory_bytes: 3228