dx = [0, 0, -1, 1] dy = [-1, 1, 0, 0] def dfs(i, j): if i == m - 1 and j == n - 1: for (pi, pj) in pos: print('({0},{1})'.format(pi, pj)) return for k in range(4): x = i + dx[k] y = j + dy[k] if 0 <= x < m and 0 <= y < n a...