You are given one integer $$$n$$$ ($$$n > 1$$$).Recall that a permutation of length $$$n$$$ is an array consisting of $$$n$$$ distinct integers from $$$1$$$ to $$$n$$$ in arbitrary order. For example, $$$[2, 3, 1, 5, 4]$$$ is a permutation of length $$$5$$$, but $$$[1, 2, 2]$$$ is not a permutation ($$$2$$$ appears twice in the array) and $$$[1, 3, 4]$$$ is also not a permutation ($$$n = 3$$$ but there is $$$4$$$ in the array).Your task is to find a permutation $$$p$$$ of length $$$n$$$ that there is no index $$$i$$$ ($$$1 \le i \le n$$$) such that $$$p_i = i$$$ (so, for all $$$i$$$ from $$$1$$$ to $$$n$$$ the condition $$$p_i \ne i$$$ should be satisfied).You have to answer $$$t$$$ independent test cases.If there are several answers, you can print any. It can be proven that the answer exists for each $$$n > 1$$$.

The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains one integer $$$n$$$ ($$$2 \le n \le 100$$$) — the length of the permutation you have to find.

For each test case, print $$$n$$$ distinct integers $$$p_1, p_2, \ldots, p_n$$$ — a permutation that there is no index $$$i$$$ ($$$1 \le i \le n$$$) such that $$$p_i = i$$$ (so, for all $$$i$$$ from $$$1$$$ to $$$n$$$ the condition $$$p_i \ne i$$$ should be satisfied). If there are several answers, you can print any. It can be proven that the answer exists for each $$$n > 1$$$.

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();
    });

    A();
});

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

function pi(a) {
    return parseInt(a);
}

function ti(a){
    for(let i = 0; i < a.length; i++)
        a[i] = pi(a[i]);

    return a;
}

function A(){
    let t = pi(readline());
    while(t){
        t--;
        let n = pi(readline());
        let res = '';
        for(let i = 1; i <= n; i++){
            if(i !== n){
                res += ` ${i+1}`;
            }else{
                res += ` ${1}`;
            }
        }

        console.log(res.trim());
    }
}

function main(){
    var n = readline();
    for(var i = 0; i < n; ++i){
        var num = readline();
        var res = '';
        res += `${num} `;
        for(var j = 1; j < num - 1; ++j){
            res += `${j} `;
        }
        res += num - 1;
        print(res);
    }
}

main();

'use strict'

let t = readline();

while(t--)
{
   let n = readline(), a = [];
   for(let i = 1; i < n; i++)a[i] = i;
   a[0] = n;
   print(a.join(" "));
}

(function() {
    var t = +readline()

    for (var i = 0; i < t; i++) {
        var n = +readline()
        var arr = []
        flag = true
        for (j = 1; j <= n; j++) {
            if (j + 1 <= n) {
                arr.push(j + 1)
            } else {
                arr.push(j - j + 1)
            }

        }
        print(arr.join(' '))
    }
}())

var t = +readline();

for (var i = 0; i < t; i++) {
  var l = +readline();
  var res = [];
  var part = l/2;

  for (var j = 1; j <= l; j++) {
    res[j-1] = j;
  }

   for (var k = 0; k < l -1; k++) {

       var temp = res[k];
       res[k] = res[k+1];
       res[k+1] = temp;

   }

  print(res.toString().replace(/\,/g, ' '));
}

var t=readline();
while(t--)
{
  var n=readline();
  print(n + " ");

  for(var i=1;i<=n-1;i++)
  {
      print(i + " ");
  }
  print("\n");
}

var start = true

function task(s){
	s = s.trim().split('\n')
	let t = +s.shift()
	for (let i = 0; i < t; i++) {
		let n = +s.shift(), a = []
		for (let j = n; j>=1; j--) {
			a.push(j)
			if(j==a.length){
				a[a.length-1] = n
				a[0] = j
			}
		}
		console.log(a.join(' '));
	}
}

if(start){
	process.stdin.resume();
	process.stdin.setEncoding('utf-8');
	let inputString = '';
	process.stdin.on('data', inputStdin => {
	    inputString += inputStdin;
	});
	process.stdin.on('end', _ => {
	    task(inputString);
	});
}

const solve = (p) => {
    let res = [];
    for (let i = 1; i <= p; i++) {
        res.unshift(i);
    }
    if (p % 2 == 1) {
        let mid = p >> 1;
        [res[mid], res[mid + 1]] = [res[mid + 1], res[mid]];
    }
    console.log(res.join(" "));
};

const main = () => {
    const readline = require('readline');
    const rl = readline.createInterface({
        input: process.stdin,
        output: process.stdout
    });
    let input = [];
    rl.on('line', (line) => {
        input.push(line.split(" ").map(x => Number(x)));
    });
    rl.on('close', () => {
        let t = Number(input[0][0]);
        let i = 1;
        while (t > 0) {
            let data = input.slice(i, i + 1);
            solve(data[0][0]);
            t--;
            i++;
        }
    });
};

main()

let inputString = "";
let currentLine = 0;
process.stdin.on("data", (data) => {
  inputString += data;
});
process.stdin.on("end", function () {
  inputString = inputString
    .trim()
    .split("\n")
    .map((str) => str.trim());
  main();
});
function readLine() {
  return inputString[currentLine++];
}

// utils
const MOD = 1e9 + 7;
const mod = (n) => ((n % MOD) + MOD) % MOD;
const add = (a, b) => mod(mod(a) + mod(b));
const sub = (a, b) => mod(mod(a) - mod(b));
function mul() {
  for (var a = arguments, r = a[0], i = a.length; --i; )
    r = ((((r >> 16) * a[i]) % MOD) * 65536 + (r & 65535) * a[i]) % MOD;
  return r;
}
function inv(b) {
  for (var a = MOD, u = 0, v = 1, t; b; v = t)
    (t = (a / b) | 0), (a -= t * b), (u -= t * v), (t = a), (a = b), (b = t), (t = u), (u = v);
  u %= MOD;
  return u < 0 ? u + MOD : u;
}
function pow(base, n) {
  if (n === 0) return 1;
  let p = pow(base, Math.floor(n / 2));
  let res = mul(mod(p), mod(p));
  if (n % 2 === 1) res = mul(mod(res), base);
  return res;
}
function highestOneBit(i) {
  i |= i >> 1;
  i |= i >> 2;
  i |= i >> 4;
  i |= i >> 8;
  i |= i >> 16;
  return i - (i >>> 1);
}
function permutation(arr, len, store = "", permutations = []) {
  if (store.length === len) {
    permutations.push(store);
    return;
  }
  for (let i = 0; i < arr.length; i++) {
    const newArr = [...arr];
    const newChar = newArr.splice(i, 1);
    permutation(newArr, len, store.concat(newChar), permutations);
  }
  return permutations;
}

function main() {
  let t = +readLine();
  while (t--) {
    const len = +readLine();
    const ans = [];

    for (let i = 2; i <= len; i++) ans.push(i);
    ans.push(1);

    console.log(ans.join(" "));
  }
}

//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){
	var tmp = input.split(' ');
	for(var i = 0; i < tmp.length; i++){
		inLine.push(tmp[i]);
	}
});
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 nextArray(size, code){
	var ret = new Array(size);
	for(var i = 0; i < size; i++){
		if(code == 'int'){
			ret[i] = nextInt();
		}else{
			ret[i] = next();
		}
	}
	return ret;
}
function nextIntArray(size){return nextArray(size, 'int');} function nextStrArray(size){return nextArray(size, 'str');}
function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();} function nextInt(){return myconv(next(),1);}
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 t = nextInt();
	var output = new Array(t);
	for(var i = 0; i < t; i++){
		var N = nextInt();
		var list = new Array(N);
		for(var j = 1; j <= N; j++){
			list[j - 1] = j;
		}
		list.push(list.shift());
		output[i] = myconv(list, 8);
	}
	myout(myconv(output, 9));
}

//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
	input: process.stdin, output: process.stdout
});
var obj; var inLine = []; var outputList = [];
read.on('line', function(input){
	var tmp = input.split(' ');
	for(var i = 0; i < tmp.length; i++){
		inLine.push(tmp[i]);
	}
});
read.on('close', function(){
	obj = init(inLine);
	console.error('\n↑入力 ↓出力');
	Main();
	console.log(myconv(outputList, 9));
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextArray(size, code){
	var ret = new Array(size);
	for(var i = 0; i < size; i++){
		if(code == 'int'){
			ret[i] = nextInt();
		}else{
			ret[i] = next();
		}
	}
	return ret;
}
function nextIntArray(size){return nextArray(size, 'int');} function nextStrArray(size){return nextArray(size, 'str');}
function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();} function nextInt(){return myconv(next(),1);}
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){outputList.push(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 t = nextInt();
	for(var i = 0; i < t; i++){
		var N = nextInt();
		var list = new Array(N);
		for(var j = 1; j <= N; j++){
			list[j - 1] = j;
		}
		list.push(list.shift());
		myout(myconv(list, 8));
	}
}

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

let stdinInput = '';

process.stdin.on('data', input => {
  stdinInput += input;
})

process.stdin.on('end', () => {
  main(stdinInput);
})

function main(data) {
    data = data.split('\n');
    const testCases = data[0] * 1;
    let i = 1;
    while (i <= testCases) {
      // const s = data[i].trim().split(' ');
      // let a = data[i].trim() * 1;
      const n = data[i] * 1;
      // const p = BigInt(s[0]);
      // const q = BigInt(s[1]);
      // s.sort((a, b) => b - a);
      let arr = [];
      // console.log(p%q)
      // let first = true;
      // for (let j = p; j > 0; j -= 1n) {
      //   if (p % j === 0n && j % q !== 0n) {
      //     console.log(j.toString());
      //     break;
      //   } else if (first) {j = j / 2n + 1n; first = false;}
      // }
      let j = n;
      while (j > Math.ceil(n / 2)) {
        arr.push(j);
        j -= 1;
      }
      j = 1;
      while (j <= Math.ceil(n / 2)) {
        arr.push(j);
        j += 1;
      }
      console.log(arr.join(' '));
      i += 1;
    }
}

"use strict";

(() => {

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

    let curLine = 0, allLines = [];

    let nextLine = () => {
        if(curLine == allLines.length) throw new ReferenceError("No more input in the buffer");
        return allLines[curLine++]
    };

    readline.on("line", line => { allLines.push(line); });
    readline.on("close", () => { main(nextLine) });

})();

function main(nextLine) {
    let t = Number(nextLine());

    while(t--) {
        let n = Number(nextLine());

        let ans = [];
        for(let i = 2; i <= n; i++) ans.push(i);
        ans.push(1);

        console.log(ans.join(" "));
    }
}

/* this language fucking sucks */

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

let lines = [];

rl.on('line', (data) => {
    lines.push(data);
    if(lines.length > 0 && parseInt(lines[0]) === lines.length - 1) {
	rl.close();
	main();
    }
});

async function main() {
    let t = parseInt(lines[0]);
    for(let i = 1; i <= t; i++) {
	let n = parseInt(lines[i]);
	let ans = n + ' ';
	for(let j = 1; j < n; j++) {
	    ans += (j + ' ');
	}
	console.log(ans);
    }
}

(()=>{"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 o=0;o<t;++o){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 o=n(r(747));let i="",s=[],u=0,l="";const a="local"===process.argv[2],h=t=>{if(a){if(s=o.default.readFileSync("input.txt").toString().trim().split("\n").map((t=>t.trim())),t(),o.default.writeFileSync("output.txt",l),console.log(l),o.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=>{i+=t})),process.stdin.on("end",(e=>{s=i.trim().split("\n").map((t=>t.trim())),t(),console.log(l)}))};function f(){return s[u++]}function p(){return f().split(" ").map((t=>parseFloat(t)))}function c(){return f().split("")}e.default={runMain:h,runEachTest:t=>{h((()=>{let[e]=p();for(;e>0;)t(),e--}))},readline:f,nextNumbers:p,nextBigNumbers:function(){return f().split(" ").map((t=>BigInt(t)))},nextNumbersMatrix:function(t){let e=[];for(let r=0;r<t;++r)e.push(p());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]=p();e.push({a:t,b:r})}return e},put:function(t){l+=t},puts:function(t){l+=t+"\n"},debug:function(t){a&&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 o=n(r(312));function i(t){for(var e,r,n=t.length;0!==n;)r=Math.floor(Math.random()*n),e=t[n-=1],t[n]=t[r],t[r]=e;return t}o.default.runEachTest((function(){let[t]=o.default.nextNumbers(),e=[];for(let r=1;r<=t;++r)e.push(r);for(;;){e=i(e);let r=!0;for(let n=1;n<=t;++n)if(e[n-1]==n){r=!1;break}if(r)break}o.default.puts(e.join(" "))}))},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 o=e[n]={exports:{}};return t[n].call(o.exports,o,o.exports,r),o.exports}(965)})();

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

// import './array'
//
// import io from './io'
//
// function shuffle(array) {
//   var currentIndex = array.length,
//     temporaryValue,
//     randomIndex
//
//   // While there remain elements to shuffle...
//   while (0 !== currentIndex) {
//     // Pick a remaining element...
//     randomIndex = Math.floor(Math.random() * currentIndex)
//     currentIndex -= 1
//
//     // And swap it with the current element.
//     temporaryValue = array[currentIndex]
//     array[currentIndex] = array[randomIndex]
//     array[randomIndex] = temporaryValue
//   }
//
//   return array
// }
//
// function main() {
//   let [n] = io.nextNumbers()
//
//   let a: number[] = []
//
//   for (let i = 1; i <= n; ++i) {
//     a.push(i)
//   }
//
//   while (true) {
//     a = shuffle(a)
//
//     let ok = true
//
//     for (let i = 1; i <= n; ++i) {
//       if (a[i - 1] == i) {
//         ok = false
//         break
//       }
//     }
//
//     if (ok) {
//       break
//     }
//   }
//
//   io.puts(a.join(" "))
// }
//
// io.runEachTest(main)
// // io.runMain(main)

let i = '';
process.stdin.on('data', c => i += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = i.split(EOL);

    let values = lines.map(val => parseInt(val));
    let t = values[0];

    for (let i = 0; i < t; i++) {
        console.log(solve(values[i + 1]));
    }
});

function solve(n) {
    const result = [];

    for (let i = 2; i <= n; i++) {
        result.push(i);
    }

    result.push(1);

    return result.join(' ');
}

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

/*
    2
    5

        2 1
        2 1 5 3 4
*/

function aaa(n) {
    n = +n;
    // console.log(n);

    let A = [];
    for (let i=0; i<n; i++) {
    	A[i] = i+1;
    }

    for (let i=1; i<n; i+=2) {
    	[A[i-1], A[i]] = [A[i], A[i-1]];
    }

    if (n%2 !== 0) {
    	// odd
    	let i = n-1;
    	[A[i-1], A[i]] = [A[i], A[i-1]];
    }

    console.log(A.join(" "));
    return A;
}

let T;
let A = [];

let i = 0;
// multi line input
readline.on('line', line => {

    if (i === 0) {
        T = line;
        i++;
        return
    } else {
        aaa(line);
    }
});

function main(){
    var n = readline();
    for(var i = 0; i < n; ++i){
        var num = readline();
        var res = '';
        for(var j = num; j > 1; --j){
            res += `${j} `;
        }
        res += '1';
        print(res);
    }
}

main();

function main(){
    var n = readline();
    for(var i = 0; i < n; ++i){
        var num = readline();
        var res = '';
        res += '5 ';
        for(var j = 1; j < num - 1; ++j){
            res += `${j} `;
        }
        res += num - 1;
        print(res);
    }
}

main();

function main(){
    var n = readline();
    for(var i = 0; i < n; ++i){
        var num = readline();
        var res = '';
        res += `${n} `;
        for(var j = 1; j < num - 1; ++j){
            res += `${j} `;
        }
        res += num - 1;
        print(res);
    }
}

main();

(function() {
    var t = +readline()

    for (var i = 0; i < t; i++) {
        var n = +readline()
        var arr = []
        for (j = 1; j <= n; j++) {
            arr.push(j)
        }
        print(arr.join(' '))
    }
}())

(function() {
    var t = +readline()

    for (var i = 0; i < t; i++) {
        var n = +readline()
        var arr = []
        var flag = false
        for (j = 1;j <= n; j++) {
            if (flag) {
                arr.push(j)
                flag = false
            } else {
                arr.push(100 - j + 1)
                 flag = true
            }
        }
        var res = arr.join(' ')
        print(res)
    }

}())

var t = +readline();

for (var i = 0; i < t; i++) {
  var l = +readline();
  var res = [];
  var num;

  for (var j = 1; j <= l; j++) {
    num = 1;

    if (num != j) {
      while (~res.indexOf(num)) {
        num++;
      }
      res[j-1] = num;
    } else {
      num++;
      while (~res.indexOf(num)) {
        num++;
      }

      res[j-1] = num;
    }
  }

    print(res.toString().replace(/\,/g, ' '));
}

var t = +readline();

for (var i = 0; i < t; i++) {
  var l = +readline();
  var res = [];

  for (var j = 0; j < l; j++) {
    res[j] = j+1;
  }

    print(res.toString().replace(/\,/g, ' '));
}

var t = +readline();

for (var i = 0; i < t; i++) {
  var l = +readline();
  var res = [];

  for (var j = 0; j < l; j++) {
    res[j] = j+1;
  }
    print(res.slice(0,2).reverse().concat(res.slice(2).reverse()).toString().replace(/\,/g, ' '));
}

var t = +readline();

for (var i = 0; i < t; i++) {
  var l = +readline();
  var res = [];

  for (var j = 0; j < l; j++) {
    res[j] = j+1;
  }

    print(res.reverse().toString().replace(/\,/g, ' '));
}

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

async function cin() {
    return new Promise((resolve, reject) => {
	rl.question('', (data) => {
	    resolve(data);
	});
    });
}

async function cint() {
    let n = await cin();
    return parseInt(n);
}

async function main() {
    let t = await cint();
    while(t--) {
	let n = await cint();
	process.stdout.write(n + ' ');
	for(let i = 1; i < n; i++) {
	    process.stdout.write(i + ' ');
	}
	process.stdout.write('\n');
    }

    rl.close();
}

main();

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

async function cin() {
    return new Promise((resolve, reject) => {
	rl.question('', (data) => {
	    resolve(data);
	});
    });
}

async function cint() {
    let n = await cin();
    return parseInt(n);
}

async function main() {
    let t = await cint();
    while(t--) {
	let n = await cint();
	let ans = n + ' ';
	for(let i = 1; i < n; i++) {
	    ans += (i + ' ');
	}
	console.log(ans);
    }

    rl.close();
}

main();

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

async function cin() {
    return new Promise((resolve, reject) => {
	rl.on('line', (data) => {
	    resolve(data);
	});
    });
}

async function cint() {
    let n = await cin();
    return parseInt(n);
}

async function main() {
    let t = await cint();
    while(t--) {
	let n = await cint();
	let ans = n + ' ';
	for(let i = 1; i < n; i++) {
	    ans += (i + ' ');
	}
	console.log(ans);
    }

    rl.close();
}

main();

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

/*
    2
    5

        2 1
        2 1 5 3 4
*/

function aaa(n) {
    n = +n;
    // console.log(n);

    let A = [];
    for (let i=0; i<n; i++) {
    	A[i] = i+1;
    }

    for (let i=1; i<n; i+=2) {
    	[A[i-1], A[i]] = [A[i], A[i-1]];
    }

    if (n%2 !== 0) {
    	// odd
    	let i = n-1;
    	[A[i-1], A[i]] = [A[i], A[i-1]];
    }

    console.log(A);
    return A;
}

let T;
let A = [];

let i = 0;
// multi line input
readline.on('line', line => {

    if (i === 0) {
        T = line;
        i++;
        return
    } else {
        aaa(line);
    }
});

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();
    });

    A();
});

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

function pi(a) {
    return parseInt(a);
}

function ti(a){
    for(let i = 0; i < a.length; i++)
        a[i] = pi(a[i]);

    return a;
}

function A(){
    let t = pi(readline());
    while(t){
        t--;
        let n = pi(readline());
        let res = '';
        for(let i = 1; i <= n; i++){
            if(i !== n){
                res += ` ${i+1}`;
            }else{
                res += ` ${i+1}`;
            }
        }

        console.log(res.trim());
    }
}


One day n cells of some array decided to play the following game. Initially each cell contains a number which is equal to it's ordinal number (starting from 1). Also each cell determined it's favourite number. On it's move i-th cell can exchange it's value with the value of some other j-th cell, if |i - j| = di, where di is a favourite number of i-th cell. Cells make moves in any order, the number of moves is unlimited.The favourite number of each cell will be given to you. You will also be given a permutation of numbers from 1 to n. You are to determine whether the game could move to this state.

The first line contains positive integer n (1 ≤ n ≤ 100) — the number of cells in the array. The second line contains n distinct integers from 1 to n — permutation. The last line contains n integers from 1 to n — favourite numbers of the cells.

If the given state is reachable in the described game, output YES, otherwise NO.

'use strict'

var N = +readline()
var poss = readline().split(' ').map(v => parseInt(v))
poss.unshift(0)
var fns = readline().split(' ').map(v => parseInt(v))
fns.unshift(0)

var pps = Array(N + 1)
for (var i = 1; i <= N; i++) {
  if (pps[i]) continue
  var rf = new Set([i])
  var nss = new Set([i])
  var nw
  do {
    var nnss = []
    nss.forEach(ns => {
      if (!pps[ns]) {pps[ns] = Array(N + 1); pps[ns][i] = true}
      var fnp = ns - fns[ns]
      if (!rf.has(fnp) && fnp <= N && fnp > 0) {
        rf.add(fnp)
        nnss.push(fnp)
        pps[ns][fnp] = true
      }
      var snp = ns + fns[ns]
      if (!rf.has(snp) && snp <= N && snp > 0) {
        rf.add(snp)
        nnss.push(snp)
        pps[ns][snp] = true
      }
      nw = pps[ns]
      nss.delete(ns)
    })
    rf.forEach(r => {
      if (pps[r]) {
        for (var i = 1; i <= N; i++) {
          if (pps[r][i]) nw[i] = true
        }
      }
    })
    nw.forEach((p, i) => {
      if (p) pps[i] = nw
    })
    nnss.forEach(nns => nss.add(nns))
  } while (nss.size)
}

var pbl = true

for (var i = 1; i <= N; i++) {
  var tp = poss[i]
  if (!pps[tp][i]) {
    pbl = false
    break
  }
}

print(pbl ? 'YES' : 'NO')