#include <iostream>
#define Arr(arr, idx) *(arr + idx)
bool fn_Check(int* intarr_Num, int int_Size);
int main()
{
std::ios_base::sync_with_stdio(false);
std::cin.tie(0);
int int_Count;
std::cin>> int_Count;
while(int_Count--)
{
int int_YSize, int_XSize;
std::cin>> int_YSize >> int_XSize;
int intarr_Num[int_YSize][int_XSize];
for(int i = 0; i < int_YSize; i++)
{
for(int j = 0; j < int_XSize; j++)
{
std::cin>> intarr_Num[i][j];
}
}
if(fn_Check(reinterpret_cast<int*>(intarr_Num), sizeof(intarr_Num) / sizeof(int))) std::cout<< "go forward\n";
else std::cout<< "keep defending\n";
}
return 0;
}
bool fn_Check(int* intarr_Num, int int_Size)
{
for(int int_LIdx = 0, int_RIdx = int_Size - 1; int_LIdx < int_RIdx; int_LIdx++, int_RIdx--)
{
if(Arr(intarr_Num, int_LIdx) != Arr(intarr_Num, int_RIdx)) return false;
}
return true;
}
#include
#define Arr(arr, idx) *(arr + idx)
bool fn_Check(int* intarr_Num, int int_Size);
int main()
{
std::ios_base::sync_with_stdio(false);
std::cin.tie(0);
int int_Count;
std::cin>> int_Count;
while(int_Count--)
{
int int_YSize, int_XSize;
std::cin>> int_YSize >> int_XSize;
int intarr_Num[int_YSize][int_XSize];
for(int i = 0; i < int_YSize; i++)
{
for(int j = 0; j < int_XSize; j++)
{
std::cin>> intarr_Num[i][j];
}
}
if(fn_Check(reinterpret_cast<int*>(intarr_Num), sizeof(intarr_Num) / sizeof(int))) std::cout<< "go forward\n";
else std::cout<< "keep defending\n";
}
return 0;
}
bool fn_Check(int* intarr_Num, int int_Size)
{
for(int int_LIdx = 0, int_RIdx = int_Size - 1; int_LIdx < int_RIdx; int_LIdx++, int_RIdx--)
{
if(Arr(intarr_Num, int_LIdx) != Arr(intarr_Num, int_RIdx)) return false;
}
return true;
}
牛B