// ConsoleApplication15.cpp : 此檔案包含 'main' 函式。程式會於該處開始執行及結束執行。
//
#include <iostream>
#include<vector>
using namespace std;
bool Palindrome(vector<char>list);
int main()
{
int count;
vector<char>list;
while (cin >> count) {
while (count--) {
int a, b;
char temp;
cin >> a >> b;
for (int i = 0; i < a * b; i++) {
cin >> temp;
list.push_back(temp);
}
if (Palindrome(list)) {
cout << "go forward" << endl;
}
else {
cout << "keep defending" << endl;
}
list.clear();
}
}
}
bool Palindrome(vector<char>list) {
for (int i = 0; i < list.size() / 2; ++i)
if (list[i] != list[list.size() - 1 - i])
return false;
return true;
}