#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int rin();
int main() {
  int T = rin(), n;
  while (T--) {
    n = rin();
    if (n & 1) {
      for (int i = 0, j = 2; i < ((n - 3) >> 1); i++, j += 2)
        printf("%d %d ", j, j - 1);
      printf("%d %d %d", n - 1, n, n - 2);
    } else
      for (int i = 0, j = 2; i < (n >> 1); i++, j += 2)
        printf("%d %d ", j, j - 1);
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <rin@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     123d <main+0x11d>
mov    $0x0,%al
call   1040 <rin@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     11d8 <main+0xb8>
movl   $0x0,-0x10(%rbp)
movl   $0x2,-0x14(%rbp)
mov    -0x10(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x3,%ecx
sar    $0x1,%ecx
cmp    %ecx,%eax
jge    11b6 <main+0x96>
mov    -0x14(%rbp),%esi
mov    -0x14(%rbp),%edx
sub    $0x1,%edx
lea    0xe68(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x14(%rbp)
jmp    1174 <main+0x54>
mov    -0xc(%rbp),%esi
sub    $0x1,%esi
mov    -0xc(%rbp),%edx
mov    -0xc(%rbp),%ecx
sub    $0x2,%ecx
lea    0xe3b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    122a <main+0x10a>
movl   $0x0,-0x18(%rbp)
movl   $0x2,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
mov    -0xc(%rbp),%ecx
sar    $0x1,%ecx
cmp    %ecx,%eax
jge    1225 <main+0x105>
mov    -0x1c(%rbp),%esi
mov    -0x1c(%rbp),%edx
sub    $0x1,%edx
lea    0xdf9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x1c(%rbp)
jmp    11e6 <main+0xc6>
jmp    122a <main+0x10a>
lea    0xddf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1139 <main+0x19>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
xor    %eax,%eax
call   1050 <rin@plt>
test   %eax,%eax
je     120c <main+0xdc>
mov    %eax,%r15d
lea    0xeac(%rip),%r12
lea    0xeac(%rip),%r14
jmp    118a <main+0x5a>
nopl   (%rax)
lea    -0x1(%r13),%esi
mov    %r13d,%ecx
add    $0xfffffffe,%ecx
mov    %r14,%rdi
mov    %r13d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
test   %r15d,%r15d
je     120c <main+0xdc>
add    $0xffffffff,%r15d
xor    %eax,%eax
call   1050 <rin@plt>
mov    %eax,%r13d
test   $0x1,%r13b
jne    11d0 <main+0xa0>
cmp    $0x2,%r13d
jl     1177 <main+0x47>
shr    %r13d
mov    $0x2,%ebx
nopl   0x0(%rax)
lea    -0x1(%rbx),%edx
mov    %r12,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x2,%ebx
add    $0xffffffff,%r13d
jne    11b0 <main+0x80>
jmp    1177 <main+0x47>
nopw   0x0(%rax,%rax,1)
cmp    $0x5,%r13d
jl     1160 <main+0x30>
lea    -0x3(%r13),%ebp
shr    %ebp
mov    $0x2,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    -0x1(%rbx),%edx
mov    %r12,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x2,%ebx
add    $0xffffffff,%ebp
jne    11f0 <main+0xc0>
jmp    1160 <main+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%d %d \00"
@.str.1 = [9 x i8] c"%d %d %d\00"
@.str.2 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
%8 = call i32 (...) @rin()
store i32 %8, i32* %2
br label %9
9: ; preds = %59, %0
%10 = load i32, i32* %2
%11 = add nsw i32 %10, -1
store i32 %11, i32* %2
%12 = icmp ne i32 %10, 0
br i1 %12, label %13, label %61
13: ; preds = %9
%14 = call i32 (...) @rin()
store i32 %14, i32* %3
%15 = load i32, i32* %3
%16 = and i32 %15, 1
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %42
18: ; preds = %13
store i32 0, i32* %4
store i32 2, i32* %5
br label %19
19: ; preds = %30, %18
%20 = load i32, i32* %4
%21 = load i32, i32* %3
%22 = sub nsw i32 %21, 3
%23 = ashr i32 %22, 1
%24 = icmp slt i32 %20, %23
br i1 %24, label %25, label %35
25: ; preds = %19
%26 = load i32, i32* %5
%27 = load i32, i32* %5
%28 = sub nsw i32 %27, 1
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %26, i32 %28)
br label %30
30: ; preds = %25
%31 = load i32, i32* %4
%32 = add nsw i32 %31, 1
store i32 %32, i32* %4
%33 = load i32, i32* %5
%34 = add nsw i32 %33, 2
store i32 %34, i32* %5
br label %19
35: ; preds = %19
%36 = load i32, i32* %3
%37 = sub nsw i32 %36, 1
%38 = load i32, i32* %3
%39 = load i32, i32* %3
%40 = sub nsw i32 %39, 2
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %37, i32 %38, i32 %40)
br label %59
42: ; preds = %13
store i32 0, i32* %6
store i32 2, i32* %7
br label %43
43: ; preds = %53, %42
%44 = load i32, i32* %6
%45 = load i32, i32* %3
%46 = ashr i32 %45, 1
%47 = icmp slt i32 %44, %46
br i1 %47, label %48, label %58
48: ; preds = %43
%49 = load i32, i32* %7
%50 = load i32, i32* %7
%51 = sub nsw i32 %50, 1
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %49, i32 %51)
br label %53
53: ; preds = %48
%54 = load i32, i32* %6
%55 = add nsw i32 %54, 1
store i32 %55, i32* %6
%56 = load i32, i32* %7
%57 = add nsw i32 %56, 2
store i32 %57, i32* %7
br label %43
58: ; preds = %43
br label %59
59: ; preds = %58, %35
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %9
61: ; preds = %9
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"%d %d \00"
@.str.1 = [9 x i8] c"%d %d %d\00"
define i32 @main() {
%1 = tail call i32 (...) @rin()
%2 = icmp eq i32 %1, 0
br i1 %2, label %41, label %3
3: ; preds = %0, %38
%4 = phi i32 [ %5, %38 ], [ %1, %0 ]
%5 = add nsw i32 %4, -1
%6 = tail call i32 (...) @rin()
%7 = and i32 %6, 1
%8 = icmp eq i32 %7, 0
br i1 %8, label %14, label %9
9: ; preds = %3
%10 = icmp sgt i32 %6, 4
br i1 %10, label %11, label %18
11: ; preds = %9
%12 = add nsw i32 %6, -3
%13 = lshr i32 %12, 1
br label %22
14: ; preds = %3
%15 = icmp sgt i32 %6, 1
br i1 %15, label %16, label %38
16: ; preds = %14
%17 = lshr i32 %6, 1
br label %30
18: ; preds = %22, %9
%19 = add nsw i32 %6, -1
%20 = add nsw i32 %6, -2
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %19, i32 %6, i32 %20)
br label %38
22: ; preds = %11, %22
%23 = phi i32 [ %28, %22 ], [ 2, %11 ]
%24 = phi i32 [ %27, %22 ], [ 0, %11 ]
%25 = add nsw i32 %23, -1
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %23, i32 %25)
%27 = add nuw nsw i32 %24, 1
%28 = add nuw nsw i32 %23, 2
%29 = icmp eq i32 %27, %13
br i1 %29, label %18, label %22
30: ; preds = %16, %30
%31 = phi i32 [ %36, %30 ], [ 2, %16 ]
%32 = phi i32 [ %35, %30 ], [ 0, %16 ]
%33 = add nsw i32 %31, -1
%34 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %31, i32 %33)
%35 = add nuw nsw i32 %32, 1
%36 = add nuw nsw i32 %31, 2
%37 = icmp eq i32 %35, %17
br i1 %37, label %38, label %30
38: ; preds = %30, %14, %18
%39 = tail call i32 @putchar(i32 10)
%40 = icmp eq i32 %5, 0
br i1 %40, label %41, label %3
41: ; preds = %38, %0
ret i32 0
}