#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pii;
#define flash ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define pb push_back
#define MP make_pair
#define F first
#define S second
int main() {
flash;
int t; cin>>t;
while(t--){
ll n,k; cin>>n>>k;
ll i,j,x,y,z,N;
ll a[n]; for(i=0;i<n;i++){cin>>a[i];}
N = 2*k+1;
ll b[N+1]; //elements to be replaced
for(i=0;i<=N;i++){ b[i] = 0; }
for(i=0;i<n/2;i++){
x = min(a[i],a[n-i-1]);
y = max(a[i],a[n-i-1]);
z = a[i] + a[n-i-1];
b[0] += 2;
b[x+1] -= 1;
b[z] -= 1;
b[z+1] += 1;
b[k+y+1] += 1;
}
ll sum=0 , ans=n+1;
for(i=0;i<=N;i++){
sum += b[i];
ans = min(ans,sum);
}
cout<<ans<<endl;
}
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CnR5cGVkZWYgbG9uZyBsb25nIGludCBsbDsKdHlwZWRlZiBsb25nIGRvdWJsZSBsZDsKdHlwZWRlZiB2ZWN0b3I8aW50PiB2aTsKdHlwZWRlZiBwYWlyPGludCxpbnQ+IHBpaTsKI2RlZmluZSBmbGFzaCBpb3NfYmFzZTo6c3luY193aXRoX3N0ZGlvKGZhbHNlKTtjaW4udGllKE5VTEwpO2NvdXQudGllKE5VTEwpCiNkZWZpbmUgcGIgcHVzaF9iYWNrCiNkZWZpbmUgTVAgbWFrZV9wYWlyCiNkZWZpbmUgRiBmaXJzdAojZGVmaW5lIFMgc2Vjb25kCgppbnQgbWFpbigpIHsKZmxhc2g7CgoKaW50IHQ7IGNpbj4+dDsKd2hpbGUodC0tKXsKCiAgICBsbCBuLGs7IGNpbj4+bj4+azsKICAgIGxsIGksaix4LHkseixOOwogICAgCiAgICBsbCBhW25dOyBmb3IoaT0wO2k8bjtpKyspe2Npbj4+YVtp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