{"problem":{"name":"I. Mr. Panda and Blocks","description":{"content":"Mr. Panda recently received a bucket of toy blocks as his birthday gift. Each block is a $1 times 1 times 2$ cuboid, which is constructed by a pair of face-to-face $1 times 1 times 1$ colored cubes. T","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":1000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF10243I"},"statements":[{"statement_type":"Markdown","content":"Mr. Panda recently received a bucket of toy blocks as his birthday gift. Each block is a $1 times 1 times 2$ cuboid, which is constructed by a pair of face-to-face $1 times 1 times 1$ colored cubes. There are $n$ types of colors, labeled as $1, 2, \\\\dots, n$.\n\nMr. Panda checked all of the blocks, and he found that he had just $frac(n times (n + 1), 2)$ blocks and each of these blocks was painted with a unique pair of colors. That is, for each pair of colors $(i, j)$ $(1 <= i <= j <= n)$, he had exactly one block with one cube colored $i$, and the other colored $j$.\n\nMr. Panda plans to build a fantastic castle with these blocks today.\n\nFirstly, he defines an attribute called _connected_: \n\nThen he comes up with the following requirements: \n\nHowever, after many attempts, Mr. Panda still cannot build such a castle. So he turns to you for help. Could you please help Mr. Panda to build a castle which meets all his requirements?\n\nThe first line of the input gives the number of test cases, $T$ ($1 <= T <= 10$). $T$ test cases follow.\n\nFor each test case, one line contains an integer $n$ ($1 <= n <= 200$), representing the number of colors.\n\nFor each test case, first output one line containing \"_Case #x:_\", where _x_ is the test case number (starting from 1).\n\nIf it's impossible to build a castle that satisfies Mr. Panda's requirements, output a single line containing \"NO\" (quotes for clarity).\n\nIf it's possible to build the castle, first output a single line containing \"YES\" (quotes for clarity).\n\nThen, output $frac(n times (n + 1), 2)$ lines describing the coordinates of all the blocks. Each of these lines should be outputted in the form of $i, j, x_i, y_i, z_i, x_j, y_j, z_j$ $(1 <= i <= j <= n, 0 <= x_i, y_i, z_i, x_j, y_j, z_j <= 10^9$), which means for the block $(i, j)$, the cube with color $i$ is located at $(x_i, y_i, z_i)$ and the other cube with color $j$ is located at $(x_j, y_j, z_j)$. You should make sure that each pair of $(i, j)$ occurs exactly once in your answer.\n\nIn case there is more than one solution, any of them will be accepted.\n\n## Input\n\nThe first line of the input gives the number of test cases, $T$ ($1 <= T <= 10$). $T$ test cases follow.For each test case, one line contains an integer $n$ ($1 <= n <= 200$), representing the number of colors.\n\n## Output\n\nFor each test case, first output one line containing \"_Case #x:_\", where _x_ is the test case number (starting from 1).If it's impossible to build a castle that satisfies Mr. Panda's requirements, output a single line containing \"NO\" (quotes for clarity).If it's possible to build the castle, first output a single line containing \"YES\" (quotes for clarity).Then, output $frac(n times (n + 1), 2)$ lines describing the coordinates of all the blocks. Each of these lines should be outputted in the form of $i, j, x_i, y_i, z_i, x_j, y_j, z_j$ $(1 <= i <= j <= n, 0 <= x_i, y_i, z_i, x_j, y_j, z_j <= 10^9$), which means for the block $(i, j)$, the cube with color $i$ is located at $(x_i, y_i, z_i)$ and the other cube with color $j$ is located at $(x_j, y_j, z_j)$. You should make sure that each pair of $(i, j)$ occurs exactly once in your answer.In case there is more than one solution, any of them will be accepted.\n\n[samples]","is_translate":false,"language":"English"},{"statement_type":"Markdown","content":"**Definitions**  \nLet $ n \\in \\mathbb{Z} $ be the number of colors.  \nLet $ \\mathcal{B} = \\{ (i, j) \\mid 1 \\leq i < j \\leq n \\} $ be the set of block types, where each block $(i,j)$ connects two cubes of colors $i$ and $j$.  \nThere are $ |\\mathcal{B}| = \\frac{n(n+1)}{2} $ blocks.\n\n**Constraints**  \n1. $ 1 \\leq n \\leq 200 $  \n2. Each block $(i,j) \\in \\mathcal{B}$ must be represented by two unit cubes at integer coordinates in $ \\mathbb{Z}^3 $, with one cube colored $i$, the other $j$, and the two cubes are face-adjacent (i.e., Manhattan distance 1).  \n3. The entire structure must be connected (i.e., the graph where vertices are cubes and edges are face-adjacencies is connected).\n\n**Objective**  \nFor each test case, either:  \n- Output \"NO\" if no such connected arrangement exists, or  \n- Output \"YES\" followed by $ \\frac{n(n+1)}{2} $ lines, each specifying the 3D coordinates of the two cubes of block $(i,j)$, such that:  \n  - All blocks are used exactly once,  \n  - Each block’s two cubes are face-adjacent,  \n  - The entire assembly is connected.","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF10243I","tags":[],"sample_group":[],"created_at":"2026-03-03 11:00:39"}}