import java.io.*;
import hsa.Console;

// The "Rhombus" class.
public class TicTacWin
{
    public static void main (String[] args) throws IOException
    {

	// Open up the input and output file for IO purpose
	FileReader inFile = new FileReader ("DATA2.txt");
	FileWriter outFile = new FileWriter ("OUT2.txt");

	// Link the input and output file for
	BufferedReader in = new BufferedReader (inFile);
	BufferedWriter out = new BufferedWriter (outFile);


	String ln1, ln2, ln3;

	// Keep reading as long as not end of file (eof)
	for (int i = 1 ; i < 6 ; i++)
	{
	    while ((ln1 = in.readLine ()) != null)
	    {
		ln2 = in.readLine ();
		ln3 = in.readLine ();

		boolean win = false;


		for (int x = 0 ; x < 3 ; x++)
		{
		    if (ln1.charAt (x) == 'X' && ln2.charAt (x) == 'X' && ln3.charAt (x) == 'X')
		    {
			out.write ("X");
			out.newLine ();
			win = true;
		    }
		    else if (ln1.charAt (x) == 'O' && ln2.charAt (x) == 'O' && ln3.charAt (x) == 'O')
		    {
			out.write ("O");
			out.newLine ();
			win = true;
		    }
		}
		if (ln1.charAt (0) == 'X' && ln1.charAt (1) == 'X' && ln1.charAt (2) == 'X')
		{
		    out.write ("X");
		    out.newLine ();
		    win = true;
		}
		else if (ln1.charAt (0) == 'O' && ln1.charAt (1) == 'O' && ln1.charAt (2) == 'O')
		{
		    out.write ("O");
		    out.newLine ();
		    win = true;
		}
		if (ln2.charAt (0) == 'X' && ln2.charAt (1) == 'X' && ln2.charAt (2) == 'X')
		{
		    out.write ("X");
		    out.newLine ();
		    win = true;
		}
		else if (ln2.charAt (0) == 'O' && ln2.charAt (1) == 'O' && ln2.charAt (2) == 'O')
		{
		    out.write ("O");
		    out.newLine ();
		    win = true;
		}
		if (ln3.charAt (0) == 'X' && ln3.charAt (1) == 'X' && ln3.charAt (2) == 'X')
		{
		    out.write ("X");
		    out.newLine ();
		    win = true;
		}
		else if (ln3.charAt (0) == 'O' && ln3.charAt (1) == 'O' && ln3.charAt (2) == 'O')
		{
		    out.write ("O");
		    out.newLine ();
		    win = true;
		}
		if (ln1.charAt (0) == 'X' && ln2.charAt (1) == 'X' && ln3.charAt (2) == 'X')
		{
		    out.write ("X");
		    out.newLine ();
		    win = true;
		}
		else if (ln1.charAt (0) == 'O' && ln2.charAt (1) == 'O' && ln3.charAt (2) == 'O')
		{
		    out.write ("O");
		    out.newLine ();
		    win = true;
		}
		else if (ln1.charAt (2) == 'X' && ln2.charAt (1) == 'X' && ln3.charAt (0) == 'X')
		{
		    out.write ("X");
		    out.newLine ();
		    win = true;
		}
		else if (win == false)
		{
		    out.write (".");
		    out.newLine ();

		}
		ln1 = "";
		ln2 = "";
		ln3 = "";
	    }
	}
	out.flush ();
	out.close ();
    }





} // main method
// End of Class



