#include<iostream>
#include<functional>
using namespace std;

typedef unsigned long long BitBoard;

int bitCount(BitBoard bits){
	bits = (bits & 0x5555555555555555) + (bits >> 1 & 0x5555555555555555);
	bits = (bits & 0x3333333333333333) + (bits >> 2 & 0x3333333333333333);
	bits = (bits & 0x0f0f0f0f0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f0f0f0f0f);
	bits = (bits & 0x00ff00ff00ff00ff) + (bits >> 8 & 0x00ff00ff00ff00ff);
	bits = (bits & 0x0000ffff0000ffff) + (bits >>16 & 0x0000ffff0000ffff);
	return ((int)bits & 0xffffffff) + (int)(bits >>32);
}
int put(BitBoard *oneself,BitBoard *opponent,BitBoard pos){
	BitBoard a;
	BitBoard rev=0;
	BitBoard w = *opponent & 0x7e7e7e7e7e7e7e7e; 
	BitBoard t = w & (pos << 1);
	do{
		a=t;
		t |= w & (t << 1);
	}while(a!=t);
	if(*oneself & t<<1)rev|=t;
	t = w & (pos >> 1);         
	do{
		a=t;
		t |= w & (t >> 1);
	}while(a!=t);
	if(*oneself & t>>1)rev|=t;
	w = *opponent & 0x00ffffffffffff00;
	t = w & (pos << 8);         
	do{
		a=t;
		t |= w & (t << 8);
	}while(a!=t);
	if(*oneself & t<<8)rev|=t;
	t = w & (pos >> 8);         
	do{
		a=t;
		t |= w & (t >> 8);
	}while(a!=t);
	if(*oneself & t>>8)rev|=t;
	w= *opponent & 0x007e7e7e7e7e7e00;
	t = w & (pos << 7);         
	do{
		a=t;
		t |= w & (t << 7);
	}while(a!=t);
	if(*oneself & t<<7)rev|=t;
	t = w & (pos >> 7);         
	do{
		a=t;
		t |= w & (t >> 7);
	}while(a!=t);
	if(*oneself & t>>7)rev|=t;
	t = w & (pos << 9);         
	do{
		a=t;
		t |= w & (t << 9);
	}while(a!=t);
	if(*oneself & t<<9)rev|=t;
	t = w & (pos >> 9);         
	do{
		a=t;
		t |= w & (t >> 9);
	}while(a!=t);
	if(*oneself & t>>9)rev|=t;
	*oneself ^= rev | pos;
	*opponent ^= rev;
	return bitCount(rev);
}
BitBoard putPosition(BitBoard oneself,BitBoard opponent){
	BitBoard mobility;
	BitBoard blank= ~(oneself|opponent);
	BitBoard w = opponent & 0x7e7e7e7e7e7e7e7e; 
	BitBoard t = w & (oneself << 1 | oneself>>1);         
	t |= w & (t << 1 | t >> 1);
	t |= w & (t << 1 | t >> 1);
	t |= w & (t << 1 | t >> 1);
	t |= w & (t << 1 | t >> 1);
	t |= w & (t << 1 | t >> 1);
	mobility = blank & (t << 1 | t>>1);

	w= opponent & 0x00ffffffffffff00;
	t = w & (oneself << 8 | oneself>>8); 
 	t |= w & (t << 8 | t >> 8); 
	t |= w & (t << 8 | t >> 8); 
	t |= w & (t << 8 | t >> 8);
	t |= w & (t << 8 | t >> 8);
	t |= w & (t << 8 | t >> 8);
	mobility |= blank & (t << 8 | t>>8);

	w= opponent & 0x007e7e7e7e7e7e00;
	t = w & (oneself << 7 | oneself>>7); 
	t |= w & (t << 7 | t >> 7); 
	t |= w & (t << 7 | t >> 7); 
	t |= w & (t << 7 | t >> 7);
	t |= w & (t << 7 | t >> 7);
	t |= w & (t << 7 | t >> 7);
	mobility |= blank & (t << 7 | t>>7);

	t = w & (oneself << 9 | oneself>>9); 
	t |= w & (t << 9 | t >> 9); 
	t |= w & (t << 9 | t >> 9); 
	t |= w & (t << 9 | t >> 9);
	t |= w & (t << 9 | t >> 9);
	t |= w & (t << 9 | t >> 9);
	mobility |= blank & (t << 9 | t >> 9);
	return mobility;
}

template<class C>
bool put(BitBoard *oneself,BitBoard *opponent,C cmp){
	BitBoard maxpos,pos=putPosition(*oneself,*opponent);
	if(!pos)return false;
	int maxn=0;
	while(pos){
		BitBoard p=pos&-pos;
		pos &= ~p;
		BitBoard one=*oneself,opp=*opponent;
		int n=put(&one,&opp,p);
		if(cmp(maxn,n)){
			maxn=n;
			maxpos=p;
		}
	}
	put(oneself,opponent,maxpos);
	return true;
}
int main(){
	BitBoard maru=0,batu=0;
	for(int i=0;i<64;i++){
		char c;
		cin>>c;
		if(c=='o')maru |= 1ull<<i;
		else if(c=='x')batu |= 1ull<<i;
	}
	bool passed=false;
	int turn=0;
	while(1){
		bool f;
		turn^=1;
		if(turn)f=put(&maru,&batu,less<int>());
		else f=put(&batu,&maru,less_equal<int>());
		if(passed && !f)break;
		passed = !f;
	}
	for(int i=0;i<64;i++){
		if(maru>>i&1)cout<<'o';
		else if(batu>>i&1)cout<<'x';
		else cout<<'.';
		if((i+1)%8==0)cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 1140