#include<bits/stdc++.h>
using namespace std;
int main(){
int t; cin>>t;
while(t--){
int n,k; cin>>n>>k;
int arr[200005];
for(int i=0; i<n; ++i){
cin>>arr[i];
}
int preSum[400005];
for(int i=0; i<200005; ++i){
preSum[i] = 0;
}
for(int i=0;i<(n/2); ++i){
int mn = min(arr[i], arr[n-i-1]);
int mx = max(arr[i], arr[n-i-1]);
int valMin = mn+1;
int valMax = min(k*2, mx+k);
preSum[valMin]+= 1;
preSum[valMax]+= -1;
}
for(int i=1; i<400001; ++i){
preSum[i] = preSum[i] + preSum[i-1];
}
for(int i=0; i<(n/2); ++i){
preSum[arr[i]+arr[n-1-i]]+=1;
}
int mx = -1;
for(int i=1; i<=2*k; ++i){
mx = max(mx, preSum[i]);
}
cout<<(n-mx)<<"\n";
}
return 0;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KCnVzaW5nIG5hbWVzcGFjZSBzdGQ7CmludCBtYWluKCl7CiAgICBpbnQgdDsgY2luPj50OwogICAgd2hpbGUodC0tKXsKICAgICAgICBpbnQgbixrOyBjaW4+Pm4+Pms7CiAgICAgICAgaW50IGFyclsyMDAwMDVdOwogICAgICAgIGZvcihpbnQgaT0wOyBpPG47ICsraSl7CiAgICAgICAgICAgIGNpbj4+YXJyW2ldOwogICAgICAgIH0KICAgICAgICBpbnQgcHJlU3VtWzQwMDAwNV07CiAgICAgICAgZm9yKGludCBpPTA7IGk8MjAwMDA1OyArK2kpewogICAgICAgICAgICBwcmVTdW1baV0gPSAwOwogICAgICAgIH0KICAgICAgICBmb3IoaW50IGk9MDtpPChuLzIpOyArK2kpewogICAgICAgICAgICBpbnQgbW4gPSBtaW4oYXJyW2ldLCBhcnJbbi1pLTFdKTsKICAgICAgICAgICAgaW50IG14ID0gbWF4KGFycltpXSwgYXJyW24taS0xXSk7CiAgICAgICAgICAgIAogICAgICAgICAgICBpbnQgdmFsTWluID0gbW4rMTsKICAgICAgICAgICAgaW50IHZhbE1heCA9IG1pbihrKjIsIG14K2spOwoKICAgICAgICAgICAgcHJlU3VtW3ZhbE1pbl0rPSAxOwogICAgICAgICAgICBwcmVTdW1bdmFsTWF4XSs9IC0xOwogICAgICAgIH0KICAgICAgICBmb3IoaW50IGk9MTsgaTw0MDAwMDE7ICsraSl7CiAgICAgICAgICAgIHByZVN1bVtpXSA9IHByZVN1bVtpXSArIHByZVN1bVtpLTFdOwogICAgICAgIH0KICAgICAgICBmb3IoaW50IGk9MDsgaTwobi8yKTsgKytpKXsKICAgICAgICAgICAgcHJlU3VtW2FycltpXSthcnJbbi0xLWldXSs9MTsKICAgICAgICB9CiAgICAgICAgaW50IG14ID0gLTE7CiAgICAgICAgZm9yKGludCBpPTE7IGk8PTIqazsgKytpKXsKICAgICAgICAgICAgbXggPSBtYXgobXgsIHByZVN1bVtpXSk7CiAgICAgICAgfQogICAgICAgIGNvdXQ8PChuLW14KTw8IlxuIjsKICAgIH0KICAgIHJldHVybiAwOwp9