n = int(input().strip()) pairs = [] start, end = (0,0), (n-1, n-1) def validPos(pos): return pos[0]>=0 and pos[1]>=0 and pos[0] 0 and end not in new_moves : count+=1 for move in new_moves.copy() : if move not in old_moves : old_moves.append(move) new_moves.remove(move) for m in moves(move, pair) : if m not in old_moves : new_moves.add(m) if len(new_moves)==0 : return -1 else : return count for i in range(1,n) : print(*[minPath((i,j)) for j in range(1,n)], sep=' ')