{"trustable":true,"prependHtml":"\u003cstyle type\u003d\u0027text/css\u0027\u003e\n .input, .output {\n border: 1px solid #888888;\n }\n .output {\n margin-bottom: 1em;\n position: relative;\n top: -1px;\n }\n .output pre, .input pre {\n background-color: #EFEFEF;\n line-height: 1.25em;\n margin: 0;\n padding: 0.25em;\n }\n \u003c/style\u003e\n \u003clink rel\u003d\"stylesheet\" href\u003d\"//codeforces.org/s/96598/css/problem-statement.css\" type\u003d\"text/css\" /\u003e\n\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027$$$$$$\u0027, right: \u0027$$$$$$\u0027, display: true},\n {left: \u0027$$$\u0027, right: \u0027$$$\u0027, display: false},\n {left: \u0027$$\u0027, right: \u0027$$\u0027, display: true},\n {left: \u0027$\u0027, right: \u0027$\u0027, display: false}\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eYou are given an integer $$$n$$$.\u003c/p\u003e\u003cp\u003eLet\u0027s define $$$s(n)$$$ as the string \"\u003cspan class\u003d\"tex-font-style-tt\"\u003eBAN\u003c/span\u003e\" concatenated $$$n$$$ times. For example, $$$s(1)$$$ \u003d \"\u003cspan class\u003d\"tex-font-style-tt\"\u003eBAN\u003c/span\u003e\", $$$s(3)$$$ \u003d \"\u003cspan class\u003d\"tex-font-style-tt\"\u003eBANBANBAN\u003c/span\u003e\". Note that the length of the string $$$s(n)$$$ is equal to $$$3n$$$.\u003c/p\u003e\u003cp\u003eConsider $$$s(n)$$$. You can perform the following operation on $$$s(n)$$$ any number of times (possibly zero):\u003c/p\u003e\u003cul\u003e\u003cli\u003e Select any two distinct indices $$$i$$$ and $$$j$$$ $$$(1 \\leq i, j \\leq 3n, i \\ne j)$$$.\u003c/li\u003e\u003cli\u003e Then, swap $$$s(n)_i$$$ and $$$s(n)_j$$$. \u003c/li\u003e\u003c/ul\u003e\u003cp\u003eYou want the string \"\u003cspan class\u003d\"tex-font-style-tt\"\u003eBAN\u003c/span\u003e\" to \u003cspan class\u003d\"tex-font-style-bf\"\u003enot appear\u003c/span\u003e in $$$s(n)$$$ as a \u003cspan class\u003d\"tex-font-style-bf\"\u003esubsequence\u003c/span\u003e. What\u0027s the smallest number of operations you have to do to achieve this? Also, find one such shortest sequence of operations.\u003c/p\u003e\u003cp\u003eA string $$$a$$$ is a subsequence of a string $$$b$$$ if $$$a$$$ can be obtained from $$$b$$$ by deletion of several (possibly, zero or all) characters.\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe input consists of multiple test cases. The first line contains a single integer $$$t$$$ $$$(1 \\leq t \\leq 100)$$$ \u0026nbsp;— the number of test cases. The description of the test cases follows.\u003c/p\u003e\u003cp\u003eThe only line of each test case contains a single integer $$$n$$$ $$$(1 \\leq n \\leq 100)$$$.\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003eFor each test case, in the first line output $$$m$$$ ($$$0 \\le m \\le 10^5$$$)\u0026nbsp;— the minimum number of operations required. It\u0027s guaranteed that the objective is always achievable in at most $$$10^5$$$ operations under the constraints of the problem. \u003c/p\u003e\u003cp\u003eThen, output $$$m$$$ lines. The $$$k$$$-th of these lines should contain two integers $$$i_k$$$, $$$j_k$$$ $$$(1\\leq i_k, j_k \\leq 3n, i_k \\ne j_k)$$$ denoting that you want to swap characters at indices $$$i_k$$$ and $$$j_k$$$ at the $$$k$$$-th operation. \u003c/p\u003e\u003cp\u003eAfter all $$$m$$$ operations, \"\u003cspan class\u003d\"tex-font-style-tt\"\u003eBAN\u003c/span\u003e\" must not appear in $$$s(n)$$$ as a subsequence. \u003c/p\u003e\u003cp\u003eIf there are multiple possible answers, output any.\u003c/p\u003e"}},{"title":"Examples","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e2\n1\n2\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1\n1 2\n1\n2 6\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Note","value":{"format":"HTML","content":"\u003cp\u003eIn the \u003cspan class\u003d\"tex-font-style-bf\"\u003efirst testcase\u003c/span\u003e, $$$s(1) \u003d $$$ \"\u003cspan class\u003d\"tex-font-style-tt\"\u003eBAN\u003c/span\u003e\", we can swap $$$s(1)_1$$$ and $$$s(1)_2$$$, converting $$$s(1)$$$ to \"\u003cspan class\u003d\"tex-font-style-tt\"\u003eABN\u003c/span\u003e\", which does not contain \"\u003cspan class\u003d\"tex-font-style-tt\"\u003eBAN\u003c/span\u003e\" as a subsequence.\u003c/p\u003e\u003cp\u003eIn the \u003cspan class\u003d\"tex-font-style-bf\"\u003esecond testcase\u003c/span\u003e, $$$s(2) \u003d $$$ \"\u003cspan class\u003d\"tex-font-style-tt\"\u003eBANBAN\u003c/span\u003e\", we can swap $$$s(2)_2$$$ and $$$s(2)_6$$$, converting $$$s(2)$$$ to \"\u003cspan class\u003d\"tex-font-style-tt\"\u003eBNNBAA\u003c/span\u003e\", which does not contain \"\u003cspan class\u003d\"tex-font-style-tt\"\u003eBAN\u003c/span\u003e\" as a subsequence.\u003c/p\u003e"}}]}