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

pair<int, int> check(vector<vector<char>> &field, int turn) {
    char ore = 'o';
    char teki = 'x';
    if (turn%2 == 0) {
        ore = 'x';
        teki = 'o';
    }
    
    pair<int, int> ret = {-1, -1};
    int ma = 0;
    if (turn % 2) {
        for (int i = 1; i <= 8; i++) {
            for (int j = 1; j <= 8; j++) {
                if (field[i][j] != '.') continue;
                int sum = 0;
                int cnt = 0;
                for (int k = 1; k < 10; k++) {
                    int ni = i - k;
                    int nj = j;
                    if (field[ni][nj] == teki) cnt++;
                    else if (field[ni][nj] == ore) {
                        sum += cnt;
                        break;
                    } else {
                        break;
                    }
                }
                cnt = 0;
                for (int k = 1; k < 10; k++) {
                    int ni = i + k;
                    int nj = j;
                    if (field[ni][nj] == teki) cnt++;
                    else if (field[ni][nj] == ore) {
                        sum += cnt;
                        break;
                    } else {
                        break;
                    }
                }
                cnt = 0;
                for (int k = 1; k < 10; k++) {
                    int ni = i - k;
                    int nj = j + k;
                    if (field[ni][nj] == teki) cnt++;
                    else if (field[ni][nj] == ore) {
                        sum += cnt;
                        break;
                    } else {
                        break;
                    }
                }
                cnt = 0;
                for (int k = 1; k < 10; k++) {
                    int ni = i + k;
                    int nj = j - k;
                    if (field[ni][nj] == teki) cnt++;
                    else if (field[ni][nj] == ore) {
                        sum += cnt;
                        break;
                    } else {
                        break;
                    }
                }
                cnt = 0;
                for (int k = 1; k < 10; k++) {
                    int ni = i;
                    int nj = j + k;
                    if (field[ni][nj] == teki) cnt++;
                    else if (field[ni][nj] == ore) {
                        sum += cnt;
                        break;
                    } else {
                        break;
                    }
                }
                cnt = 0;
                for (int k = 1; k < 10; k++) {
                    int ni = i;
                    int nj = j - k;
                    if (field[ni][nj] == teki) cnt++;
                    else if (field[ni][nj] == ore) {
                        sum += cnt;
                        break;
                    } else {
                        break;
                    }
                }
                cnt = 0;
                for (int k = 1; k < 10; k++) {
                    int ni = i + k;
                    int nj = j + k;
                    if (field[ni][nj] == teki) cnt++;
                    else if (field[ni][nj] == ore) {
                        sum += cnt;
                        break;
                    } else {
                        break;
                    }
                }
                cnt = 0;
                for (int k = 1; k < 10; k++) {
                    int ni = i - k;
                    int nj = j - k;
                    if (field[ni][nj] == teki) cnt++;
                    else if (field[ni][nj] == ore) {
                        sum += cnt;
                        break;
                    } else {
                        break;
                    }
                }
                if (ma < sum) {
                    ma = sum;
                    ret = {i, j};
                }
            }
        }
    } else {
        for (int i = 8; i >= 1; i--) {
            for (int j = 8; j >= 1; j--) {
                if (field[i][j] != '.') continue;
                int sum = 0;
                int cnt = 0;
                for (int k = 1; k < 10; k++) {
                    int ni = i - k;
                    int nj = j;
                    if (field[ni][nj] == teki) cnt++;
                    else if (field[ni][nj] == ore) {
                        sum += cnt;
                        break;
                    } else {
                        break;
                    }
                }
                cnt = 0;
                for (int k = 1; k < 10; k++) {
                    int ni = i + k;
                    int nj = j;
                    if (field[ni][nj] == teki) cnt++;
                    else if (field[ni][nj] == ore) {
                        sum += cnt;
                        break;
                    } else {
                        break;
                    }
                }
                cnt = 0;
                for (int k = 1; k < 10; k++) {
                    int ni = i - k;
                    int nj = j + k;
                    if (field[ni][nj] == teki) cnt++;
                    else if (field[ni][nj] == ore) {
                        sum += cnt;
                        break;
                    } else {
                        break;
                    }
                }
                cnt = 0;
                for (int k = 1; k < 10; k++) {
                    int ni = i + k;
                    int nj = j - k;
                    if (field[ni][nj] == teki) cnt++;
                    else if (field[ni][nj] == ore) {
                        sum += cnt;
                        break;
                    } else {
                        break;
                    }
                }
                cnt = 0;
                for (int k = 1; k < 10; k++) {
                    int ni = i;
                    int nj = j + k;
                    if (field[ni][nj] == teki) cnt++;
                    else if (field[ni][nj] == ore) {
                        sum += cnt;
                        break;
                    } else {
                        break;
                    }
                }
                cnt = 0;
                for (int k = 1; k < 10; k++) {
                    int ni = i;
                    int nj = j - k;
                    if (field[ni][nj] == teki) cnt++;
                    else if (field[ni][nj] == ore) {
                        sum += cnt;
                        break;
                    } else {
                        break;
                    }
                }
                cnt = 0;
                for (int k = 1; k < 10; k++) {
                    int ni = i + k;
                    int nj = j + k;
                    if (field[ni][nj] == teki) cnt++;
                    else if (field[ni][nj] == ore) {
                        sum += cnt;
                        break;
                    } else {
                        break;
                    }
                }
                cnt = 0;
                for (int k = 1; k < 10; k++) {
                    int ni = i - k;
                    int nj = j - k;
                    if (field[ni][nj] == teki) cnt++;
                    else if (field[ni][nj] == ore) {
                        sum += cnt;
                        break;
                    } else {
                        break;
                    }
                }
                if (ma < sum) {
                    ma = sum;
                    ret = {i, j};
                }
            }
        }
    }
    return ret;
}

void attack(pair<int, int> p, vector<vector<char>> &field, int turn) {
    char ore = 'o';
    char teki = 'x';
    if (turn%2 == 0) {
        ore = 'x';
        teki = 'o';
    }
    
    pair<int, int> ret = {-1, -1};
    int ma = 0;
    vector<vector<pair<int, int>>> st;
    for (int i = p.first; i <= p.first; i++) {
        for (int j = p.second; j <= p.second; j++) {
            field[i][j] = ore;
            int sum = 0;
            int cnt = 0;
            vector<pair<int, int>> tmp;
            for (int k = 1; k < 10; k++) {
                int ni = i - k;
                int nj = j;
                if (field[ni][nj] == teki) {
                    cnt++;
                    tmp.push_back({ni, nj});
                }
                else if (field[ni][nj] == ore) {
                    sum += cnt;
                    st.push_back(tmp);
                    break;
                } else {
                    break;
                }
            }
            cnt = 0;
            tmp.clear();
            for (int k = 1; k < 10; k++) {
                int ni = i + k;
                int nj = j;
                if (field[ni][nj] == teki) {
                    cnt++;
                    tmp.push_back({ni, nj});
                }
                else if (field[ni][nj] == ore) {
                    sum += cnt;
                    st.push_back(tmp);
                    break;
                } else {
                    break;
                }
            }
            cnt = 0;
            tmp.clear();
            for (int k = 1; k < 10; k++) {
                int ni = i - k;
                int nj = j + k;
                if (field[ni][nj] == teki) {
                    cnt++;
                    tmp.push_back({ni, nj});
                }
                else if (field[ni][nj] == ore) {
                    st.push_back(tmp);
                    sum += cnt;
                    break;
                } else {
                    break;
                }
            }
            cnt = 0;
            tmp.clear();
            for (int k = 1; k < 10; k++) {
                int ni = i + k;
                int nj = j - k;
                if (field[ni][nj] == teki) {
                    tmp.push_back({ni, nj});
                    cnt++;
                }
                else if (field[ni][nj] == ore) {
                    st.push_back(tmp);
                    sum += cnt;
                    break;
                } else {
                    break;
                }
            }
            cnt = 0;
            tmp.clear();
            for (int k = 1; k < 10; k++) {
                int ni = i;
                int nj = j + k;
                if (field[ni][nj] == teki) {
                    tmp.push_back({ni, nj});
                    cnt++;
                } else if (field[ni][nj] == ore) {
                    st.push_back(tmp);
                    sum += cnt;
                    break;
                } else {
                    break;
                }
            }
            cnt = 0;
            tmp.clear();
            for (int k = 1; k < 10; k++) {
                int ni = i;
                int nj = j - k;
                if (field[ni][nj] == teki) {
                    cnt++;
                    tmp.push_back({ni, nj});
                } else if (field[ni][nj] == ore) {
                    st.push_back(tmp);
                    sum += cnt;
                    break;
                } else {
                    break;
                }
            }
            cnt = 0;
            tmp.clear();
            for (int k = 1; k < 10; k++) {
                int ni = i + k;
                int nj = j + k;
                if (field[ni][nj] == teki) {
                    cnt++;
                    tmp.push_back({ni, nj});
                } else if (field[ni][nj] == ore) {
                    st.push_back(tmp);
                    sum += cnt;
                    break;
                } else {
                    break;
                }
            }
            cnt = 0;
            tmp.clear();
            for (int k = 1; k < 10; k++) {
                int ni = i - k;
                int nj = j - k;
                if (field[ni][nj] == teki) {
                    cnt++;
                    tmp.push_back({ni, nj});
                } else if (field[ni][nj] == ore) {
                    st.push_back(tmp);
                    sum += cnt;
                    break;
                } else {
                    break;
                }
            }
            if (ma < sum) {
                ma = sum;
                ret = {i, j};
            }
        }
    }
    for (int i = 0; i < st.size(); i++) {
        for (auto &p : st[i]) {
            field[p.first][p.second] = ore;
        }
    }
    return;
}

int main(void) {
    vector<vector<char>> field(10, vector<char>(10, '#'));
    for (int i = 1; i <= 8; i++) {
        for (int j = 1; j <= 8; j++) {
            cin >> field[i][j];
        }
    }

    for (int turn = 1; turn < 150; turn++) {
        pair<int, int> p = check(field, turn);
        if (p.first != -1) {
            attack(p, field, turn);
        }
    }
    
    for (int i = 1; i <= 8; i++) {
        for (int j = 1; j <= 8; j++) {
            cout << field[i][j];
        }
        cout << endl;
    }
}



Measured memory_bytes: 3108