#include <iostream>
using namespace std;
int main()
{
int T, N, M;
cin >> T;
while (T--)
{
cin >> N >> M;
int* a = new int[N * M]();
for (int i = 0; i < N * M; i++)
cin >> a[i];
for(int i=0;i<N*M;i++)
if (a[i] != a[N * M - 1 - i])
{
cout << "keep defending" << endl;
goto zz;
}
cout << "go forward" << endl;
zz: { }
delete[]a;
}
}