Inspired by the 15-puzzle, Cuber QQ invents a new puzzle game, named confusing puzzle, as it always makes players confused. The puzzle is a parallelogram, which contains n×mntimes mn×m vertices. We'll consider the parallelogram rows numbered from bottom to top 111 through nnn, and the columns numbered from left to right 111 through mmm. Then we'll denote the position of vertices in row xxx and column yyy as (x,y)(x,y)(x,y) and its initial id is . The following figure shows the initial parallelogram: Each time, the player can operate the parallelogram in the following two ways: opt=1opt=1opt=1, select an textbf{upright} equilateral triangle and rotate it clockwise. opt=2opt=2opt=2, select a diamond and rotate it clockwise. Cuber QQ will give you a scrambled puzzle, and ask you to restore it within 31063cdot 10^63106 operations.
Inspired by the 15-puzzle, Cuber QQ invents a new puzzle game, named confusing puzzle, as it always makes players confused. The puzzle is a parallelogram, which contains n×mntimes mn×m vertices. We'll consider the parallelogram rows numbered from bottom to top 111 through nnn, and the columns numbered from left to right 111 through mmm. Then we'll denote the position of vertices in row xxx and column yyy as (x,y)(x,y)(x,y) and its initial id is ((x−1)m+y)((x-1)m+ y)((x−1)m+y). The following figure shows the initial parallelogram: Each time, the player can operate the parallelogram in the following two ways: opt=1opt=1opt=1, select an textbf{upright} equilateral triangle (positions of vertices on it is (x,y),(x+1,y)(x,y),(x+1,y)(x,y),(x+1,y) and (x,y+1)(x,y+1)(x,y+1)) and rotate it clockwise. opt=2opt=2opt=2, select a diamond (positions of vertices on it is (x,y),(x+1,y),(x,y+1)(x,y),(x+1,y),(x,y+1)(x,y),(x+1,y),(x,y+1) and (x+1,y+1)(x+1,y+1)(x+1,y+1)) and rotate it clockwise. Cuber QQ will give you a scrambled puzzle, and ask you to restore it within 3⋅1063cdot 10^63⋅106 operations.