#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
using namespace std;

#define f first
#define s second

typedef pair<int, int> Point;
typedef pair<int, Point> Point2;

char field[10][10];
char now;

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

void Change(Point2 p){
  int x = p.s.f, y = p.s.s;
  bool hassame = false;
  int cnt = 0;
  
  if(field[y-1][x] != '.' && field[y-1][x] != now){
    for(int i = y-1 ; i >= 0 ; i--){
      if(field[i][x] == '.') break;
      if(field[i][x] == now){
	hassame = true;
	break;
      }
      if(field[i][x] != '.' && field[i][x] != now) cnt++;
    }
  }
  if(hassame){
    for(int i = y-1 ; i >= 0 && cnt >= 0; i--, cnt--){
      field[i][x] = now;
    }
  }
  hassame = false;
  cnt = 0;  
  
  if(field[y+1][x] != '.' && field[y+1][x] != now){
    for(int i = y+1 ; i < 8 ; i++){
      if(field[i][x] == '.') break;
      if(field[i][x] == now){
	hassame = true;
	break;
      }
      if(field[i][x] != '.' && field[i][x] != now) cnt++;
    }
  }
  if(hassame){
    for(int i = y+1 ; i < 8 && cnt >= 0 ; i++, cnt--){
      field[i][x] = now;
    }
  }
  hassame = false;
  cnt = 0;   
  
  if(field[y][x-1] != '.' && field[y][x-1] != now){
    for(int j = x-1 ; j >= 0 ; j--){
      if(field[y][j] == '.') break;
      if(field[y][j] == now){
	hassame = true;
	break;
      }
      if(field[y][j] != '.' && field[y][j] != now) cnt++;    
    }
  }
  if(hassame){
    for(int j = x-1 ; j >= 0 && cnt >= 0; j--, cnt--){
      field[y][j] = now;
    }
  }
      
  hassame = false;
  cnt = 0;
  
  if(field[y][x+1] != '.' && field[y][x+1] != now){
    for(int j = x+1 ; j < 8 ; j++){
      if(field[y][j] == '.') break;
      if(field[y][j] == now){
	hassame = true;
	break;
      }   
      if(field[y][j] != '.' && field[y][j] != now) cnt++;    
    }
  }
  if(hassame){
    for(int j = x+1 ; j < 8 && cnt >= 0; j++, cnt--){
      field[y][j] = now;
    }
  }
  hassame = false;
  cnt = 0;
  
  if(field[y-1][x+1] != '.' && field[y-1][x+1] != now){
    for(int i = y-1, j = x+1 ; i >= 0 && j < 8 ; i--, j++){
      if(field[i][j] == '.') break;
      if(field[i][j] == now){
	hassame = true;
	break;
      }
      if(field[i][j] != '.' && field[i][j] != now) cnt++;
    }
  }
  if(hassame){
    for(int i = y-1, j = x+1 ; i >= 0 && j < 8 && cnt >= 0 ; i--, j++, cnt--){
      field[i][j] = now;
    }
  }
  hassame = false;
  cnt = 0;
  
  if(field[y+1][x+1] != '.' && field[y+1][x+1] != now){
    for(int i = y+1, j = x+1 ; i < 8 && j < 8 ; i++, j++){
      if(field[i][j] == '.') break;
      if(field[i][j] == now){
	hassame = true;
	break;
      }
      if(field[i][j] != '.' && field[i][j] != now) cnt++;
    }
  }
  if(hassame){
    for(int i = y+1, j = x+1 ; i < 8 && j < 8 && cnt >= 0 ; i++, j++, cnt--){
	field[i][j] = now;
      }
	  }
    hassame = false;
  cnt = 0;
  
  if(field[y+1][x-1] != '.' && field[y+1][x-1] != now){
    for(int i = y+1, j = x-1 ; i < 8 && j >= 0 ; i++, j--){
      if(field[i][j] == '.') break;
      if(field[i][j] == now){
	hassame = true;
	break;
      }
      if(field[i][j] != '.' && field[i][j] != now) cnt++;
    }
  }
  if(hassame){
    for(int i = y+1, j = x-1 ; i < 8 && j >= 0 && cnt >= 0; i++, j--, cnt--){
      field[i][j] = now;
    }
  }
  hassame = false;
  cnt = 0;
  
  if(field[y-1][x-1] != '.' && field[y-1][x-1] != now){
    for(int i = y-1, j = x-1 ; i >= 0 && j >= 0 ; i--, j--){
      if(field[i][j] == '.') break;
      if(field[i][j] == now){
	hassame = true;
	break;
      }
      if(field[i][j] != '.' && field[i][j] != now) cnt++;
    }
  }
  if(hassame){
    for(int i = y-1, j = x-1 ; i >= 0 && j >= 0 && cnt >= 0; i--, j--, cnt--){
      field[i][j] = now;
    }
  }
  hassame = false;
  cnt = 0;
}





int countDiffCookie(Point p){
  int x = p.f, y = p.s;
  int ret = 0, cnt = 0;
  bool hassame = false;
  
  if(field[y-1][x] != '.' && field[y-1][x] != now){
    for(int i = y-1 ; i >= 0 ; i--){
      if(field[i][x] == '.') break;
      if(field[i][x] == now){
	hassame = true;
	break;
      }
      if(field[i][x] != '.' && field[i][x] != now) cnt++;
    }
  }
  if(hassame) ret += cnt;
  hassame = false;
  cnt = 0;  
  
  if(field[y+1][x] != '.' && field[y+1][x] != now){
    for(int i = y+1 ; i < 8 ; i++){
      if(field[i][x] == '.') break;
      if(field[i][x] == now){
	hassame = true;
	break;
      }
      if(field[i][x] != '.' && field[i][x] != now) cnt++;
    }
  }
  if(hassame) ret += cnt;
  hassame = false;
  cnt = 0;   
  
  if(field[y][x-1] != '.' && field[y][x-1] != now){
    for(int j = x-1 ; j >= 0 ; j--){
      if(field[y][j] == '.') break;
      if(field[y][j] == now){
	hassame = true;
	break;
      }
      if(field[y][j] != '.' && field[y][j] != now) cnt++;    
    }
  }
  if(hassame) ret += cnt;
  hassame = false;
  cnt = 0;
  
  if(field[y][x+1] != '.' && field[y][x+1] != now){
    for(int j = x+1 ; j < 8 ; j++){
      if(field[y][j] == '.') break;
      if(field[y][j] == now){
	hassame = true;
	break;
      }   
      if(field[y][j] != '.' && field[y][j] != now) cnt++;    
    }
  }
  if(hassame) ret += cnt;
  hassame = false;
  cnt = 0;
  
  if(field[y-1][x+1] != '.' && field[y-1][x+1] != now){
    for(int i = y-1, j = x+1 ; i >= 0 && j < 8 ; i--, j++){
      if(field[i][j] == '.') break;
      if(field[i][j] == now){
	hassame = true;
	break;
      }
      if(field[i][j] != '.' && field[i][j] != now) cnt++;
    }
  }
  if(hassame) ret += cnt;
  hassame = false;
  cnt = 0;
  
  if(field[y+1][x+1] != '.' && field[y+1][x+1] != now){
    for(int i = y+1, j = x+1 ; i < 8 && j < 8 ; i++, j++){
      if(field[i][j] == '.') break;
      if(field[i][j] == now){
	hassame = true;
	break;
      }
      if(field[i][j] != '.' && field[i][j] != now) cnt++;
    }
  }
  if(hassame) ret += cnt;
  hassame = false;
  cnt = 0;
  
  if(field[y+1][x-1] != '.' && field[y+1][x-1] != now){
    for(int i = y+1, j = x-1 ; i < 8 && j >= 0 ; i++, j--){
      if(field[i][j] == '.') break;
      if(field[i][j] == now){
	hassame = true;
	break;
      }
      if(field[i][j] != '.' && field[i][j] != now) cnt++;
    }
  }
  if(hassame) ret += cnt;
  hassame = false;
  cnt = 0;
  
  if(field[y-1][x-1] != '.' && field[y-1][x-1] != now){
    for(int i = y-1, j = x-1 ; i >= 0 && j >= 0 ; i--, j--){
      if(field[i][j] == '.') break;
      if(field[i][j] == now){
	hassame = true;
	break;
      }
      if(field[i][j] != '.' && field[i][j] != now) cnt++;
    }
  }
  if(hassame) ret += cnt;
  hassame = false;
  cnt = 0;  
  return ret;
}  

int main(){
  for(int i = 0 ; i < 8 ; i++){
    cin >> field[i];
  }
  
  int M = 64;
  for(int i = 0 ; i < 8 ; i++)
    for(int j = 0 ; j < 8 ; j++) if(field[i][j] != '.') M--;
  
  bool Mami = false, Witch = false;
  
  for(int n = 0 ; M >= 0; n++){
    //output();
    bool pass = true;
    now = n%2 ? 'x' : 'o';
    Point2 decide = Point2(0,Point(-1,-1));
    for(int i = 0 ; i < 8 ; i++){
      for(int j = 0 ; j < 8 ; j++){
	if(field[i][j] == '.'){
	  int c = countDiffCookie(Point(j, i));
	  if(now == 'o'){
	    if(c != 0 && c > decide.f){
	      decide.f = c;
	      decide.s.f = j, decide.s.s = i;
	      pass = false;
	      Mami = false;
	    }
	  }
	  else{
	    if(c != 0 && c >= decide.f){
	      decide.f = c;
	      decide.s.f = j, decide.s.s = i;
	      pass = false;
	      Witch = false;
	    }
	  }
	}
      }
    }
    if(pass){
      if(n%2) Witch = true;
      else Mami = true;
    }
    else{
      M--;
      Change(decide);
    }
    if(Mami && Witch) goto END;
    field[decide.s.s][decide.s.f] = now;
  }
  
 END:;
  for(int i = 0 ; i < 8 ; i++){
    for(int j = 0 ; j < 8 ; j++){
      cout << field[i][j];
    }
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 1140