#include <iostream>
#include <fstream>
#include <string>

using namespace std;

int main()
{
	ifstream cin("DATA2.txt");
	ofstream cout("OUT2.txt");
	int t=5;
	string row1,row2,row3;
	while (t--)
	{
		cin>>row1;
		cin>>row2;
		cin>>row3;

		if (((row1[0]=='X') && (row2[1]=='X') && (row3[2]=='X')) || ((row1[0]=='X') && (row1[1]=='X') && (row1[2]=='X')) || ((row2[0]=='X') && (row2[1]=='X') && (row2[2]=='X')) || ((row3[0]=='X') && (row3[1]=='X') && (row3[2]=='X')) || ((row1[0]=='X') && (row2[0]=='X') && (row3[0]=='X'))   || ((row1[1]=='X') && (row2[1]=='X') && (row3[1]=='X')) || ((row1[2]=='X') && (row2[2]=='X') && (row3[2]=='X'))  )
			cout<<"X"<<endl;
		else
			if (((row1[0]=='O') && (row2[1]=='O') && (row3[2]=='O')) || ((row1[0]=='O') && (row1[1]=='O') && (row1[2]=='O')) || ((row2[0]=='O') && (row2[1]=='O') && (row2[2]=='O')) || ((row3[0]=='O') && (row3[1]=='O') && (row3[2]=='O')) || ((row1[0]=='O') && (row2[0]=='O') && (row3[0]=='O'))   || ((row1[1]=='O') && (row2[1]=='O') && (row3[1]=='O')) || ((row1[2]=='O') && (row2[2]=='O') && (row3[2]=='O'))  )
				cout<<"O"<<endl;
			else
				cout<<"."<<endl;

	}
	return 0;
}
