Grammy is a puzzle master. Today, she is playing a variant of "Square Jam" puzzle. Given an
n×mn \times mn×m rectangle. The goal is to divide the rectangle into several squares (with integral lengths) such that no point is touched by 4 squares.
The left picture illustrates a solution to a
4×64\times 64×6 puzzle, and the right picture shows an example of what is not allowed in the solution.
Grammy surely knows how to solve the puzzle, but she decided to give you a quiz. Please solve the puzzle.