row = [ -1, 0, 1, 0] col = [ 0, 1, 0, -1] def isSafe(x, y, processed): return (0 <= x < M) and (0 <= y < N) and not processed[x][y] def dfs(board, wo