#include <iostream>
using namespace std;
int main() {
int t;
cin >> t;
while(t--){
int n;
cin >> n;
int ara[n];
for(int i=0; i<n; i++)ara[i] = i+1;
if(n%2 == 0){
for(int i=0; i<n; i+=2){
int temp = ara[i+1];
ara[i+1] = ara[i];
ara[i] = temp;
}
}
else{
for(int i=1; i<n-1; i+=2){
int temp = ara[i+1];
ara[i+1] = ara[i];
ara[i] = temp;
}
}
for(int i=0; i<n; i++)cout << ara[i] << " ";
cout << endl;
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSB7CglpbnQgdDsKCWNpbiA+PiB0OwoJd2hpbGUodC0tKXsKCQlpbnQgbjsKCQljaW4gPj4gbjsKCQlpbnQgYXJhW25dOwoJCWZvcihpbnQgaT0wOyBpPG47IGkrKylhcmFbaV0gPSBpKzE7CgkJaWYobiUyID09IDApewoJCQlmb3IoaW50IGk9MDsgaTxuOyBpKz0yKXsKCQkJCWludCB0ZW1wID0gYXJhW2krMV07CgkJCQlhcmFbaSsxXSA9IGFyYVtpXTsKCQkJCWFyYVtpXSA9IHRlbXA7CgkJCX0KCQl9CgkJZWxzZXsKCQkJZm9yKGludCBpPTE7IGk8bi0xOyBpKz0yKXsKCQkJCWludCB0ZW1wID0gYXJhW2krMV07CgkJCQlhcmFbaSsxXSA9IGFyYVtpXTsKCQkJCWFyYVtpXSA9IHRlbXA7CgkJCX0KCQl9CgkJCgkJZm9yKGludCBpPTA7IGk8bjsgaSsrKWNvdXQgPDwgYXJhW2ldIDw8ICIgIjsKCQljb3V0IDw8IGVuZGw7Cgl9CglyZXR1cm4gMDsKfQ==