#include <iostream>
#include <vector>
#include <string>
using namespace std;

int main() {
    vector<string> v(8);
    for(int i=0; i<8; ++i) {
        cin >> v[i]; // v[y][x]
    }

    int turn = 0;
    int pass_cnt = 0;
    bool finished = false;
    while(pass_cnt < 2 && !finished) {
        if(turn % 2 == 0) {
            int put_x = 0, put_y = 0;
            int reverse_num = 0;
            int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1},
                dy[8] = {0, 1, 0, -1, -1, 1, 1, -1};
            for(int i=0; i<8; ++i) {
                for(int j=0; j<8; ++j) {
                    if(v[i][j] == '.') {
                        int reverse_num2 = 0;
                        for(int d=0; d<8; ++d) {
                            int r_num2_tmp = 0;
                            int cx = j, cy = i;
                            while(true) {
                                int nx = cx + dx[d], ny = cy + dy[d];
                                if(nx < 0 || 8 <= nx || ny < 0 || 8 <= ny) {
                                    r_num2_tmp = 0;
                                    break;
                                }
                                if(v[ny][nx] == 'x') {
                                    r_num2_tmp++;
                                } else if(v[ny][nx] == 'o') {
                                    break;
                                } else if(v[ny][nx] == '.') {
                                    r_num2_tmp = 0;
                                    break;
                                }
                                cx = nx; cy = ny;
                            }
                            reverse_num2 += r_num2_tmp;
                        }
                        if(reverse_num2 > reverse_num) {
                            reverse_num = reverse_num2;
                            put_x = j;
                            put_y = i;
                        }
                    }
                }
           }
           if(reverse_num == 0) {
               pass_cnt += 1;
           } else {
               pass_cnt = 0;
               v[put_y][put_x] = 'o';
               //cout << "o turn: " << put_y+1 << " " << put_x+1 << endl;

               int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1},
                   dy[8] = {0, 1, 0, -1, -1, 1, 1, -1};
               for(int d=0; d<8; ++d) {
                   int cx = put_x, cy = put_y;
                   while(true) {
                       int nx = cx + dx[d], ny = cy + dy[d];
                       if(nx < 0 || 8 <= nx || ny < 0 || 8 <= ny) {
                           break;
                       }
                       if(v[ny][nx] == 'o') {
                           int x = put_x, y = put_y;
                           while(x != nx || y != ny) {
                                v[y][x] = 'o';
                                y += dy[d];
                                x += dx[d];
                           }
                           break;
                       } else if(v[ny][nx] == '.') {
                           break;
                       }
                       cx = nx; cy = ny;
                   }
               }
           }
        } else {
            int put_x = 0, put_y = 0;
            int reverse_num = 0;
            int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1},
                dy[8] = {0, 1, 0, -1, -1, 1, 1, -1};
            for(int i=7; i>=0; --i) {
                for(int j=7; j>=0; --j) {
                    if(v[i][j] == '.') {
                        int reverse_num2 = 0;
                        for(int d=0; d<8; ++d) {
                            int r_num2_tmp = 0;
                            int cx = j, cy = i;
                            while(true) {
                                int nx = cx + dx[d], ny = cy + dy[d];
                                if(nx < 0 || 8 <= nx || ny < 0 || 8 <= ny) {
                                    r_num2_tmp = 0;
                                    break;
                                }
                                if(v[ny][nx] == 'o') {
                                    r_num2_tmp++;
                                } else if(v[ny][nx] == 'x') {
                                    break;
                                } else if(v[ny][nx] == '.') {
                                    r_num2_tmp = 0;
                                    break;
                                }
                                cx = nx; cy = ny;
                            }
                            reverse_num2 += r_num2_tmp;
                        }
                        if(reverse_num2 > reverse_num) {
                            reverse_num = reverse_num2;
                            put_x = j;
                            put_y = i;
                        }
                    }
                }
           }
           if(reverse_num == 0) {
               pass_cnt += 1;
           } else {
               pass_cnt = 0;
               v[put_y][put_x] = 'x';

               //cout << "x turn: " << put_y+1 << " " << put_x+1 << endl;
               int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1},
                   dy[8] = {0, 1, 0, -1, -1, 1, 1, -1};
               for(int d=0; d<8; ++d) {
                   int cx = put_x, cy = put_y;
                   while(true) {
                       int nx = cx + dx[d], ny = cy + dy[d];
                       if(nx < 0 || 8 <= nx || ny < 0 || 8 <= ny) {
                           break;
                       }
                       if(v[ny][nx] == 'x') {
                           int x = put_x, y = put_y;
                           while(x != nx || y != ny) {
                                v[y][x] = 'x';
                                y += dy[d];
                                x += dx[d];
                           }
                           break;
                       } else if(v[ny][nx] == '.') {
                           break;
                       }
                       cx = nx;
                       cy = ny;
                   }
               }
           }
        }
        turn++;

        finished = true;
        for(auto& x : v) {
            if(x.find('.') != string::npos) {
                finished = false;
            }
        }
    }

    for(auto& x : v) {
        cout << x << endl;
    }
}


Measured memory_bytes: 3224