You're given two arrays $$$a[1 \dots n]$$$ and $$$b[1 \dots n]$$$, both of the same length $$$n$$$.In order to perform a push operation, you have to choose three integers $$$l, r, k$$$ satisfying $$$1 \le l \le r \le n$$$ and $$$k > 0$$$. Then, you will add $$$k$$$ to elements $$$a_l, a_{l+1}, \ldots, a_r$$$.For example, if $$$a = [3, 7, 1, 4, 1, 2]$$$ and you choose $$$(l = 3, r = 5, k = 2)$$$, the array $$$a$$$ will become $$$[3, 7, \underline{3, 6, 3}, 2]$$$.You can do this operation at most once. Can you make array $$$a$$$ equal to array $$$b$$$?(We consider that $$$a = b$$$ if and only if, for every $$$1 \le i \le n$$$, $$$a_i = b_i$$$)

The first line contains a single integer $$$t$$$ ($$$1 \le t \le 20$$$) — the number of test cases in the input. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100\ 000$$$) — the number of elements in each array. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 1000$$$). The third line of each test case contains $$$n$$$ integers $$$b_1, b_2, \ldots, b_n$$$ ($$$1 \le b_i \le 1000$$$). It is guaranteed that the sum of $$$n$$$ over all test cases doesn't exceed $$$10^5$$$.

For each test case, output one line containing "YES" if it's possible to make arrays $$$a$$$ and $$$b$$$ equal by performing at most once the described operation or "NO" if it's impossible. You can print each letter in any case (upper or lower).

NoteThe first test case is described in the statement: we can perform a push operation with parameters $$$(l=3, r=5, k=2)$$$ to make $$$a$$$ equal to $$$b$$$.In the second test case, we would need at least two operations to make $$$a$$$ equal to $$$b$$$.In the third test case, arrays $$$a$$$ and $$$b$$$ are already equal.In the fourth test case, it's impossible to make $$$a$$$ equal to $$$b$$$, because the integer $$$k$$$ has to be positive.

let r='';
process.stdin.on('data',(d)=>{
    r+=d;
}).on('end',()=>{
    r=r.replace(/\n/g,' ').split(' ').map(a=>parseInt(a)).reverse().slice(1);
    nt=r.pop();
    for(let i=0;i<nt;i++){
        let l=r.pop();
        let a=[],b=[];
        for(let j=0;j<l;j++)a.push(r.pop());
        for(let j=0;j<l;j++)b.push(r.pop());
        let dx=0;let ans='YES';
        let j=0;
        for(;j<l;j++){
            if(b[j]-a[j]>0){
                dx=b[j]-a[j];
                break;
            }
            if(b[j]-a[j]<0){
                l=0;ans='NO';
                break;
            }
        }
        for(;j<l;j++){
            if(b[j]-a[j]!=dx){
                break;
            }
        }
        for(;j<l;j++){
            if(b[j]-a[j]!=0){
                ans='NO';
                break;
            }
        }
        console.log(ans);
    }

});

var tests = +readline();

for(var test = 0; test < tests; test ++ ){

	var len = +readline();
	var listOne = readline().split(' ').map(x => +x);
	var listTwo = readline().split(' ').map(x => +x);

	var pl = null, l = null, r = null, k = null;
	var eq = false, gt = false;
	var gotAns = false;
	for(var i = 0; i < listOne.length; i ++){
		var list1el = listOne[i];
		var list2el = listTwo[i];
		if(list2el > list1el && (!eq || !gt)){
			gt = true;
			eq = false;
			// possible so far
			l = list2el - list1el;
			if(null != pl && pl!=l){
				print('NO');
				gotAns = true;
				break;
			}
			pl = l;
		}else if(list2el == list1el){
			eq = true;
			continue;
		}else{
			print('NO');
			gotAns = true;
			break;
		}
	}
	if(!gotAns){
		print('YES');
	}

}

var t = Number(readline());
for(var i=0;i<t;i++){
    print( test() ? "YES" : "NO" );
}

function test(){
    var n = Number(readline());
    var a = readline().split(" ").map( l => Number(l) );
    var b = readline().split(" ").map( l => Number(l) );
    var j=0;
    for(;j<n;j++) if(a[j]!=b[j]) break;
    if(j==n) return 1;
    var k = b[j]-a[j];
    if(k<=0) return 0;
    for(j++;j<n;j++) if(a[j]+k != b[j]) break;
    for(;j<n;j++) if(a[j]!=b[j]) break;
    return (j==n);
}

var tc = parseInt(readline());
var toInt = x => parseInt(x);

for(var t=0; t<tc; t++) {

    var n = parseInt(readline());
    var a = readline().split(' ').map(toInt);
    var b = readline().split(' ').map(toInt);
    var c = b.map((_b, i) =>  (_b - a[i]));
//    print('c', c);
    var scount = 0;
    var allpositive = true;//c.filter(x=>(x<0)).length === 0;
    for(var i=0; i<c.length; i++) {
        if (c[i] !== 0) {
            scount++;
            var e = i;
            for(e=i+1; e<c.length && c[e]===c[i]; e++);
            //print('e', i, '-', e);
            allpositive = allpositive && (c[i] > 0);
            i = e-1;
        }
    }
     print((scount <= 1 && allpositive) ? "YES":"NO");
}

let r='';
process.stdin.on('data',(d)=>{
    r+=d;
}).on('end',()=>{
    r=r.split(' ').map(a=>Number(a)).reverse();
    nt=r.pop();
    for(let i=0;i<nt;i++){
        let l=r.pop();
        let a=[],b=[];
        for(let j=0;j<l;j++)a.push(r.pop());
        for(let j=0;j<l;j++)b.push(r.pop());
        let dx=0;let ans='YES';
        for(let j=0;j<l;j++){
            if(b[j]-a[j]!=0){
                if(b[j]-a[j]!=dx){
                    if(dx==0)dx=b[j]-a[j];
                    else {ans='NO';break;}
                }
            }
        }
        console.log(ans);
    }

});

let r='';
process.stdin.on('data',(d)=>{
    r+=d;
}).on('end',()=>{
    r=r.replace(/\n/g,' ').split(' ').map(a=>parseInt(a)).reverse().slice(1);
    nt=r.pop();
    for(let i=0;i<nt;i++){
        let l=r.pop();
        let a=[],b=[];
        for(let j=0;j<l;j++)a.push(r.pop());
        for(let j=0;j<l;j++)b.push(r.pop()-a[j]);
        for(let j=0;j<b.length-1;j++){
            if(b[j]==b[j+1])b.splice(j,1);
        }
        for(let j=0;j<b.length-1;j++){

        }
        //console.log(b);
        if((b.length==1||b.length==4)&&b[0]>=0)console.log("YES");
        else console.log("NO");
    }

});

let r='';
process.stdin.on('data',(d)=>{
    r+=d;
}).on('end',()=>{
    r=r.replace(/\n/g,' ').split(' ').map(a=>parseInt(a)).reverse().slice(1);
    nt=r.pop();
    for(let i=0;i<nt;i++){
        let l=r.pop();
        let a=[],b=[];
        for(let j=0;j<l;j++)a.push(r.pop());
        for(let j=0;j<l;j++)b.push(r.pop());
        let dx=0;let ans='YES';
        for(let j=0;j<l;j++){
            if(b[j]-a[j]!=0){
                if(b[j]-a[j]!=dx&&b[j]-a[j]>0){
                    if(dx==0)dx=b[j]-a[j];
                    else {ans='NO';break;}
                }else if(b[j]-a[j]<0){ans='NO';break;}
            }
        }
        console.log(ans);
    }

});

var t = Number(readline());
for(var i=0;i<t;i++){
    print( test() ? "YES" : "NO" );
}

function test(){
    var n = Number(readline());
    var a = readline().split(" ").map( l => Number(l) );
    var b = readline().split(" ").map( l => Number(l) );
    var j=0;
    for(;j<n;j++) if(a[j]!=b[j]) break;
    if(j==n) return 1;
    var d = a[j]-b[j];
    for(j++;j<n;j++) if(a[j]!=b[j]+d) break;
    for(;j<n;j++) if(a[j]!=b[j]) break;
    return (j==n);
}

var t = Number(readline());
for(var i=0;i<t;i++){
    print( test() ? "YES" : "NO" );
}

function test(){
    var n = Number(readline());
    var a = readline().split(" ").map( l => Number(l) );
    var b = readline().split(" ").map( l => Number(l) );
    var j=0;
    for(;j<n;j++) if(a[j]!=b[j]) break;
    if(j==n) return 1;
    var k = a[j]-b[j];
    if(k<=0) return 0;
    for(j++;j<n;j++) if(a[j]!=b[j]+k) break;
    for(;j<n;j++) if(a[j]!=b[j]) break;
    return (j==n);
}

var tc = parseInt(readline());
var toInt = x => parseInt(x);

for(var t=0; t<tc; t++) {

    var n = parseInt(readline());
    var a = readline().split(' ').map(toInt);
    var b = readline().split(' ').map(toInt);
    var c = b.map((_b, i) =>  (_b - a[i]));
//    print('c', c);
    var scount = 0;
    var allpositive = c.filter(x=>(x<0)).length === 0;
    for(var i=0; i<c.length; i++) {
        if (c[i] != 0) {
            scount++;
            var e = i;
            for(e=i+1; e<c.length && c[e]===c[i] && c[i]!=0; e++);
            //print('e', i, '-', e);
            i = e;
        }
    }
     print((scount <= 1 && allpositive) ? "YES":"NO");
}

var tc = parseInt(readline());
var toInt = x => parseInt(x);

for(var t=0; t<tc; t++) {

    var n = parseInt(readline());
    var a = readline().split(' ').map(toInt);
    var b = readline().split(' ').map(toInt);
    var c = b.map((_b, i) =>  (_b - a[i]));
//    print('c', c);
    var scount = 0;
    var allpositive = true;//c.filter(x=>(x<0)).length === 0;
    for(var i=0; i<c.length; i++) {
        if (c[i] != 0) {
            scount++;
            var e = i;
            for(e=i+1; e<c.length && c[e]===c[i] && c[i]!=0; e++);
            //print('e', i, '-', e);
            allpositive = allpositive && (c[i] > 0);
            i = e;
        }
    }
     print((scount <= 1 && allpositive) ? "YES":"NO");
}

var tc = parseInt(readline());
var toInt = x => parseInt(x);

for(var t=0; t<tc; t++) {

    var n = parseInt(readline());
    var a = readline().split(' ').map(toInt);
    var b = readline().split(' ').map(toInt);
    var c = b.map((_b, i) =>  (_b - a[i]));
//    print('c', c);
    var scount = 0;
    var allpositive = true;//c.filter(x=>(x<0)).length === 0;
    for(var i=0; i<c.length; i++) {
        if (c[i] !== 0) {
            scount++;
            var e = i;
            for(e=i+1; e<c.length && c[e]===c[i]; e++);
            //print('e', i, '-', e);
            allpositive = allpositive && (c[i] > 0);
            i = e;
        }
    }
     print((scount <= 1 && allpositive) ? "YES":"NO");
}


Let's define the value of the permutation $$$p$$$ of $$$n$$$ integers $$$1$$$, $$$2$$$, ..., $$$n$$$ (a permutation is an array where each element from $$$1$$$ to $$$n$$$ occurs exactly once) as follows:  initially, an integer variable $$$x$$$ is equal to $$$0$$$;  if $$$x < p_1$$$, then add $$$p_1$$$ to $$$x$$$ (set $$$x = x + p_1$$$), otherwise assign $$$0$$$ to $$$x$$$;  if $$$x < p_2$$$, then add $$$p_2$$$ to $$$x$$$ (set $$$x = x + p_2$$$), otherwise assign $$$0$$$ to $$$x$$$;  ...  if $$$x < p_n$$$, then add $$$p_n$$$ to $$$x$$$ (set $$$x = x + p_n$$$), otherwise assign $$$0$$$ to $$$x$$$;  the value of the permutation is $$$x$$$ at the end of this process. For example, for $$$p = [4, 5, 1, 2, 3, 6]$$$, the value of $$$x$$$ changes as follows: $$$0, 4, 9, 0, 2, 5, 11$$$, so the value of the permutation is $$$11$$$.You are given an integer $$$n$$$. Find a permutation $$$p$$$ of size $$$n$$$ with the maximum possible value among all permutations of size $$$n$$$. If there are several such permutations, you can print any of them.

The first line contains one integer $$$t$$$ ($$$1 \le t \le 97$$$) — the number of test cases. The only line of each test case contains one integer $$$n$$$ ($$$4 \le n \le 100$$$).

For each test case, print $$$n$$$ integers — the permutation $$$p$$$ of size $$$n$$$ with the maximum possible value among all permutations of size $$$n$$$.

process.stdin.resume();
process.stdin.setEncoding('utf-8');

var input = '';
process.stdin.on('data', function(chunk) {
    input += chunk;
});

process.stdin.on('end', function() {
    const data = input.trim().split('\n').map(Number);
    for (let testNumber = 1; testNumber < data.length; testNumber++) {
        const test = data[testNumber];

        if (test === 4) {
            console.log('2 1 3 4');
            continue;
        }

        const result = new Array(test).fill(0);

        let i = result.length - 1;
        const added = new Set();
        const addNumber = (num) => {
            if (i < 0) {
                return;
            }

            result[i] = num;
            added.add(num);
            i--;
        };

        // Phase 1
        addNumber(test);

        // Phase 2
        if (test % 2 === 0) {
            // Even case
            const x = Math.floor((test - 2) / 2);
            const y = x + 1;
            addNumber(y);
            addNumber(x);
            addNumber(1);
            addNumber(test - 1);
            addNumber(test - 2);
        } else {
            // Odd case
            addNumber(test - 1);
            addNumber(1);
            addNumber(test - 2);
        }

        // DESC order
        let k = 1;
        for (let j = 1; j <= test; j++) {
            while (added.has(k)) {
                k++;
            }

            addNumber(k);
        }

        console.log(result.join(' '));
    }
});

"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/problem/1728/B/solution.ts
var solution_exports = {};
__export(solution_exports, {
  main: () => main
});
module.exports = __toCommonJS(solution_exports);

// src/lib/arrays.ts
function range(start, stop) {
  return Array.from(Array(stop - start + 1).keys()).map((it) => it + start);
}
function sliceReverse(array, start, count) {
  array.splice(start, count, ...array.slice(start, start + count).reverse());
}

// src/lib/codeforces.ts
var StdInput = class {
  constructor() {
    this.lines = [];
    this.data = "";
    process.stdin.resume();
    process.stdin.setEncoding("utf-8");
    this.complete = new Promise((resolve, reject) => {
      process.stdin.on("data", (it) => this.data += it);
      process.stdin.on("end", () => {
        this.lines = this.data.split("\n");
        resolve();
      });
    });
  }
  readLine() {
    var _a;
    return (_a = this.lines.shift()) != null ? _a : "";
  }
  readInt() {
    return parseInt(this.readLine());
  }
  readInts(sep = " ") {
    return this.readLine().split(sep).map((it) => parseInt(it));
  }
};
var StdOutput = class {
  writeln(line) {
    process.stdout.write(line);
    process.stdout.write("\n");
  }
};

// src/problem/1728/B/solution.ts
main(new StdInput(), new StdOutput());
async function main(input, output) {
  await input.complete;
  const T = input.readInt();
  for (let t = 0; t < T; t++) {
    const n = input.readInt();
    const p = range(1, n);
    for (let i = n - 4; i >= 0; i -= 2) {
      sliceReverse(p, i, 2);
    }
    output.writeln(p.join(" "));
  }
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  main
});

"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/problem/1728/B/solution.ts
var solution_exports = {};
__export(solution_exports, {
  main: () => main
});
module.exports = __toCommonJS(solution_exports);

// src/lib/codeforces.ts
var StdInput = class {
  constructor() {
    this.lines = [];
    this.data = "";
    process.stdin.resume();
    process.stdin.setEncoding("utf-8");
    this.complete = new Promise((resolve, reject) => {
      process.stdin.on("data", (it) => this.data += it);
      process.stdin.on("end", () => {
        this.lines = this.data.split("\n");
        resolve();
      });
    });
  }
  readLine() {
    var _a;
    return (_a = this.lines.shift()) != null ? _a : "";
  }
  readInt() {
    return parseInt(this.readLine());
  }
  readInts(sep = " ") {
    return this.readLine().split(sep).map((it) => parseInt(it));
  }
};
var StdOutput = class {
  writeln(line) {
    process.stdout.write(line);
    process.stdout.write("\n");
  }
};

// src/lib/natural-numbers.ts
function range(start, stop) {
  return Array.from(Array(stop - start + 1).keys()).map((it) => it + start);
}

// src/problem/1728/B/solution.ts
main(new StdInput(), new StdOutput());
async function main(input, output) {
  await input.complete;
  const T = input.readInt();
  for (let t = 0; t < T; t++) {
    const n = input.readInt();
    const p = range(1, n);
    for (let i = n - 4; i >= 0; i -= 2) {
      p.splice(i, 2, ...p.slice(i, i + 2).reverse());
    }
    output.writeln(p.join(" "));
  }
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  main
});

"use strict";var m=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var b=(r,e)=>{for(var t in e)m(r,t,{get:e[t],enumerable:!0})},h=(r,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of f(e))!d.call(r,n)&&n!==t&&m(r,n,{get:()=>e[n],enumerable:!(s=p(e,n))||s.enumerable});return r};var g=r=>h(m({},"__esModule",{value:!0}),r);var w={};b(w,{main:()=>l});module.exports=g(w);var o=class{constructor(){this.lines=[];this.data="";process.stdin.resume(),process.stdin.setEncoding("utf-8"),this.complete=new Promise((e,t)=>{process.stdin.on("data",s=>this.data+=s),process.stdin.on("end",()=>{this.lines=this.data.split(`
`),e()})})}readLine(){var e;return(e=this.lines.shift())!=null?e:""}readInt(){return parseInt(this.readLine())}readInts(e=" "){return this.readLine().split(e).map(t=>parseInt(t))}},a=class{writeln(e){process.stdout.write(e),process.stdout.write(`
`)}};function c(r,e){return Array.from(Array(e-r+1).keys()).map(t=>t+r)}l(new o,new a);async function l(r,e){await r.complete;let t=r.readInt();for(let s=0;s<t;s++){let n=r.readInt(),u=c(1,n);for(let i=n-4;i>=0;i-=2)u.splice(i,2,...u.slice(i,i+2).reverse());e.writeln(u.join(" "))}}0&&(module.exports={main});

const readline = require('readline')

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
})
const lines = []
rl.on('line', (input) => {
    lines.push(input);
})
rl.on('close', () => {
// (function() {
    // const lines = require('fs').readFileSync('test.in', 'utf8').split('\n')
    let l = 0;
    let t = +lines[l++]
    const output = []
    for (let i = 0; i < t; i++) {
        const n = +lines[l++]
        output[i] = solve(n)
    }
    console.log(output.join('\n'))
// })()
})

function solve(n) {
    const ans = Array(n)
    for (let i = 1; i <= n; i++) {
        // if (n & 1) {
        //     // ans[i - 1] = i + 1
        // } else {
            ans[i - 1] = n - 1 - i
        // }
    }
    if (n & 1) {
        [ans[0], ans[1]] = [ans[1], ans[0]]
    }
    ans[n - 3] = 1
    ans[n - 2] = n - 1
    ans[n - 1] = n
    // ;[ans[0], ans[n - 3]] = [ans[n - 3], ans[0]]
    // console.log(check(ans))
    return ans.join(' ')
}
function check(arr) {
    return arr.reduce((s, x) => s < x ? s + x : 0, 0)
}

let buf='';

process.stdin.on('readable',function(){
    let chunk=process.stdin.read();
    if(chunk) buf+=chunk;
})

process.stdin.on('end',function(){
    let line=buf.split('\n');
    let t=parseInt(line[0]);
    for(let z=1;z<=t;z++)
    {
        let n=parseInt(line[z]);
        let ans='';
        if(n&1)
        {
            ans+=1+' ';
            for(let i=n-2;i>=2;i--) ans+=i+' ';
        }
        else
        {
            for(let i=n-2;i>=1;i--) ans+=i+' ';
        }
        ans+=(n-1)+' '+n;
        console.log(ans);
    }
})

let buf='';

process.stdin.on('readable',function(){
    let chunk=process.stdin.read();
    if(chunk) buf+=chunk;
})

process.stdin.on('end',function(){
    let line=buf.split('\n');
    let t=parseInt(line[0]);
    for(let z=1;z<=t;z++)
    {
        let n=parseInt(line[z]);
        // console.log(n);
        let ans='';
        if(n&1)
        {
            ans+=1+' ';
            for(let i=n-2;i>=2;i--) ans+=i+' ';
        }
        else
        {
            for(let i=n-2;i>=1;i--) ans+=i+' ';
        }
        ans+=(n-1)+' '+n;
        console.log(ans);
    }
})

// Common Template Starts //
//*
process.stdin.resume();
process.stdin.setEncoding("utf-8");

let inputString = "";
let currentLine = 0;

process.stdin.on("data", (inputStdin) => {
    inputString += inputStdin;
});

process.stdin.on("end", (_) => {
    inputString = inputString
        .trim()
        .split("\n")
        .map((string) => {
            return string.trim();
        });

    main();
});

function readline() {
    return inputString[currentLine++];
}
// Common Template Ends //

const getresult = (n) => {
    let perm = Array(n).fill().map((_, i) => i+1 )

    let i = n % 2
    while(i < n - 2)
    {
        [ perm[i], perm[i + 1] ] = [ perm[i + 1], perm[i] ]

        i += 2
    }

    return perm.join(' ')
}

function main() {
    let testcases = parseInt( readline() )

    while( testcases-- ){
        let n = parseInt( readline() )
        console.log( getresult(n) )
    }
}
//*/

const readline = require('readline')
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
})

let i = 0
rl.on('line', function (line) {
  i++
  if (i > 1) {
    // console.log('--->', line);
    processLine(line)
  }
})

function processLine (line) {
  const n = Number(line)
  const arr = new Array(n)
  arr[n - 1] = n
  arr[n - 2] = n - 1
  arr[n - 3] = 1
  let i = 0
  const odd = (n % 2) | 0
  if (odd) { arr[0] = 2; i = 1 };
  for (let el = n - 2; el >= 2 + odd; el--) {
    arr[i] = el
    i++
  }
  console.log(arr.join(' '))
}

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });

    main();
});

function readLine() {
    return inputString[currentLine++];
}

//

function main() {
    let t = parseInt(readLine())
    while (t--) {
        const n = parseInt(readLine())
        if (n % 2 === 0) {
            for (let i = n - 2; i > 0; i --) {
                process.stdout.write(i.toString() + " ")
            }
        } else {
            process.stdout.write(`${n-3} ${n-2} `)
            for (let i = n - 4; i > 0; i --) {
                process.stdout.write(i.toString() + " ")
            }
        }
        console.log(`${n-1} ${n}`)
    }
}

'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', stdin => inputString += stdin);

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(s => s.trim());
    main();
});

function readline() {
    return inputString[currentLine++];
}

function output(x) {
    if (typeof x !== 'string') {
        x = x.toString();
    }
    //process.stdout.write(x);   // without auto '\n' (newline)
    console.log(x);  // with auto '\n' (newline)
}

function main() {
    let N = readline();

    for (let test = 0; test < N; test++) {
        let n = parseInt(readline(), 10);

        if (n % 2 === 0) {
            let suffix = [n-1, n];
            let prefix = [];
            let rem = (n - 2) / 2;
            for (let i = 0; i < rem; i++) {
                prefix.push(2*i+2);
                prefix.push(2*i+1);
            }
            let result = [...prefix, ...suffix].join(' ');
            output(result);
        } else {
            let prefix = [1,2,3];
            let suffix = [n-1, n];
            let rem = (n - 5) / 2;
            for (let i = 2; i < rem + 2; i++) {
                prefix.push(2*i+1);
                prefix.push(2*i);
            }
            let result = [...prefix, ...suffix].join(' ');
            output(result);
        }
    }
}

let stop = '';
process.stdin.on('data', c => stop += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = stop.split(EOL);
    var t = lines[0];
    for(i = 1; i <= t; i++){
        var n = Number(lines[i]);
        var ans = '';
        for(j = n - 3; j > 1; j--){
            ans += j + ' ';
        }
        ans += (n - 2) + ' ' + 1 + ' ' + (n - 1) + ' ' + n;
        console.log(ans);
    }
});

process.stdin.resume();
process.stdin.setEncoding('utf-8');

var input = '';
process.stdin.on('data', function(chunk) {
    input += chunk;
});

process.stdin.on('end', function() {
    const data = input.trim().split('\n').map(Number);
    for (let testNumber = 1; testNumber < data.length; testNumber++) {
        const test = data[testNumber];

        if (test === 4) {
            console.log('2 1 3 4');
            continue;
        }

        const result = new Array(test).fill(0);

        let i = result.length - 1;
        const added = new Set();
        const addNumber = (num) => {
            if (i < 0) {
                return;
            }

            result[i] = num;
            added.add(num);
            i--;
        };

        // Phase 1
        addNumber(test);

        // Phase 2
        if (test % 2 === 0) {
            // Even case
            const x = Math.floor((test - 2) / 2);
            const y = x + 1;
            addNumber(y);
            addNumber(x);
            addNumber(1);
            addNumber(test - 2);
            addNumber(test - 1);
        } else {
            // Odd case
            addNumber(test - 1);
            addNumber(1);
            addNumber(test - 2);
        }

        // DESC order
        let k = 1;
        for (let j = 1; j <= test; j++) {
            while (added.has(k)) {
                k++;
            }

            addNumber(k);
        }

        console.log(result.join(' '));
    }
});

process.stdin.resume();
process.stdin.setEncoding('utf-8');

var input = '';
process.stdin.on('data', function(chunk) {
    input += chunk;
});

process.stdin.on('end', function() {
    const data = input.trim().split('\n').map(Number);
    for (let testNumber = 1; testNumber < data.length; testNumber++) {
        const test = data[testNumber];

        if (test === 4) {
            console.log('2 1 3 4');
            continue;
        }

        const result = new Array(test).fill(0);

        let i = result.length - 1;
        const added = new Set();
        const addNumber = (num) => {
            result[i] = num;
            added.add(num);
            i--;
        };

        // Phase 1
        addNumber(test);

        // Phase 2
        if (test % 2 === 0) {
            // Even case
            const x = Math.floor((test - 2) / 2);
            const y = x + 1;
            addNumber(y);
            addNumber(x);
            addNumber(1);
            addNumber(x - 2);
            addNumber(x - 1);
        } else {
            // Odd case
            addNumber(test - 1);
            addNumber(1);
            addNumber(test - 2);
        }

        // DESC order
        let k = 1;
        for (let j = 1; j <= test; j++) {
            while (added.has(k)) {
                k++;
            }

            addNumber(k);
        }

        console.log(result.join(' '));
    }
});

process.stdin.resume();
process.stdin.setEncoding('utf-8');

var input = '';
process.stdin.on('data', function(chunk) {
    input += chunk;
});

process.stdin.on('end', function() {
    const data = input.trim().split('\n').map(Number);
    for (let testNumber = 1; testNumber < data.length; testNumber++) {
        const test = data[testNumber];

        if (test === 4) {
            console.log('2 1 3 4');
            continue;
        }

        const result = new Array(test).fill(0);

        let i = result.length - 1;
        const added = new Set();
        const addNumber = (num) => {
            result[i] = num;
            added.add(num);
            i--;
        };

        // Phase 1
        addNumber(test);

        // Phase 2
        if (test % 2 === 0) {
            // Even case
            const x = Math.floor((test - 2) / 2);
            const y = x + 1;
            addNumber(y);
            addNumber(x);
            addNumber(1);
            addNumber(x - 1);
            addNumber(x - 2);
        } else {
            // Odd case
            addNumber(test - 1);
            addNumber(1);
            addNumber(test - 2);
        }

        // DESC order
        let k = 1;
        for (let j = 1; j <= test; j++) {
            while (added.has(k)) {
                k++;
            }

            addNumber(k);
        }

        console.log(result.join(' '));
    }
});

process.stdin.resume();
process.stdin.setEncoding('utf-8');

var input = '';
process.stdin.on('data', function(chunk) {
    input += chunk;
});

process.stdin.on('end', function() {
    const data = input.trim().split('\n').map(Number);
    for (let testNumber = 1; testNumber < data.length; testNumber++) {
        const test = data[testNumber];
        const result = new Array(test).fill(0);

        if (test === 4) {
            console.log('2 1 3 4');
            continue;
        }

        let i = result.length - 1;
        const added = new Set();
        const addNumber = (num) => {
            result[i] = num;
            added.add(num);
            i--;
        };

        // Phase 1
        addNumber(test);

        // Phase 2
        if (test % 2 === 0) {
            // Even case
            const x = Math.floor((test - 2) / 2);
            const y = x + 1;
            addNumber(y);
            addNumber(x);
            addNumber(1);
            // Phase 3
            let k = test;
            for (let j = 1; j <= test; j++) {
                while (added.has(k)) {
                    k--;
                }

                addNumber(k);
            }
        } else {
            // Odd case
            addNumber(test - 1);
            addNumber(1);
            addNumber(test - 2);
            // Phase 3
            let k = 1;
            for (let j = 1; j <= test; j++) {
                while (added.has(k)) {
                    k++;
                }

                addNumber(k);
            }
        }

        console.log(result.join(' '));
    }
});

process.stdin.resume();
process.stdin.setEncoding('utf-8');

var input = '';
process.stdin.on('data', function(chunk) {
    input += chunk;
});

process.stdin.on('end', function() {
    const data = input.trim().split('\n').map(Number);
    for (let testNumber = 1; testNumber < data.length; testNumber++) {
        const test = data[testNumber];
        const result = new Array(test).fill(0);

        if (test === 4) {
            console.log('2 1 3 4');
            continue;
        }

        let i = result.length - 1;
        const added = new Set();
        const addNumber = (num) => {
            result[i] = num;
            added.add(num);
            i--;
        };

        // Phase 1
        addNumber(test);

        // Phase 2
        if (test % 2 === 0) {
            // Even case
            const x = Math.floor((test - 2) / 2);
            const y = x + 1;
            addNumber(y);
            addNumber(x);
            addNumber(1);
        } else {
            // Odd case
            addNumber(test - 1);
            addNumber(1);
            addNumber(test - 2);
        }

        // Phase 3
        let k = test;
        for (let j = 1; j <= test; j++) {
            while (added.has(k)) {
                k--;
            }

            addNumber(k);
        }

        console.log(result.join(' '));
    }
});

process.stdin.resume();
process.stdin.setEncoding('utf-8');

var input = '';
process.stdin.on('data', function(chunk) {
    input += chunk;
});

process.stdin.on('end', function() {
    const data = input.trim().split('\n').map(Number);
    for (let testNumber = 1; testNumber < data.length; testNumber++) {
        const test = data[testNumber];
        const result = new Array(test).fill(0);

        if (test === 4) {
            console.log('2 1 3 4');
            continue;
        }

        let i = result.length - 1;
        const added = new Set();
        const addNumber = (num) => {
            result[i] = num;
            added.add(num);
            i--;
        };

        // Phase 1
        addNumber(test);

        // Phase 2
        if (test % 2 === 0) {
            // Even case
            const x = Math.floor((test - 2) / 2);
            const y = x + 1;
            addNumber(y);
            addNumber(x);
            addNumber(1);
        } else {
            // Odd case
            addNumber(test - 1);
            addNumber(1);
        }

        // Phase 3
        let k = test;
        for (let j = 0; j <= test; j++) {
            while (added.has(k)) {
                k--;
            }

            addNumber(k);
        }

        console.log(result.join(' '));
    }
});

process.stdin.resume();
process.stdin.setEncoding('utf-8');

var input = '';
process.stdin.on('data', function(chunk) {
    input += chunk;
});

process.stdin.on('end', function() {
    const data = input.trim().split('\n').map(Number);
    for (let testNumber = 1; testNumber < data.length; testNumber++) {
        const test = data[testNumber];
        const result = new Array(test).fill(0);

        if (test === 4) {
            console.log('2 1 3 4');
            continue;
        }

        let i = result.length - 1;
        const added = new Set();
        const addNumber = (num) => {
            result[i] = num;
            added.add(num);
            i--;
        };

        // Phase 1
        addNumber(test);

        // Phase 2
        if (test % 2 === 0) {
            // Even case
            const x = Math.floor((test - 2) / 2);
            const y = x + 1;
            addNumber(y);
            addNumber(x);
            addNumber(1);
            // Phase 3
            let k = test;
            for (let j = 0; j <= test; j++) {
                while (added.has(k)) {
                    k--;
                }

                addNumber(k);
            }
        } else {
            // Odd case
            addNumber(test - 1);
            addNumber(1);
            // Phase 3
            let k = 1;
            for (let j = 0; j <= test; j++) {
                while (added.has(k)) {
                    k++;
                }

                addNumber(k);
            }
        }

        console.log(result.join(' '));
    }
});

process.stdin.resume();
process.stdin.setEncoding('utf-8');

var input = '';
process.stdin.on('data', function(chunk) {
    input += chunk;
});

process.stdin.on('end', function() {
    const data = input.trim().split('\n').map(Number);
    for (let testNumber = 1; testNumber < data.length; testNumber++) {
        const test = data[testNumber];
        const result = new Array(test).fill(0);

        if (test === 4) {
            console.log('2 1 3 4');
            continue;
        }

        let i = result.length - 1;
        const added = new Set();
        const addNumber = (num) => {
            result[i] = num;
            added.add(num);
            i--;
        };

        // Phase 1
        addNumber(test);

        // Phase 2
        if (test % 2 === 0) {
            // Even case
            const x = Math.floor((test - 2) / 2);
            const y = x + 1;
            addNumber(y);
            addNumber(x);
            addNumber(1);
            // Phase 3
            let k = 1;
            for (let j = 0; j <= test; j++) {
                while (added.has(k)) {
                    k++;
                }

                addNumber(k);
            }
        } else {
            // Odd case
            addNumber(test - 1);
            addNumber(1);
            // Phase 3
            let k = test;
            for (let j = 0; j <= test; j++) {
                while (added.has(k)) {
                    k--;
                }

                addNumber(k);
            }
        }

        console.log(result.join(' '));
    }
});

process.stdin.resume();
process.stdin.setEncoding('utf-8');

var input = '';
process.stdin.on('data', function(chunk) {
    input += chunk;
});

process.stdin.on('end', function() {
    const data = input.trim().split('\n').map(Number);
    for (let testNumber = 1; testNumber < data.length; testNumber++) {
        const test = data[testNumber];
        const result = new Array(test).fill(0);

        if (test === 1) {
            console.log('1');
            continue;
        }

        if (test === 2) {
            console.log('1 2');
            continue;
        }

        if (test === 3) {
            console.log('2 1 3');
            continue;
        }

        if (test === 4) {
            console.log('2 1 3 4');
            continue;
        }

        let i = result.length - 1;
        const added = new Set();
        const addNumber = (num) => {
            result[i] = num;
            added.add(num);
            i--;
        };

        // Phase 1
        addNumber(test);

        // Phase 2
        if (test % 2 === 0) {
            // Even case
            const x = Math.floor((test - 2) / 2);
            const y = x + 1;
            addNumber(y);
            addNumber(x);
        } else {
            // Odd case
            addNumber(test - 1);
        }

        addNumber(1);

        // Phase 3
        let k = test;
        for (let j = 0; j <= test; j++) {
            while (added.has(k)) {
                k--;
            }

            addNumber(k);
        }

        console.log(result.join(' '));
    }
});

process.stdin.resume();
process.stdin.setEncoding('utf-8');

var input = '';
process.stdin.on('data', function(chunk) {
    input += chunk;
});

process.stdin.on('end', function() {
    const data = input.trim().split('\n').map(Number);
    for (let testNumber = 1; testNumber < data.length; testNumber++) {
        const test = data[testNumber];
        const result = new Array(test).fill(0);

        if (test === 1) {
            console.log('1');
            continue;
        }

        if (test === 2) {
            console.log('1 2');
            continue;
        }

        if (test === 3) {
            console.log('2 1 3');
            continue;
        }

        if (test === 4) {
            console.log('2 1 3 4');
            continue;
        }

        let i = result.length - 1;
        const added = new Set();
        const addNumber = (num) => {
            result[i] = num;
            added.add(num);
            i--;
        };

        // Phase 1
        addNumber(test);

        // Phase 2
        if (test % 2 === 0) {
            // Even case
            const x = Math.floor((test - 2) / 2);
            const y = x + 1;
            addNumber(y);
            addNumber(x);
        } else {
            // Odd case
            addNumber(test - 1);
        }

        addNumber(1);

        // Phase 3
        let k = 1;
        for (let j = 0; j <= test; j++) {
            while (added.has(k)) {
                k++;
            }

            addNumber(k);
        }

        console.log(result.join(' '));
    }
});

process.stdin.resume();
process.stdin.setEncoding('utf-8');

var input = '';
process.stdin.on('data', function(chunk) {
    input += chunk;
});

process.stdin.on('end', function() {
    const data = input.trim().split('\n').map(Number);
    for (let testNumber = 1; testNumber < data.length; testNumber++) {
        const test = data[testNumber];
        const result = new Array(test).fill(0);

        if (test === 1) {
            console.log('1');
            continue;
        }

        if (test === 2) {
            console.log('1 2');
            continue;
        }

        if (test === 3) {
            console.log('2 1 3');
            continue;
        }

        if (test === 4) {
            console.log('3 1 2 4');
            continue;
        }

        let i = result.length - 1;
        const added = new Set();
        const addNumber = (num) => {
            result[i] = num;
            added.add(num);
            i--;
        };

        // Phase 1
        addNumber(test);

        // Phase 2
        if (test % 2 === 0) {
            // Even case
            const x = Math.floor((test - 2) / 2);
            const y = x + 1;
            addNumber(y);
            addNumber(x);
        } else {
            // Odd case
            addNumber(test - 1);
        }

        addNumber(1);

        // Phase 3
        let k = 1;
        for (let j = 0; j <= test; j++) {
            while (added.has(k)) {
                k++;
            }

            addNumber(k);
        }

        console.log(result.join(' '));
    }
});

process.stdin.resume();
process.stdin.setEncoding('utf-8');

var input = '';
process.stdin.on('data', function(chunk) {
    input += chunk;
});

process.stdin.on('end', function() {
    const data = input.trim().split('\n').map(Number);
    for (let testNumber = 1; testNumber < data.length; testNumber++) {
        const test = data[testNumber];
        console.log(test);
        const result = new Array(test).fill(0);

        if (test === 1) {
            console.log('1');
            continue;
        }

        if (test === 2) {
            console.log('1 2');
            continue;
        }

        if (test === 3) {
            console.log('2 1 3');
            continue;
        }

        if (test === 4) {
            console.log('3 1 2 4');
            continue;
        }

        let i = result.length - 1;
        const added = new Set();
        const addNumber = (num) => {
            result[i] = num;
            added.add(num);
            i--;
        };

        // Phase 1
        addNumber(test);

        // Phase 2
        if (test % 2 === 0) {
            // Even case
            const x = Math.floor((test - 2) / 2);
            const y = x + 1;
            addNumber(y);
            addNumber(x);
        } else {
            // Odd case
            addNumber(test - 1);
        }

        addNumber(1);

        // Phase 3
        let k = 1;
        for (let j = 0; j <= test; j++) {
            while (added.has(k)) {
                k++;
            }

            addNumber(k);
        }

        console.log(result.join(' '));
    }
});

"use strict";var u=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var f=(r,e)=>{for(var t in e)u(r,t,{get:e[t],enumerable:!0})},b=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of p(e))!d.call(r,s)&&s!==t&&u(r,s,{get:()=>e[s],enumerable:!(n=l(e,s))||n.enumerable});return r};var h=r=>b(u({},"__esModule",{value:!0}),r);var g={};f(g,{main:()=>c});module.exports=h(g);var i=class{constructor(){this.lines=[];this.data="";process.stdin.resume(),process.stdin.setEncoding("utf-8"),this.complete=new Promise((e,t)=>{process.stdin.on("data",n=>this.data+=n),process.stdin.on("end",()=>{this.lines=this.data.split(`
`),e()})})}readLine(){var e;return(e=this.lines.shift())!=null?e:""}readInt(){return parseInt(this.readLine())}readInts(e=" "){return this.readLine().split(e).map(t=>parseInt(t))}},o=class{writeln(e){process.stdout.write(e),process.stdout.write(`
`)}};function m(r,e){return Array.from(Array(e-r+1).keys()).map(t=>t+r)}c(new i,new o);async function c(r,e){await r.complete;let t=r.readInt();for(let n=0;n<t;n++){let s=r.readInt(),a=m(1,s);a.splice(-4,2,...a.slice(-4,-2).reverse()),e.writeln(a.join(" "))}}0&&(module.exports={main});

"use strict";var a=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var d=(r,e)=>{for(var t in e)a(r,t,{get:e[t],enumerable:!0})},f=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of l(e))!p.call(r,i)&&i!==t&&a(r,i,{get:()=>e[i],enumerable:!(n=c(e,i))||n.enumerable});return r};var b=r=>f(a({},"__esModule",{value:!0}),r);var h={};d(h,{main:()=>m});module.exports=b(h);var s=class{constructor(){this.lines=[];this.data="";process.stdin.resume(),process.stdin.setEncoding("utf-8"),this.complete=new Promise((e,t)=>{process.stdin.on("data",n=>this.data+=n),process.stdin.on("end",()=>{this.lines=this.data.split(`
`),e()})})}readLine(){var e;return(e=this.lines.shift())!=null?e:""}readInt(){return parseInt(this.readLine())}readInts(e=" "){return this.readLine().split(e).map(t=>parseInt(t))}},o=class{writeln(e){process.stdout.write(e),process.stdout.write(`
`)}};function u(r,e){return Array.from(Array(e-r+1).keys()).map(t=>t+r)}m(new s,new o);async function m(r,e){await r.complete;let t=r.readInt();for(let n=0;n<t;n++){let i=r.readInt();e.writeln(u(1,i).join(" "))}}0&&(module.exports={main});

const readline = require('readline')

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
})
const lines = []
rl.on('line', (input) => {
    lines.push(input);
})
rl.on('close', () => {
// (function() {
    // const lines = require('fs').readFileSync('test.in', 'utf8').split('\n')
    let l = 0;
    let t = +lines[l++]
    const output = []
    for (let i = 0; i < t; i++) {
        const n = +lines[l++]
        output[i] = solve(n)
    }
    console.log(output.join('\n'))
// })()
})

function solve(n) {
    const ans = Array(n)
    for (let i = 1; i <= n; i++) {
        ans[i - 1] = i
    }
    ;[ans[0], ans[n - 3]] = [ans[n - 3], ans[0]]
    return ans.join(' ')
}

// Common Template Starts //
//*
process.stdin.resume();
process.stdin.setEncoding("utf-8");

let inputString = "";
let currentLine = 0;

process.stdin.on("data", (inputStdin) => {
    inputString += inputStdin;
});

process.stdin.on("end", (_) => {
    inputString = inputString
        .trim()
        .split("\n")
        .map((string) => {
            return string.trim();
        });

    main();
});

function readline() {
    return inputString[currentLine++];
}
// Common Template Ends //

const getresult = (n) => {
    let res = []
    let i = 1
    while( i <= n ) {
        res.push(i)
        i++
    }

    return res.join(' ')
}

function main() {
    let testcases = parseInt( readline() )

    while( testcases-- ){
        let n = parseInt( readline() )

        console.log( getresult(n) )
    }

}
//*/

const readline = require('readline')
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
})

let i = 0
rl.on('line', function (line) {
  i++
  if (i > 1) {
    // console.log('--->', line);
    processLine(line)
  }
})

function processLine (line) {
  const n = Number(line)
  const arr = new Array(n)
  arr[n - 1] = n
  arr[n - 2] = n - 1
  arr[n - 3] = 1
  let i = 0
  if (n % 2 === 0) {
    for (let el = n - 2; el >= 2; el--) {
      arr[i] = el
      i++
    }
  } else {
    for (let el = 2; el <= n - 2; el++) {
      arr[i] = el
      i++
    }
  }
  console.log(arr.join(' '))
}

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });

    main();
});

function readLine() {
    return inputString[currentLine++];
}

//

function main() {
    let t = parseInt(readLine())
    while (t--) {
        const n = parseInt(readLine())
        if (n === 1) {
            console.log(1)
            continue
        }
        for (let i = n - 2; i > 0; i --) {
            process.stdout.write(i.toString() + " ")
        }
        console.log(`${n-1} ${n}`)
    }
}

'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', stdin => inputString += stdin);

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(s => s.trim());
    main();
});

function readline() {
    return inputString[currentLine++];
}

function output(x) {
    if (typeof x !== 'string') {
        x = x.toString();
    }
    //process.stdout.write(x);   // without auto '\n' (newline)
    console.log(x);  // with auto '\n' (newline)
}

function main() {
    let N = readline();

    for (let test = 0; test < N; test++) {
        let n = parseInt(readline(), 10);

        if (n % 2 === 0) {
            let suffix = [n-1, n];
            let prefix = [];
            let rem = (n - 2) / 2;
            for (let i = 0; i < rem; i++) {
                prefix.push(2*i+2);
                prefix.push(2*i+1);
            }
            let result = [...prefix, ...suffix].join(' ');
            output(result);
        } else {
            let prefix = [1,2,3];
            let suffix = [n-1, n];
            let rem = (n - 5) / 2;
            for (let i = 2; i < rem; i++) {
                prefix.push(2*i+1);
                prefix.push(2*i);
            }
            let result = [...prefix, ...suffix].join(' ');
            output(result);
        }
    }
}


Anton likes to play chess. Also he likes to do programming. No wonder that he decided to attend chess classes and programming classes.Anton has n variants when he will attend chess classes, i-th variant is given by a period of time (l1, i, r1, i). Also he has m variants when he will attend programming classes, i-th variant is given by a period of time (l2, i, r2, i).Anton needs to choose exactly one of n possible periods of time when he will attend chess classes and exactly one of m possible periods of time when he will attend programming classes. He wants to have a rest between classes, so from all the possible pairs of the periods he wants to choose the one where the distance between the periods is maximal.The distance between periods (l1, r1) and (l2, r2) is the minimal possible distance between a point in the first period and a point in the second period, that is the minimal possible |i - j|, where l1 ≤ i ≤ r1 and l2 ≤ j ≤ r2. In particular, when the periods intersect, the distance between them is 0.Anton wants to know how much time his rest between the classes will last in the best case. Help Anton and find this number!

The first line of the input contains a single integer n (1 ≤ n ≤ 200 000) — the number of time periods when Anton can attend chess classes. Each of the following n lines of the input contains two integers l1, i and r1, i (1 ≤ l1, i ≤ r1, i ≤ 109) — the i-th variant of a period of time when Anton can attend chess classes. The following line of the input contains a single integer m (1 ≤ m ≤ 200 000) — the number of time periods when Anton can attend programming classes. Each of the following m lines of the input contains two integers l2, i and r2, i (1 ≤ l2, i ≤ r2, i ≤ 109) — the i-th variant of a period of time when Anton can attend programming classes.

Output one integer — the maximal possible distance between time periods.

NoteIn the first sample Anton can attend chess classes in the period (2, 3) and attend programming classes in the period (6, 8). It's not hard to see that in this case the distance between the periods will be equal to 3.In the second sample if he chooses any pair of periods, they will intersect. So the answer is 0.

var ints = function() {
	return readline().split(' ').map(function(word) {
		return parseInt(word)
	})
}

var n = parseInt(readline()),
	minEA = 1000000001,
	minEB = 1000000001,
	maxSA = 0,
	maxSB = 0,
	pair = []

while (n > 0) {
	pair = ints()
	minEA = Math.min(minEA, pair[1])
	maxSA = Math.max(maxSA, pair[0])
	n --
}

n = parseInt(readline())
while (n > 0) {
	pair = ints()
	minEB = Math.min(minEB, pair[1])
	maxSB = Math.max(maxSB, pair[0])
	n --
}

print(Math.max(0, Math.max(maxSB - minEA, maxSA - minEB)))

var classes = [
    {
        minEnd: 1000000000,
        maxStart: 1
    },
    {
        minEnd: 1000000000,
        maxStart: 1
    }
];
var maxDistance = 0;

for (var i = 0; i < classes.length; i++) {
    var amount = parseInt(readline());

    for (var j = 0; j < amount; j++) {
        var input = readline();

        var startTime = parseInt(input.split(" ")[0]);
        var endTime = parseInt(input.split(" ")[1]);

        if (classes[i].minEnd > endTime)
            classes[i].minEnd = endTime;
        if (classes[i].maxStart < startTime)
            classes[i].maxStart = startTime;
    }
}

if (classes[0].minEnd < classes[1].maxStart)
    maxDistance = classes[1].maxStart - classes[0].minEnd;
if (classes[1].minEnd < classes[0].maxStart)
    if (maxDistance < classes[0].maxStart - classes[1].minEnd)
        maxDistance = classes[0].maxStart - classes[1].minEnd;

print(maxDistance);

var contVal = [{max_l: -Infinity, min_r: +Infinity}, {max_l: -Infinity, min_r: +Infinity}];

for(var i = 0; i < contVal.length; i++) {

    var num_pairs = parseInt(readline());

    for(var j = 0; j < num_pairs; j++) {

        var pair = readline().split(' ').map(Number);

        contVal[i].max_l = Math.max(contVal[i].max_l, pair[0]);
        contVal[i].min_r = Math.min(contVal[i].min_r, pair[1]);
    }
}

print(Math.max(Math.max(0, contVal[1].max_l - contVal[0].min_r), Math.max(0, contVal[0].max_l - contVal[1].min_r)));

/*
    The idea to solve this problem is basically observing the condition how rest time is formed:
    - l1->r1 l2->r2
    - l2->r2 l1->r1

    Since we want to get maximum rest time, then we need to compare these two conditions:
    - l1->r1 l2->r2 ==> max(l2) - min(r1)
    - l2->r2 l1->r1 ==> max(l1) - min(r2)

    Notice that when period is intersect (the resulted value from formula above will negative), based on problem description, the value of distance will become 0. Thus above formula will be like this:
    - l1->r1 l2->r2 ==> max(0, max(l2) - min(r1))
    - l2->r2 l1->r1 ==> max(0, max(l1) - min(r2))

    Thus to get max distance, the formula would be: max(max(0, max(l2) - min(r1)), max(0, max(l1) - min(r2)))
*/

// define container for containing max l & min r values
var contVal = [{max_l: -Infinity, min_r: +Infinity}, {max_l: -Infinity, min_r: +Infinity}];

// search for max l & min r value
for(var i = 0; i < contVal.length; i++) {

    var num_pairs = parseInt(readline());

    for(var j = 0; j < num_pairs; j++) {

        var pair = readline().split(' ').map(Number);

        contVal[i].max_l = Math.max(contVal[i].max_l, pair[0]);
        contVal[i].min_r = Math.min(contVal[i].min_r, pair[1]);
    }
}

// get max distance | rest time
print(Math.max(Math.max(0, contVal[1].max_l - contVal[0].min_r), Math.max(0, contVal[0].max_l - contVal[1].min_r)));

var n = parseInt(readline());
  var np = [];
  var nsrm = - Infinity;
  var nslm = Infinity;
  var nerm = - Infinity;
  var nelm = Infinity;
  while(n > 0) {
    np.push(readline().split(' ').map(function(x) { return parseInt(x); }));
    nsrm = Math.max(nsrm, np[np.length - 1][0]);
    nslm = Math.min(nslm, np[np.length - 1][0]);
    nerm = Math.max(nerm, np[np.length - 1][1]);
    nelm = Math.min(nelm, np[np.length - 1][1]);
    n -= 1;
  }

  var m = parseInt(readline());
  var mp = [];
  var msrm = - Infinity;
  var mslm = Infinity;
  var merm = - Infinity;
  var melm = Infinity;
  while(m > 0) {
    mp.push(readline().split(' ').map(function(x) { return parseInt(x); }));
    msrm = Math.max(msrm, mp[mp.length - 1][0]);
    mslm = Math.min(mslm, mp[mp.length - 1][0]);
    merm = Math.max(merm, mp[mp.length - 1][1]);
    melm = Math.min(melm, mp[mp.length - 1][1]);
    m -= 1;
  }
  print(Math.max(0, Math.max(nsrm - melm, msrm - nelm)));

var ints = function() {
	return readline().split(' ').map(function(word) {
		return parseInt(word)
	})
}

var n = parseInt(readline()),
	minEA = 1000000001,
	minEB = 1000000001,
	maxSA = 0,
	maxSB = 0,
	pair = []

while (n > 0) {
	pair = ints()
	minEA = Math.min(minEA, pair[1])
	maxSA = Math.max(maxSA, pair[0])
	n --
}

n = parseInt(readline())
while (n > 0) {
	pair = ints()
	minEB = Math.min(minEB, pair[1])
	maxSB = Math.max(maxSB, pair[0])
	n --
}

print(Math.max(maxSB - minEA, maxSA - minEB))

var contVal = [{max_l: -Infinity, min_r: +Infinity}, {max_l: -Infinity, min_r: +Infinity}];

for(var i = 0; i < contVal.length; i++) {

    var num_pairs = parseInt(readline());

    for(var j = 0; j < num_pairs; j++) {

        var pair = readline().split(' ').map(Number);

        contVal[i].max_l = Math.max(contVal[i].max_l, pair[0]);
        contVal[i].min_r = Math.min(contVal[i].min_r, pair[1]);
    }
}

print(Math.max(0, contVal[1].max_l - contVal[0].min_r), Math.max(0, contVal[0].max_l - contVal[1].min_r));


It is Professor R's last class of his teaching career. Every time Professor R taught a class, he gave a special problem for the students to solve. You being his favourite student, put your heart into solving it one last time.You are given two polynomials $$$f(x) = a_0 + a_1x + \dots + a_{n-1}x^{n-1}$$$ and $$$g(x) = b_0 + b_1x + \dots + b_{m-1}x^{m-1}$$$, with positive integral coefficients. It is guaranteed that the cumulative GCD of the coefficients is equal to $$$1$$$ for both the given polynomials. In other words, $$$gcd(a_0, a_1, \dots, a_{n-1}) = gcd(b_0, b_1, \dots, b_{m-1}) = 1$$$. Let $$$h(x) = f(x)\cdot g(x)$$$. Suppose that $$$h(x) = c_0 + c_1x + \dots + c_{n+m-2}x^{n+m-2}$$$. You are also given a prime number $$$p$$$. Professor R challenges you to find any $$$t$$$ such that $$$c_t$$$ isn't divisible by $$$p$$$. He guarantees you that under these conditions such $$$t$$$ always exists. If there are several such $$$t$$$, output any of them.As the input is quite large, please use fast input reading methods.

The first line of the input contains three integers, $$$n$$$, $$$m$$$ and $$$p$$$ ($$$1 \leq n, m \leq 10^6, 2 \leq p \leq 10^9$$$),  — $$$n$$$ and $$$m$$$ are the number of terms in $$$f(x)$$$ and $$$g(x)$$$ respectively (one more than the degrees of the respective polynomials) and $$$p$$$ is the given prime number. It is guaranteed that $$$p$$$ is prime. The second line contains $$$n$$$ integers $$$a_0, a_1, \dots, a_{n-1}$$$ ($$$1 \leq a_{i} \leq 10^{9}$$$) — $$$a_i$$$ is the coefficient of $$$x^{i}$$$ in $$$f(x)$$$. The third line contains $$$m$$$ integers $$$b_0, b_1, \dots, b_{m-1}$$$ ($$$1 \leq b_{i} \leq 10^{9}$$$)  — $$$b_i$$$ is the coefficient of $$$x^{i}$$$ in $$$g(x)$$$.

Print a single integer $$$t$$$ ($$$0\le t \le n+m-2$$$)  — the appropriate power of $$$x$$$ in $$$h(x)$$$ whose coefficient isn't divisible by the given prime $$$p$$$. If there are multiple powers of $$$x$$$ that satisfy the condition, print any.

NoteIn the first test case, $$$f(x)$$$ is $$$2x^2 + x + 1$$$ and $$$g(x)$$$ is $$$x + 2$$$, their product $$$h(x)$$$ being $$$2x^3 + 5x^2 + 3x + 2$$$, so the answer can be 1 or 2 as both 3 and 5 aren't divisible by 2.In the second test case, $$$f(x)$$$ is $$$x + 2$$$ and $$$g(x)$$$ is $$$x + 3$$$, their product $$$h(x)$$$ being $$$x^2 + 5x + 6$$$, so the answer can be any of the powers as no coefficient is divisible by the given prime.

process.stdin.resume()
process.stdin.setEncoding('utf-8')

var arr = ''
process.stdin.on('data', (i) => {
  arr += i
})

process.stdin.on('end', () => {
  arr = arr.split('\n').map(a => a.replace(/(\r\n|\n|\r)/gm, ''))
  main(arr)
})

function wr(...x) {
  console.log(...x)
}

function sort(a, inc = true) {
  if(inc) a.sort((a, b) => a - b)
  else a.sort((a, b) => b - a)
}

function readInt(a, i) {
  if(i === undefined) return parseInt(a.shift())
  else return parseInt(a[i])
}

function readInts(a, i) {
  if(i === undefined) return arr.shift().split(' ').map(a => parseInt(a))
  else return arr[i].split(' ').map(a => parseInt(a))
}

function main(input) {
  const [n, m, p] = readInts(input, 0)
  const ai = readInts(input, 1)
  const bi = readInts(input, 2)
  let i = 0, j =0
  while(i < n) {
    if(ai[i] % p !== 0) {
      break
    }
    i++
  }
  while(j < m) {
    if(bi[j] % p !== 0) {
      break
    }
    j++
  }
  // wr(i, j)
  wr(i + j)
}

(()=>{"use strict";var t={675:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),Array.numbersMatrix=(t,e,r)=>{let n=[];null==t&&(e=t),null==r&&(r=0);for(let i=0;i<t;++i){let t=[];for(let n=0;n<e;++n)t.push(r);n.push(t)}return n},Array.prototype.sortAsc=function(){return this.sort(((t,e)=>t-e))},Array.prototype.sortDesc=function(){return this.sort(((t,e)=>e-t))},Array.prototype.max=function(){if(0==this.length)return 0;let t=this[0];for(let e=1;e<this.length;++e)t=Math.max(t,this[e]);return t},Array.prototype.min=function(){if(0==this.length)return 0;let t=this[0];for(let e=1;e<this.length;++e)t=Math.min(t,this[e]);return t},Array.prototype.sum=function(){let t=0;for(let e=0;e<this.length;++e)t+=this[e];return t},Array.prototype.modSum=function(t){let e=0;for(let r=0;r<this.length;++r)e+=this[r],e%=t;return e},Array.prototype.avg=function(){return this.sum()/this.length},Array.prototype.groupBy=function(t){let e=new Map;for(let r=0;r<this.length;++r){const n=t(this[r]);e.has(n)?e.get(n).push(this[r]):e.set(n,[this[r]])}return e},Array.prototype.deepCopy=function(){let t=[];if(0==this.length)return t;let e=!1;Array.isArray(this[0])&&(e=!0);for(let r=0;r<this.length;++r)e?t.push(this[r].deepCopy()):t.push(this[r]);return t},Array.prototype.transpose=function(){let t=[];if(0==this.length)return[[]];for(let e=0;e<this[0].length;++e){let r=[];for(let t=0;t<this.length;++t)r.push(this[t][e]);t.push(r)}return t},Array.prototype.toString=function(){if(0==this.length)return"";if(!Array.isArray(this[0]))return this.join(" ");let t="";for(let e=0;e<this.length;++e)t+=this[e].join(" "),e!=this.length-1&&(t+="\n");return t}},312:function(t,e,r){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const i=n(r(747));let s="",o=[],u=0,l="";const p="local"===process.argv[2],a=t=>{if(p){if(o=i.default.readFileSync("input.txt").toString().trim().split("\n").map((t=>t.trim())),t(),i.default.writeFileSync("output.txt",l),console.log(l),i.default.readFileSync("expected.txt").toString().trim()==l.trim()){const{exec:t}=r(129);t("osascript -e 'display notification \"✅ AC!!\"'")}}else process.stdin.resume(),process.stdin.setEncoding("utf-8"),process.stdin.on("data",(t=>{s+=t})),process.stdin.on("end",(e=>{o=s.trim().split("\n").map((t=>t.trim())),t(),console.log(l)}))};function f(){return o[u++]}function h(){return f().split(" ").map((t=>parseFloat(t)))}function c(){return f().split("")}e.default={runMain:a,runEachTest:t=>{a((()=>{let[e]=h();for(;e>0;)t(),e--}))},readline:f,nextNumbers:h,nextBigNumbers:function(){return f().split(" ").map((t=>BigInt(t)))},nextNumbersMatrix:function(t){let e=[];for(let r=0;r<t;++r)e.push(h());return e},nextCharacters:c,nextCharacterMatrix:function(t){let e=[];for(let r=0;r<t;++r)e.push(c());return e},nextIntervalArray:function(t){let e=[];for(let r=0;r<t;++r){const[t,r]=h();e.push({a:t,b:r})}return e},put:function(t){l+=t},puts:function(t){l+=t+"\n"},debug:function(t){p&&console.log(t)}}},965:function(t,e,r){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),r(675);const i=n(r(312));i.default.runMain((function(){let[t,e,r]=i.default.nextNumbers(),n=i.default.nextNumbers(),s=i.default.nextNumbers();i.default.puts(n.findIndex((t=>t%r!=0))+s.findIndex((t=>t%r!=0)))}))},129:t=>{t.exports=require("child_process")},747:t=>{t.exports=require("fs")}},e={};!function r(n){if(e[n])return e[n].exports;var i=e[n]={exports:{}};return t[n].call(i.exports,i,i.exports,r),i.exports}(965)})();

// Solution written in typescript and compiled via webpack. Original source code below
// Happy Hacking 😜

// import './array'
//
// import io from './io'
//
// function main() {
//   let [n, m, p] = io.nextNumbers()
//   let a = io.nextNumbers()
//   let b = io.nextNumbers()
//
//   io.puts(a.findIndex((x) => x % p != 0) + b.findIndex((x) => x % p != 0))
// }
//
// // io.runEachTest(main)
// io.runMain(main)

process.stdin.resume()
process.stdin.setEncoding('utf-8')

var arr = ''
process.stdin.on('data', (i) => {
  arr += i
})

process.stdin.on('end', () => {
  arr = arr.split('\n').map(a => a.replace(/(\r\n|\n|\r)/gm, ''))
  main(arr)
})

function wr(...x) {
  console.log(...x)
}

function sort(a, inc = true) {
  if(inc) a.sort((a, b) => a - b)
  else a.sort((a, b) => b - a)
}

function readInt(a, i) {
  if(i === undefined) return parseInt(a.shift())
  else return parseInt(a[i])
}

function readInts(a, i) {
  if(i === undefined) return arr.shift().split(' ').map(a => parseInt(a))
  else return arr[i].split(' ').map(a => parseInt(a))
}

function main(input) {
  const [n, m, p] = readInts(input, 0)
  const ai = readInts(input, 1)
  const bi = readInts(input, 2)
  let i = 0, j =0
  while(i < n) {
    if(ai[i] % p !== 0 && i !== 0) {
      break
    }
    i++
  }
  while(j < m) {
    if(bi[j] % p !== 0 && j !== 0) {
      break
    }
    j++
  }
  wr(i, j)
  wr(i + j)
}

process.stdin.resume()
process.stdin.setEncoding('utf-8')

var arr = ''
process.stdin.on('data', (i) => {
  arr += i
})

process.stdin.on('end', () => {
  arr = arr.split('\n').map(a => a.replace(/(\r\n|\n|\r)/gm, ''))
  main(arr)
})

function wr(...x) {
  console.log(...x)
}

function sort(a, inc = true) {
  if(inc) a.sort((a, b) => a - b)
  else a.sort((a, b) => b - a)
}

function readInt(a, i) {
  if(i === undefined) return parseInt(a.shift())
  else return parseInt(a[i])
}

function readInts(a, i) {
  if(i === undefined) return arr.shift().split(' ').map(a => parseInt(a))
  else return arr[i].split(' ').map(a => parseInt(a))
}

function main(input) {
  const [n, m, p] = readInts(input, 0)
  const ai = readInts(input, 1)
  const bi = readInts(input, 2)
  let i = 0, j =0
  while(i < n) {
    if(ai[i] % p !== 0 && i !== 0) {
      break
    }
    i++
  }
  while(j < m) {
    if(bi[j] % p !== 0 && j !== 0) {
      break
    }
    j++
  }
  // wr(i, j)
  wr(i + j)
}


On a random day, Neko found $$$n$$$ treasure chests and $$$m$$$ keys. The $$$i$$$-th chest has an integer $$$a_i$$$ written on it and the $$$j$$$-th key has an integer $$$b_j$$$ on it. Neko knows those chests contain the powerful mysterious green Grapes, thus Neko wants to open as many treasure chests as possible.The $$$j$$$-th key can be used to unlock the $$$i$$$-th chest if and only if the sum of the key number and the chest number is an odd number. Formally, $$$a_i + b_j \equiv 1 \pmod{2}$$$. One key can be used to open at most one chest, and one chest can be opened at most once.Find the maximum number of chests Neko can open.

The first line contains integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 10^5$$$) — the number of chests and the number of keys. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 10^9$$$) — the numbers written on the treasure chests. The third line contains $$$m$$$ integers $$$b_1, b_2, \ldots, b_m$$$ ($$$1 \leq b_i \leq 10^9$$$) — the numbers written on the keys.

Print the maximum number of chests you can open.

NoteIn the first example, one possible way to unlock $$$3$$$ chests is as follows:  Use first key to unlock the fifth chest,  Use third key to unlock the second chest,  Use fourth key to unlock the first chest. In the second example, you can use the only key to unlock any single chest (note that one key can't be used twice).In the third example, no key can unlock the given chest.

ip= readline().split(' ');
n = +ip[0], m = +ip[1];
one = readline().split(' ').map(Number).reduce(((acc,x)=>x%2 === 1?acc+1:acc),0);
two = readline().split(' ').map(Number).reduce(((acc,x)=>x%2 === 1?acc+1:acc),0);
print(Math.min(one,m - two) + Math.min(two,n - one));

(function () {
    var read = {
        number: function () {
            return +readline();
        },
        arr: function (divider) {
            return readline().split(divider ? divider : '');
        },
        arrNumber: function (divider) {
            return readline()
                .split(divider ? divider : '')
                .map(item => +item);
        }
    }

    var line = read.arrNumber(' ');
    var n = line[0];
    var m = line[1];

    var a = read.arrNumber(' ');
    var b = read.arrNumber( ' ');

    var ac = 0;
    for(var i = 0; i < n; i ++) {
        if(a[i]%2 === 0) {
            ac++;
        }
    }
    var an = n - ac;

    var bc = 0;
    for(var i = 0; i < m; i ++) {
        if(b[i] % 2 === 0) {
            bc++;
        }
    }

    var bn = m - bc;

    var m1 = ac > bn ? bn : ac;
    var m2 = an > bc ? bc : an;
    print(m1 + m2);
}());

var firstLine = readline();

var cN = readline().split(' ');
var cM = readline().split(' ');

var cNObj = checkArr(cN);
var cMObj = checkArr(cM);

var res1 = Math.min(cNObj['ch'], cMObj['neCh']);
var res2 = Math.min(cNObj['neCh'], cMObj['ch']);

print(res1+res2);

function minVal(a, b) {

}
function checkArr(arr) {
    var chCount = 0;
    var neChCount = 0;
    arr.forEach(function(el) {
      if(el%2) {
          neChCount++;
      } else {
          chCount++;
      }
    });
    return {"ch" : chCount, "neCh" : neChCount};
}

readline();

var chests = readline().split(' ').map(function(num) {
  return parseInt(num);
});

var keys = readline().split(' ').map(function(num) {
  return parseInt(num);
});

var evenChestsAmount = 0;
var oddChestsAmount = 0;

var evenKeysAmount = 0;
var oddKeysAmount = 0;

for (var i = 0; i < chests.length; i++) {
  if (chests[i] % 2 == 0) {
    evenChestsAmount++;
  } else {
    oddChestsAmount++;
  }
}

for (var i = 0; i < keys.length; i++) {
  if (keys[i] % 2 == 0) {
    evenKeysAmount++;
  } else {
    oddKeysAmount++;
  }
}

var result = Math.min(evenChestsAmount, oddKeysAmount);
result += Math.min(oddChestsAmount, evenKeysAmount);

print(result);

var inputMN = readline().split(" ").map(function (x) { return parseInt(x); });
var inputMList = readline().split(" ").map(function (x) { return parseInt(x); });
var inputNList = readline().split(" ").map(function (x) { return parseInt(x); });
var mOdd = 0, mEven = 0, nOdd = 0, nEven = 0;
for (var i = 0; i < inputMN[0]; i++) {
if (inputMList[i] % 2 === 0) {
  ++mEven;
} else {
  ++mOdd;
}
}
for (var j = 0; j < inputMN[1]; j++) {
if (inputNList[j] % 2 === 0) {
  ++nEven;
} else {
  ++nOdd;
}
}
print(Math.min(mEven, nOdd) + Math.min(nEven, mOdd));

var nm = readline().split(' ').map(v=>(parseInt(v)))
var chests = readline().split(' ').map(v=>(parseInt(v)%2 === 0))
var keys = readline().split(' ').map(v=>(parseInt(v)%2 === 0))

var min0 = Math.min(chests.filter(c=>(c)).length, keys.filter(k=>(!k)).length)
var min1 = Math.min(chests.filter(c=>(!c)).length, keys.filter(k=>(k)).length)

var res = min0 + min1;

print(res)

const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});
let c = 0;
let n, m;
let chests;
let keys;

rl.on('line', (d) => {
  if (c === 0) {
    c++;
    [n, m] = d.split(' ').map(Number);
    return;
  }

  if (c === 1) {
    chests = d.split(' ').map(Number);
  }

  if (c === 2) {
    keys = d.split(' ').map(Number);
  }

  c++;
});

rl.on('close', () => {
  let odd = 0;
  let even = 0;
  let ans = 0;

  for (let i = 0; i < chests.length; i++) {
    if (chests[i] % 2 === 0) {
      even++;
    }
    else {
      odd++;
    }
  }

  for (let i = 0; i < keys.length; i++) {
    if (keys[i] % 2 !== 0 && even > 0) {
      even--;
      ans++;
    }
    else if (keys[i] % 2 === 0 && odd > 0) {
      odd--;
      ans++;
    }
  }

  console.log(ans);
});


We often go to supermarkets to buy some fruits or vegetables, and on the tag there prints the price for a kilo. But in some supermarkets, when asked how much the items are, the clerk will say that $$$a$$$ yuan for $$$b$$$ kilos (You don't need to care about what "yuan" is), the same as $$$a/b$$$ yuan for a kilo.Now imagine you'd like to buy $$$m$$$ kilos of apples. You've asked $$$n$$$ supermarkets and got the prices. Find the minimum cost for those apples.You can assume that there are enough apples in all supermarkets.

The first line contains two positive integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 5\,000$$$, $$$1 \leq m \leq 100$$$), denoting that there are $$$n$$$ supermarkets and you want to buy $$$m$$$ kilos of apples. The following $$$n$$$ lines describe the information of the supermarkets. Each line contains two positive integers $$$a, b$$$ ($$$1 \leq a, b \leq 100$$$), denoting that in this supermarket, you are supposed to pay $$$a$$$ yuan for $$$b$$$ kilos of apples.

The only line, denoting the minimum cost for $$$m$$$ kilos of apples. Please make sure that the absolute or relative error between your answer and the correct answer won't exceed $$$10^{-6}$$$. Formally, let your answer be $$$x$$$, and the jury's answer be $$$y$$$. Your answer is considered correct if $$$\frac{|x - y|}{\max{(1, |y|)}} \le 10^{-6}$$$.

NoteIn the first sample, you are supposed to buy $$$5$$$ kilos of apples in supermarket $$$3$$$. The cost is $$$5/3$$$ yuan.In the second sample, you are supposed to buy $$$1$$$ kilo of apples in supermarket $$$2$$$. The cost is $$$98/99$$$ yuan.

//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
	input: process.stdin, output: process.stdout
});
var obj; var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
	obj = init(inLine);
	console.error('\n↑入力 ↓出力');
	Main();
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){
	return {
		list : input, index : 0, max : input.length,
		hasNext : function(){return (this.index < this.max);},
		next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException ‚There is no more input';}}
	};
}
function myout(s){console.log(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
	var one = nextIntArray();
	var N = one[0];
	var M = one[1];
	var list = new Array(N);
	for(var i = 0; i < N; i++){
		var tmp = nextIntArray();
		list[i] = tmp[0] / tmp[1];
	}
	list.sort(function(a,b){
		return a - b;
	});
	myout(list[0] * M);
}

// http://codeforces.com/problemset/problem/977/A
module.exports = solve;
function solve() {
    var [n, m] = readline();
    var min = 999999;
    for (var i = 0; i < n; i++) {
        const [a, b]= readline();
        min = Math.min(min, a / b)
    }
    return min * m;
}

function readline(){
    return lines.shift();
}
const lines = [];
const rl = require('readline').createInterface({
    input: process.stdin,
    output: process.stdout,
    terminal: false
});
rl.on('line', (line) => {
    lines.push(line.split(' ').map(n => parseInt(n, 10)));
    if(lines.length -1 === lines[0][0]) {
        console.log(solve());
        rl.close();
    }
});

const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});
let c = 0;
let n, m;
let best = Infinity;

rl.on('line', (d) => {
  if (c === 0) {
    c++;
    [n, m] = d.split(' ').map(Number);
    return;
  }

  let [a, b] = d.split(' ').map(Number);
  let tmp = (m * a / b);

  if (tmp < best) {
    best = tmp;
  }

  c++;
});

rl.on('close', () => {
  console.log(best.toFixed(8));
});

'use strict';

function Scanner() {
  this.nextLine = () => readline();
  this.nextInt = () => parseInt(readline());
  this.nextDouble = () => parseInt(readline());
  this.nextArray = () => readline().split(' ');
}

const is = new Scanner();

let line = is.nextArray().map(Number);
let n = line[0];
let m = line[1];
let a, b;

let answer = Infinity;
for (let i = 0; i < n; i++) {
  line = is.nextArray().map(Number);
  a = line[0];
  b = line[1];
  answer = Math.min(answer, (a * m) / b);
}

print(answer);

'use strict';
var inputData = readline().split(' ');
var n = parseInt(inputData[0]);
var m = parseInt(inputData[1]);
var cost = [];
for (var i = 0; i < n; i++) {
    var input = readline().split(' ');
    var a = parseInt(input[0]);
    var b = parseInt(input[1]);
    cost.push(a / b);
}
print(Math.min.apply(Math, cost) * m);

var input = readline().split(" ");
var prices = [];
for (var i = 0; i < parseInt(input[0],10); i++) {
    prices.push(readline());
}
var min = prices[0].split(" ")[0]/prices[0].split(" ")[1];
for (var i = 1; i < prices.length; i++) {
    var temp = prices[i].split(" ")[0]/prices[i].split(" ")[1];
    if (temp < min) min = temp;
}
write(min*input[1]);

// http://codeforces.com/problemset/problem/977/A
module.exports = solve;
function solve(vals) {
    let min = 99999999;
    vals.forEach(v => {
        let [a, b] = line.split(' ').map(n => parseInt(n, 10));
        min = Math.min(b/a, min);
    })
    return min;
}

const rl = require('readline').createInterface({
    input: process.stdin,
    output: process.stdout,
    terminal: false
});

let vals = [];
rl.on('line', (line) => {
    vals.push(line);
    // if (i++) {
        // /console.log(solve(line))
        // rl.close();
    // }
});
rl.on('end', (line) => {
    console.log(solve(vals))
})

const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});
let c = 0;
let n, m;
let best = Infinity;

rl.on('line', (d) => {
  if (c === 0) {
    c++;
    [n, m] = d.split(' ').map(Number);
    return;
  }

  let [a, b] = d.split(' ').map(Number);
  let tmp = (m * a / b).toFixed(8);

  if (tmp < best) {
    best = tmp;
  }

  c++;
});

rl.on('close', () => {
  console.log(best);
});