#include<iostream>
using namespace std;
int main()
{
int count,sum,a,b,n;
int arr[3][3];
a = 0;
b = 0;
cin >> n;
for (int k = 0;k < n; k++)
{
a = 0;
b = 0;
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
{
cin >> arr[i][j];
}
}
for (int i = 0; i < 3; i++)
{
count = 0;
for (int j = 0; j < 3; j++)
{
count += arr[i][j];
}
if (count == 0 || count == 3)
{
a = 1;
break;
}
}
for (int j = 0; j < 3; j++)
{
count = 0;
for (int i = 0; i < 3; i++)
{
count += arr[i][j];
}
if (count == 0 || count == 3)
{
a = 1;
break;
}
}
count = 0;
sum = 0;
count = arr[0][0] + arr[1][1] + arr[2][2];
sum = arr[0][2] + arr[1][1] + arr[2][0];
if (count == 0 || count == 3)
b = 1;
else if (sum == 0 || sum == 3)
b = 1;
if (a == 1 && b == 0)
cout << "True" << endl;
else if (b == 1 && a == 0)
cout << "True" << endl;
else
cout << "False" << endl;
}
return 0;
}
沒有留言:
張貼留言