#54049: Python


310119@yphs.tw (邱晨睿)


T = int(input())
for k in range(T):
  M,N = map(int,input().split())
  s = []
  for i in range(M):
    a = input().split()
    for j in range(len(a)):
      s.append(a[j])
    c = s[::-1]
  if c == s:
    print("go forward")
  else:
    print("keep defending")