F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Permutation

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)
Total Submission(s): 3417    Accepted Submission(s): 2245
Special Judge


Problem Description
A permutation $p_1, p_2, ... , p_n$ of $1, 2, ..., n$ is called a lucky permutation if and only if $p_i \equiv 0 \pmod{|p_i - p_{i - 2}|} $ for $i = 3 ... n$.

Now you need to construct a lucky permutation with a given $n$.
 

Input
The first line is the number of test cases.

For each test case, one single line contains a positive integer $n(3 \leq n \leq 10^5)$.
 

Output
For each test case, output a single line with $n$ numbers $p_1 , p_2, ..., p_n$.

It is guaranteed that there exists at least one solution. And if there are different solutions, print any one of them.
 

Sample Input
1 6
 

Sample Output
1 3 2 6 4 5
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-04-26 00:11:23, Gzip enabled