sir this is my code
include
include
using namespace std;
int main ()
{
int test;
cin >> test;
string d[test];
for ( int i = 0; i < test; i++ ) {
int noofx,noofo;
noofx = noofo = 0;
char s[3][3];
for ( int k = 0; k < 3; k++ ) {
for ( int j = 0; j < 3; j++ ) {
cin >> s[k][j];
if ( s[k][j] == 'x') {
noofx++;
}
else if( s[k][j] == 'o' ) {
noofo++;
}
}
}
cout << endl;
if ( noofx > noofo) {
if ( noofx-noofo == 1 ) {
if ( s[0][0] == 'o' && s[0][1] == 'o' && s[0][2] == 'o' ) {
d[i] = "no";
}
else if( s[1][0] == 'o' && s[1][1] == 'o' && s[1][2] == 'o' ) {
d[i] = "no";
}
else if (s[2][0] == 'o' && s[2][1] == 'o' && s[2][2] == 'o' ) {
d[i] = "no";
}
else if (s[0][0] == 'o' && s[1][0] == 'o' && s[2][0] == 'o' ) {
d[i] = "no";
}
else if (s[0][1] == 'o' && s[1][1] == 'o' && s[2][1] == 'o' ) {
d[i] = "no";
}
else if (s[0][2] == 'o' && s[1][2] == 'o' && s[2][2] == 'o' ) {
d[i] = "no";
}
else if ( s[0][0] == 'o' && s[1][1] == 'o' && s[2][2] == 'o' ) {
d[i] = "no";
}
else if ( s[2][0] == 'o' && s[1][1] == 'o' && s[0][2] == 'o' ) {
d[i] = "no";
}
else {
d[i] = "yes";
}
}
else {
d[i] = "no";
}
}
else if ( noofx == noofo ) {
if ( s[0][0] == 'x' && s[0][1] == 'x' && s[0][2] == 'x' ) {
d[i] = "no";
}
else if( s[1][0] == 'x' && s[1][1] == 'x' && s[1][2] == 'x' ) {
d[i] = "no";
}
else if (s[2][0] == 'x' && s[2][1] == 'x' && s[2][2] == 'x' ) {
d[i] = "no";
}
else if (s[0][0] == 'x' && s[1][0] == 'x' && s[2][0] == 'x' ) {
d[i] = "no";
}
else if (s[0][1] == 'x' && s[1][1] == 'x' && s[2][1] == 'x' ) {
d[i] = "no";
}
else if (s[0][2] == 'x' && s[1][2] == 'x' && s[2][2] == 'x' ) {
d[i] = "no";
}
else if ( s[0][0] == 'x' && s[1][1] == 'x' && s[2][2] == 'x' ) {
d[i] = "no";
}
else if ( s[2][0] == 'x' && s[1][1] == 'x' && s[0][2] == 'x' ) {
d[i] = "no";
}
else {
d[i] = "yes";
}
}
else {
d[i] = "no";
}
}
for (int i = 0; i < test; i++ ) {
cout << d[i] << endl;
}
return 0;
}