An grid contains each integer from to exactly once. You do not know which cell contains which value. Let denote the value in row , column .
The allowed operations are listed below. Swap the two specified values if the condition holds; otherwise do nothing.
1 R C: : swap and .The grid is sorted if for every .
Print a fixed sequence of at most operations that sorts the grid regardless of its initial arrangement. The input contains only , not the grid or any comparison results. You cannot adapt the operation sequence to intermediate results.
The checker applies the same sequence to the test grids specified below.
Judging procedure For each , the checker uses predetermined grids. Each grid contains every integer from to exactly once.
The same submitted operation sequence is applied independently from the start to each grid. The test is accepted if all grids become sorted in row-major increasing order. The test grids are not provided as input, and the same grids are used when rejudging. Invalid output format or violations of the operation-count or coordinate bounds are rejected.
For example, the checker uses grids for , for , and for .
The first line contains the integer . The test grids are not provided as input.
Print the number of operations on the first line. On each of the next lines, print three integers in execution order.
Here is the operation type. Types and require and . Types and require and . Require .
2 R C: : swap and .3 R C: : swap and .4 R C: : swap and .Operations may be repeated. If multiple valid sequences exist, print any of them.