konchin_shih

b367

Apr 30th, 2023
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.38 KB | None | 0 0
  1. T = int(input())
  2.  
  3. while T:
  4.     T -= 1
  5.  
  6.     n, m = map(int, input().split())
  7.     arr = [list(map(int, input().split())) for i in range(n)]
  8.  
  9.     isDiff = False
  10.  
  11.     for i in range(n):
  12.         for j in range(m):
  13.             if arr[i][j] != arr[-i-1][-j-1]:
  14.                 isDiff = True
  15.  
  16.     if isDiff:
  17.         print("keep defending")
  18.     else:
  19.         print("go forward")
  20.  
Add Comment
Please, Sign In to add comment