#include <iostream>

#include <string>



using namespace std;



int main(){

	string str;

	cin >> str;

	while(cin >> str){
		if(str[0]==str[1]==str[2] || str[0]==str[3]==str[6] || str[0]==str[4]==str[8]){
			if(str[0]==o){
				cout << "o" << endl;
			} else if(str[0]==x){
				cout << "x" << endl;
			} else if(str[8]==str[5]==str[2] || str[8]==str[7]==str[6]){
				if(str[8]==o){
					cout << "o" << endl;
				} else if(str[8]==x){
					cout << "x" << endl;
				} else if(str[1]==str[4]==str[7] || str[3]==str[4]==str[5] || str[2]==str[4]==str[6]){
					if(str[4]==o){
						cout << "o" << endl;
					} else if(str[4]==x){
						cout << "x" << endl;
					} else if{
						cout << "d" << endl;
					}
				}
			}
		}
	}
	return 0;
}
				
