A permutation of n elements is a bijection π:{1,2,…,n}→{1,2,…,n}.
The order of a permutation π is the smallest integer k≥1 such that applying π to every element k times returns each element to itself:
k timesπ(π(⋯π(i)⋯))=ifor all i=1,2,…,n,
that is, π composed with itself k times is the identity. For example, for n=3 the permutation π(1)=3, π(2)=2, π(3)=1 has order 2, because π(π(i))=i for every i.
For a given n, consider the permutations of n elements whose order is as large as possible. For instance, the maximal order over all permutations of 5 elements is 6; one permutation of 5 elements with order 6 is π(1)=4, π(2)=5, π(3)=2, π(4)=1, π(5)=3.
Among all permutations of n elements that attain this maximal order, we want the lexicographically smallest one. Formally, a permutation π is earlier than a permutation σ if there is an index i with π(j)=σ(j) for all j<i and π(i)<σ(i). For n=5, the lexicographically smallest permutation of order 6 is π(1)=2, π(2)=1, π(3)=4, π(4)=5, π(5)=3.
Write a program that reads several values n1,n2,…,nd and, for each ni, outputs the lexicographically smallest permutation of ni elements whose order is maximal.
The first line contains a single integer d (1≤d≤10). Each of the next d lines contains one integer ni (1≤ni≤10000).
Print d lines. The i-th line must contain the sequence π(1),π(2),…,π(ni) — the lexicographically smallest permutation of ni elements whose order is maximal — with the numbers separated by single spaces.