#K36432. Swap Adjacent IDs

    ID: 25753 Type: Default 1000ms 256MiB

Swap Adjacent IDs

Swap Adjacent IDs

You are given several test cases. In each test case, there is a single integer \( n \) that represents the number of people in a queue with IDs from 1 to \( n \) in increasing order. Your task is to swap every pair of adjacent IDs.

More formally, for each test case generate an array \( A = [1, 2, \dots, n] \). Then, for every odd index \( i \) (using 1-indexing), swap \( A[i] \) and \( A[i+1] \) if \( i+1 \leq n \). In LaTeX, the swapping operation for \( i = 1, 3, \dots \) is given by:

[ A[i],; A[i+1] = A[i+1],; A[i] ]

Output the modified list for each test case on separate lines. Each number must be separated by a space.

inputFormat

The first line contains an integer \( T \) representing the number of test cases. Each of the next \( T \) lines contains a single integer \( n \) describing the number of people in that test case.

Example:

3
2
3
4

outputFormat

For each test case, output one line with the rearranged order of IDs after swapping adjacent IDs. The IDs in each line should be separated by single spaces.

Example:

2 1
2 1 3
2 1 4 3
## sample
3
2
3
4
2 1

2 1 3 2 1 4 3

</p>