D. City Bloxx
time limit per test
1 second
memory limit per test
1024 megabytes
input
standard input
output
standard output

You recently dug out your old Nokia phone and turned it on! At this moment, you remember that you have never completed the game City Bloxx, so you decided to finish it today.

The game can be abstracted as follows: given a grid with $$$n$$$ rows and $$$n$$$ columns, with rows numbered from $$$1$$$ to $$$n$$$ from top to bottom, and columns numbered from $$$1$$$ to $$$n$$$ from left to right. Initially, each cell contains the value $$$-1$$$. You need to assign values to the cells. In each round, you can choose a cell and consider the set $$$S$$$ composed of the values of the cells (exclude the cell you choose) that share an edge with it (up, down, left, right). Then, you can reassign the value of this cell to an integer in the range $$$[0,\text{mex}(S)]$$$. Values in cells can be reassigned multiple times. Please construct a reassignment plan such that the number of cells with a final value of $$$3$$$ is not less than $$$\lfloor \frac{2(n-1)^2}{3}\rfloor$$$.

For a set $$$S$$$, $$$\text{mex}(S)$$$ represents the smallest natural number that does not appear in the set. For example, $$$\text{mex}(\{-1\})=0$$$, $$$\text{mex}(\{1,3\})=0$$$, $$$\text{mex}(\{0,1,2\})=3$$$.

Input

The first line contains an integer $$$T$$$ ($$$1\le T\le 5$$$), indicating the number of test cases.

For each test case, there is a single line containing an integer $$$n$$$ ($$$3\le n\le 100$$$), representing the size of the grid.

Output

For each test case, first output a line with an integer $$$k$$$ ($$$1\le k\le 10^5$$$), representing the number of operations.

Then, output $$$k$$$ lines, each containing three integers $$$x,y,w$$$ ($$$1\le x,y\le n,0\le w\le 3$$$), indicating the assignment of the cell in the $$$x$$$-th row and $$$y$$$-th column to the value $$$w$$$.

In this problem, you do not need to minimize the number of operations; you only need to provide a solution that satisfies the conditions.

Example
Input
2
3
5
Output
(Please refer to the Contest material)