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

struct point{
  int x, y;
};
vector<vector<char> > v(8);
int xa[8] = {1,1,1,-1,-1,-1,0,0};
int ya[8] = {1,0,-1,1,0,-1,1,-1};
int xx, yy;

int xcount(point poi, int xa, int ya){
  int cnt = 0;
  int judge = 0;
  int x = poi.x, y = poi.y;
  while(1){
    x += xa; y += ya;
    if(x > 7 || y > 7 || x < 0 || y < 0) return 0;
    if(v[y][x] == '.') return 0;
    else if(v[y][x] == 'x'){
      cnt++;
    }else if(v[y][x] == 'o'){
      judge = 1;
      break;
    }
  }
  if(judge == 1)
    return cnt;
  else return 0;
}

int ocount(point poi, int xa, int ya){
  int cnt = 0;
  int judge = 0;
  int x = poi.x, y = poi.y;
  //  cout << "hoge" << endl;;
  while(1){
    x += xa; y += ya;
    if(x > 7 || y > 7 || x < 0 || y < 0) return 0;
    if(v[y][x] == '.') return 0;
    else if(v[y][x] == 'o'){
      cnt++;
    }else if(v[y][x] == 'x'){
      judge = 1;
      break;
    }
  }
  // cout << "hoge" << endl;;
  if(judge == 1)
    return cnt;
  else return 0;
}

int osolve(point poi){
  int ans = 0;
  // cout << "hoge" << endl;;
  for(int i = 0; i < 8; i++){
    int x = poi.x + xa[i], y = poi.y + ya[i];
    if(x >= 0 && y >= 0 && x < 8 && y < 8 && v[y][x] == 'x'){
      int cp = xcount(poi,xa[i],ya[i]);
    
	ans += cp;
	xx = xa[i]; yy = ya[i];
    
    }
  }
  return ans;
}

int xsolve(point poi){
  int ans = 0;
  for(int i = 0; i < 8; i++){
    int x = poi.x + xa[i], y = poi.y + ya[i];
    if(x >= 0 && y >= 0 && x < 8 && y < 8 && v[y][x] == 'o'){
      int cp = ocount(poi,xa[i],ya[i]);
    
	ans += cp;
	xx = xa[i]; yy = ya[i];
    
    }
  }
  return ans;

}


void change1(point poi){
  int xo = poi.x, yo = poi.y;
  v[yo][xo] = 'x';
  int judge = -1;
  for(int i = 0; i < 8; i++){
    //    int x = xo + xa[i], y = yo + ya[i];
    int cnt = ocount(poi,xa[i],ya[i]);
    int xxx = poi.x, yyy = poi.y;
    if( cnt > 0){
      while(cnt--){
	xxx+=xa[i]; yyy+=ya[i];
	v[yyy][xxx] = 'x';
      }
    }
  }
}
void change2(point poi){
  int xo = poi.x, yo = poi.y;
  v[yo][xo] = 'o';
  int judge = -1;
  for(int i = 0; i < 8; i++){
    //  int x = xo + xa[i], y = yo + ya[i];
    int cnt = xcount(poi,xa[i],ya[i]);
    int xxx = poi.x, yyy = poi.y;
    // cout << cnt << endl;
    if( cnt > 0){
      while(cnt--){
	xxx+=xa[i]; yyy+=ya[i];
	v[yyy][xxx] = 'o';
      }
    }
  }
}






int main(){
  //return 0;
  vector<vector<char> > vcp(8);

  for(int i = 0; i < 8; i++){
    for(int j = 0; j < 8; j++){
      char ch;
      cin >> ch;
      v[i].push_back(ch);
      vcp[i].push_back(ch);
    }
  }
  

  int judge = 0;
  int ss = 0;


  while(1){
    int cnt1 = 0, cnt2 = 0, cnt3 = 0;
    //cout << "hoge" << endl;;
    for(int i = 0; i < 8; i++){
      for(int j = 0; j < 8; j++){
	if(v[i][j] == 'o') cnt1++;
	else if(v[i][j] == 'x') cnt2++;
	
      }
    }
    
    if(cnt1+cnt2 == 64) break;
    else if((cnt1 == 0 && cnt2 != 0) || (cnt2 == 0 && cnt1 != 0)) break;
    else if(cnt1 == 0 && cnt2 == 0) break;

    int ret = 0;
    point cp;
    point t;
    int s;

    xx = 11; yy = 11;
    for(int i = 0; i < 8; i++){
      for(int j = 0; j < 8; j++){
	if(judge%2 == 0){
	  if(v[i][j] == '.'){
	    cp.x = j; cp.y = i;
	    s = osolve(cp);
	    if(ret < s && s != 0){
	      ret = s;
	      t = cp;
	    }

	  }
	}else {
	  if(v[i][j] == '.'){
	    cp.x = j; cp.y = i;
	    s = xsolve(cp);
	    if(ret <= s && s != 0){
	      ret = s;
	      t = cp;
	    }

	  }
	}
      }
    }
    judge++;

    /*  for(int i = 0; i < 8; i++){
    for(int j = 0; j < 8; j++){
      cout << v[i][j];
    }
    cout << endl;
  }
    
  cout << t.x << " " << t.y << endl;
  cout << ret << endl;
    */
  // if(xx == 11 || yy == 11) continue;
  if(ret != 0){
    if(judge%2 == 0)
      change1(t);
    else
      change2(t);
  }
  //   break;
    // cout << "hoge";
    if(vcp == v) ss++;
    else{
      ss = 0;
      vcp = v;
    }
    //cout << xx << " " << yy << endl;
    if(ss >= 2) break;

  }


  for(int i = 0; i < 8; i++){
    for(int j = 0; j < 8; j++){
      cout << v[i][j];
    }
    cout << endl;
  }

}

Measured memory_bytes: 1196