#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <queue>
#include <complex>

#define INF 100000000
#define EPS 1e-9

using namespace std;

typedef long long ll;
typedef complex<double> P;

#define MAX_H 8
#define MAX_W 8

string maze[MAX_H];

int board[MAX_H][MAX_W];

int main(){
  
  for (int i = 0; i < 8; i++){
    cin >> maze[i];
    for (int j = 0; j < 8; j++){
      if (maze[i][j] == 'o')
	board[i][j] = 1;
      else if (maze[i][j] == 'x')
	board[i][j] = -1;
      else
	board[i][j] = 0;
    }
  }
  
  int pass = 0;
  int turn = 1;
  
  while (pass < 2){
    
    int enemy = -1 * turn;
    
    int x = -1, y = -1;
    int sum = 0;
    
    if (turn == 1){
      for (int i = 0; i < 8; i++){
	for (int j = 0; j < 8; j++){
	  if (board[i][j] != 0)
	    continue;
	  int res = 0;
	  for (int dx = -1; dx <= 1; dx++){
	    for (int dy = -1; dy <= 1; dy++){
	      if (dx == 0 && dy == 0)
		continue;
	      if (i + dy >= 0 && i + dy < 8 && 
		  j + dx >= 0 && j + dx < 8 && 
		  board[i + dy][j + dx] == enemy){
		for (int d = 1; i + dy*d >= 0 && i + dy*d < 8 && 
		       j + dx*d >= 0 && j + dx*d < 8; d++){
		  if (board[i + dy*d][j + dx*d] == 0)
		    break;
		  if (board[i + dy*d][j + dx*d] == turn){
		    res += d-1;
		    break;
		  }
		}
	      }
	    }
	  }
	  if (sum < res){
	    sum = res;
	    x = j;
	    y = i;
	  }
	}
      }
    }
    
    else{
      for (int i = 7; i >= 0; i--){
	for (int j = 7; j >= 0; j--){
	  if (board[i][j] != 0)
	    continue;
	  int res = 0;
	  for (int dx = -1; dx <= 1; dx++){
	    for (int dy = -1; dy <= 1; dy++){
	      if (dx == 0 && dy == 0)
		continue;
	      if (i + dy * 1 >= 0 && i + dy * 1 < 8 && 
		  j + dx * 1 >= 0 && j + dx * 1 < 8 && 
		  board[i + dy][j + dx] == enemy){
		for (int d = 1; i + dy*d >= 0 && i + dy*d < 8 && 
		       j + dx*d >= 0 && j + dx*d < 8; d++){
		  if (board[i + dy*d][j + dx*d] == 0)
		    break;
		  if (board[i + dy*d][j + dx*d] == turn){
		    res += d-1;
		    break;
		  }
		}
	      }
	    }
	  }
	  if (sum < res){
	    sum = res;
	    x = j;
	    y = i;
	  }
	}
      }
    }
    
    if (x == -1){
      pass++;
      turn *= -1;
      continue;
    }
    
    board[y][x] = turn;
    
    for (int dx = -1; dx <= 1; dx++){
      for (int dy = -1; dy <= 1; dy++){
	if (dx == 0 && dy == 0)
	  continue;
	if (y + dy >= 0 && y + dy < 8 && 
	    x + dx >= 0 && x + dx < 8 && 
	    board[y + dy][x + dx] == enemy){
	  bool flag = false;
	  for (int d = 2; y + dy*d >= 0 && y + dy*d < 8 && 
		 x + dx*d >= 0 && x + dx*d < 8; d++){
	    if(board[y+dy*d][x+dx*d] == 0)
	      break;
	    if(board[y+dy*d][x+dx*d] == turn){
	      flag = true;
	      break;
	    }
	  }
	  if(flag){
	    for (int d = 1; y + dy*d >= 0 && y + dy*d < 8 && 
		   x + dx*d >= 0 && x + dx*d < 8; d++){
	      board[y+dy*(d-1)][x+dx*(d-1)] = turn;
	      if(board[y+dy*d][x+dx*d] == turn){
		break;
	      }
	    }
	  }
	}
      }
    }
    
    turn *= -1;
    pass = 0;
    
  }
  
  for (int i = 0; i < 8; i++){
    for (int j = 0; j < 8; j++){
      if (board[i][j] == 1)
	cout << 'o';
      else if (board[i][j] == -1)
	cout << 'x';
      else
	cout << '.';
    }
    cout << endl;
  }
  
  return 0;
  
}

Measured memory_bytes: 1184