## GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

# [Solution] Permutation Value Codeforces Solution

B. Permutation Value
time limit per test
2 seconds
memory limit per test
512 megabytes
input
standard input
output
standard output

You are given an integer $n$. You have to construct a permutation of size $n$.

permutation is an array where each integer from $1$ to $s$ (where $s$ is the size of permutation) occurs exactly once. For example, $\left[2,1,4,3\right]$ is a permutation of size $4$$\left[1,2,4,5,3\right]$ is a permutation of size $5$$\left[1,4,3\right]$ is not a permutation (the integer $2$ is absent), $\left[2,1,3,1\right]$ is not a permutation (the integer $1$ appears twice).

subsegment of a permutation is a contiguous subsequence of that permutation. For example, the permutation $\left[2,1,4,3\right]$ has $10$ subsegments: $\left[2\right]$$\left[2,1\right]$$\left[2,1,4\right]$$\left[2,1,4,3\right]$$\left[1\right]$$\left[1,4\right]$$\left[1,4,3\right]$$\left[4\right]$$\left[4,3\right]$ and $\left[3\right]$.

The value of the permutation is the number of its subsegments which are also permutations. For example, the value of $\left[2,1,4,3\right]$ is $3$ since the subsegments $\left[2,1\right]$$\left[1\right]$ and $\left[2,1,4,3\right]$ are permutations.

You have to construct a permutation of size $n$ with minimum possible value among all permutations of size $n$.

Input

The first line contains one integer $t$ ($1\le t\le 48$) — the number of test cases.

Then, $t$ lines follow. The $i$-th of them contains one integer $n$ ($3\le n\le 50$) representing the $i$-th test case.

Output

For each test case, print $n$ integers — the permutation of size $n$ with minimum possible value. If there are

Solution Click Below:-  👉
👇👇👇👇👇

multiple such permutations, print any of them.

Note

In the first example, the permutation $\left[1,4,3,5,2\right]$ is one of the possible answers; its value is $2$.

In the second example, the permutation $\left[4,1,6,2,5,3\right]$ is one of the possible answers; its value is $2$.