# include <iostream>
# include <algorithm>
# include <cstring>
# include <math.h>
# include <stdio.h>
# include <vector>
# include <map>
using namespace std;
# define ll long long
const int maxn = 1e6+10;
int a[maxn];
int d[maxn];
int c[maxn];
void add(int l, int r, int  num){

	if(l > r)
		return;
	d[l] += num;
	d[r+1] -= num;

}
int main(){

	int t;
	cin >> t;
	while(t--){
		memset(d,0,sizeof(d));
		int n,k;
		cin >> n >> k;
		for(int i = 1; i <= n; i++){
			cin >> a[i];
		}
		for(int i = 1; i <= n/2; i++){
			int min1 = min(a[i] , a[n-i+1]);
			int max1 = max(a[i] , a[n-i+1]);
			add(min1+1, max1+k, 1);//һ���ӻ��߼�
			add(max1+k+1, 2*k, 2);//����������
			add(max1+min1, max1+min1, -1);
			add(1, min1, 2);
		}
		int ans = 0x3f3f3f3f;
		for(int i = 1; i <= 2*k; i++){
			c[i] = c[i-1] + d[i];
			ans = min(ans,c[i]);
		}
		cout << ans << endl;
	}
	return 0;
}


# include <iostream>
# include <algorithm>
# include <cstring>
# include <math.h>
# include <stdio.h>
# include <vector>
# include <map>
using namespace std;
# define ll long long
const int maxn = 1e6+10;
int a[maxn];
int d[maxn];
int c[maxn];
void add(int l, int r, int  num){

	if(l > r)
		return;
	d[l] += num;
	d[r+1] -= num;

}
int main(){

	int t;
	cin >> t;
	while(t--){
		memset(d,0,sizeof(d));
		int n,k;
		cin >> n >> k;
		for(int i = 1; i <= n; i++){
			cin >> a[i];
		}
		for(int i = 1; i <= n/2; i++){
			int min1 = min(a[i] , a[n-i+1]);
			int max1 = max(a[i] , a[n-i+1]);
			add(min1+1, max1+k, 1);//һ���ӻ��߼�
			add(max1+k+1, 2*k, 2);//����������
			add(max1+min1, max1+min1, -1);
			add(1, min1, 2);
		}
		int ans = 0x3f3f3f3f;
		cout << ans << endl;
		for(int i = 1; i <= 2*k; i++){
			c[i] = c[i-1] + d[i];
			ans = min(ans,c[i]);
		}
		cout << ans << endl;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int N = 4e5 + 40;
int a[N];int d[N];int c[N];
void add(int L, int R, int val){
   if (L > R)        return ;
     c[L] += val;    c[R + 1] -= val;}
	 int main(){
	 #ifdef LOCAL	freopen("E:/input.txt", "r", stdin);
	 #endif
	int t;    cin >> t;
	while (t--)    {
	int n, k;
	cin >> n >> k;
	memset(c, 0, sizeof c[0] * (2 * k + 10));
	for (int i = 1; i <= n; i++)
	cin >> a[i];
	for (int i = 1; i <= n / 2; i++)
	{
	int mi = min(a[i], a[n - i + 1]);
	int mx = max(a[i], a[n - i + 1]);
	add(mi + 1, mx + k, 1);
	//�����������ֵĺͱ�������������֣�ֻ��Ҫ�ı�mi
	add(mx + k + 1, 2 * k, 2); // ������������䣬�϶��������ֶ�Ҫ��
	add(mi + mx, mi + mx, -1);  // ��ǰ������ֲ��ñ仯�����Եõ�����ôȥ��һ�����ۣ���Ϊ֮ǰ����
	add(1, mi, 2); //�������ֶ���Ҫ���С��mi�ģ�����Ϊ2
	}        int ans = 0x3f3f3f3f;
	 for (int i = 1; i <= 2 * k; i++)
	 d[i] = d[i - 1] + c[i], ans = min(ans, d[i]);
	 cout << ans << endl;
}	return 0;}


# include <iostream>
# include <algorithm>
# include <cstring>
# include <math.h>
# include <stdio.h>
# include <vector>
# include <map>
using namespace std;
# define ll long long
const int maxn = 5e5+10;
int a[maxn];
int d[maxn];
int c[maxn];
void add(int l, int r, int  num){
	if(l > r)
		return;
	else{
		d[l] += num;
		d[r+1] -= num;
	}

}
int main(){

	int t;
	cin >> t;
	while(t--){
		memset(d,0,sizeof(d));
		int n,k;
		cin >> n >> k;
		for(int i = 1; i <= n; i++){
			cin >> a[i];
		}
		for(int i = 1; i <= n/2; i++){
			int min1 = min(a[i] , a[n-i+1]);
			int max1 = max(a[i] , a[n-i+1]);
			add(min1+1, max1+k, 1);//һ���ӻ��߼�
			add(max1+k+1, 2*k, 2);//����������
			add(max1+min1, max1+min1, -1);
			add(1, min1, 2);
		}
		int ans = 0x3f;
		for(int i = 1; i <= 2*k; i++){
			c[i] = c[i-1] + d[i];
			ans = min(ans,c[i]);
		}
		cout << ans << endl;
	}
	return 0;
}


# include <iostream>
# include <algorithm>
# include <cstring>
# include <math.h>
# include <stdio.h>
# include <vector>
# include <map>
using namespace std;
# define ll long long
const int maxn = 1e6+10;
int a[maxn];
int d[maxn];
int c[maxn];
void add(int l, int r, int  num){

	if(l > r)
		return;
	d[l] += num;
	d[r+1] -= num;

}
int main(){

	int t;
	cin >> t;
	while(t--){
		memset(d,0,sizeof(d));
		int n,k;
		cin >> n >> k;
		for(int i = 1; i <= n; i++){
			cin >> a[i];
		}
		for(int i = 1; i <= n/2; i++){
			int min1 = min(a[i] , a[n-i+1]);
			int max1 = max(a[i] , a[n-i+1]);
			add(min1+1, max1+k, 1);//һ���ӻ��߼�
			add(max1+k+1, 2*k, 2);//����������
			add(max1+min1, max1+min1, -1);
			add(1, min1, 2);
		}
		int ans = 0x3f3f3f3f;
		//cout << ans << endl;
		for(int i = 1; i <= 2*k; i++){
			c[i] = c[i-1] + d[i];
			ans = min(ans,c[i]);
		}
		cout << ans << endl;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int N = 4e5 + 40;
int a[N];int d[N];int c[N];
void add(int L, int R, int val){
   if (L > R)        return ;
     c[L] += val;    c[R + 1] -= val;}
	 int main(){
		int t;    cin >> t;
		while (t--)    {
	int n, k;
	cin >> n >> k;
	memset(c, 0, sizeof c[0] * (2 * k + 10));
	for (int i = 1; i <= n; i++)
	cin >> a[i];
	for (int i = 1; i <= n / 2; i++)
	{
	int mi = min(a[i], a[n - i + 1]);
	int mx = max(a[i], a[n - i + 1]);
	add(mi + 1, mx + k, 1);
	//�����������ֵĺͱ�������������֣�ֻ��Ҫ�ı�mi
	add(mx + k + 1, 2 * k, 2); // ������������䣬�϶��������ֶ�Ҫ��
	add(mi + mx, mi + mx, -1);  // ��ǰ������ֲ��ñ仯�����Եõ�����ôȥ��һ�����ۣ���Ϊ֮ǰ����
	add(1, mi, 2); //�������ֶ���Ҫ���С��mi�ģ�����Ϊ2
	}        int ans = 0x3f3f3f3f;
	 for (int i = 1; i <= 2 * k; i++)
	 d[i] = d[i - 1] + c[i], ans = min(ans, d[i]);
	 cout << ans << endl;
}	return 0;}


# include <iostream>
# include <algorithm>
# include <cstring>
# include <math.h>
# include <stdio.h>
# include <vector>
# include <map>
using namespace std;
# define ll long long
const int maxn = 1e6+10;
int a[maxn];
int d[maxn];
int c[maxn];
const int INF = 1e9;
void add(int l,int r,int tol){
	if(l > r)
		return;
	else{
		d[l] += tol;
		d[r+1] -= tol;
	}
}
int main(){

	int t;
	cin >> t;
	while(t--){
		memset(d,0,sizeof(d));
		int n,k;
		cin >> n >> k;
		for(int i = 1; i <= n; i++){
			cin >> a[i];
		}
		for(int i = 1; i <= n / 2; i++){
			int min1 = min(a[i],a[n-i+1]);
			int max1 = max(a[i],a[n-i+1]);
			add(min1 + 1,max1+k ,1);
			add(max1 + k + 1,2 * k,2);
			add(min1+max1,min1+max1,-1);
			add(1,min1,2);
		}
		int ans = INF;
		for(int i = 1; i <= 2*k; i++){
			c[i] = c[i-1] + d[i];
			//cout << c[i] << " ";
			ans = min(ans,c[i]);
		}
		cout << ans << endl;
	}

}


# include <iostream>
# include <algorithm>
# include <cstring>
# include <math.h>
# include <stdio.h>
# include <vector>
# include <map>
using namespace std;
# define ll long long
const int maxn = 5e5+10;
int a[maxn];
int d[maxn];
int c[maxn];
const int INF = 1e9;
void add(int l,int r,int tol){//�����Ĳ������
	if(l > r)
		return;
	else{
		d[l] += tol;
		d[r+1] -= tol;
	}
}
int main(){

	int t;
	cin >> t;
	while(t--){
		memset(d,0,sizeof(d));
		int n,k;
		cin >> n >> k;
		for(int i = 1; i <= n; i++){
			cin >> a[i];
		}
		for(int i = 1; i <= n / 2; i++){
			int min1 = min(a[i],a[n-i+1]);
			int max1 = max(a[i],a[n-i+1]);
			add(min1 + 1,max1+k ,1);//������Ϊ1
			add(max1 + k + 1,2 * k,2);
			add(min1+max1,min1+max1,-1);
			add(1,min1,2);
		}
		int ans = INF;
		for(int i = 1; i <= 2*k; i++){
			c[i] = c[i-1] + d[i];//�������������Ҫ����С������
			//cout << c[i] << " ";
			ans = min(ans,c[i]);
		}
		cout << ans << endl;
	}

}


# include <iostream>
# include <algorithm>
# include <cstring>
# include <math.h>
# include <stdio.h>
# include <vector>
# include <map>
using namespace std;
# define ll long long
const int maxn = 5e5+10;
int a[maxn];
int d[maxn];
int c[maxn];
const int INF = 1e9;
void add(int l,int r,int tol){
	if(l > r)
		return;
	else{
		d[l] += tol;
		d[r+1] -= tol;
	}
}
int main(){

	int t;
	cin >> t;
	while(t--){
		memset(d,0,sizeof(d));
		int n,k;
		cin >> n >> k;
		for(int i = 1; i <= n; i++){
			cin >> a[i];
		}
		for(int i = 1; i <= n / 2; i++){
			int min1 = min(a[i],a[n-i+1]);
			int max1 = max(a[i],a[n-i+1]);
			add(min1 + 1,max1+k ,1);
			add(max1 + k + 1,2 * k,2);
			add(min1+max1,min1+max1,-1);
			add(1,min1,2);
		}
		int ans = INF;
		for(int i = 1; i <= 2*k; i++){
			c[i] = c[i-1] + d[i];
			//cout << c[i] << " ";
			ans = min(ans,c[i]);
		}
		cout << ans << endl;
	}

}


#include <iostream>
#include <string.h>
#include <algorithm>

using namespace std;

int main(void)
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
	int caseN;
	cin >> caseN;

	while (caseN--)
	{
		int n, k;
		int num[200001];
		int Arr[400001];
		cin >> n >> k;
		int lo, hi, ostart, oend;
		int res = 2e9;
		memset(Arr, 0, sizeof(Arr));

		for (int i = 0; i < n; ++i)
		{
			cin >> num[i];
		}

		for (int i = 0; i < n / 2; ++i)
		{
			lo = min(num[i], num[n - i - 1]);
			hi = max(num[i], num[n - i - 1]);

			ostart = lo + 1;
			oend = k + hi;

			for (int t = ostart; t <= oend; ++t)
			{
				if (t != num[i] + num[n - i - 1])
				{
					Arr[t]++;
				}
			}

			for (int t = 2; t < ostart; ++t)
			{
				Arr[t] += 2;
			}

			for (int t = oend + 1; t <= 2 * k; ++t)
			{
				Arr[t] += 2;
			}
		}

		for (int i = 2; i <= 2 * k; ++i)
		{
			res = min(res, Arr[i]);
		}

		cout << res << '\n';
	}
}


#include <iostream>
#include <string.h>
#include <algorithm>

using namespace std;

int main(void)
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
	int caseN;
	cin >> caseN;

	while (caseN--)
	{
		int n, k;
		int num[200001];
		int Arr[400001];
		cin >> n >> k;
		int lo, hi, ostart, oend;
		int res = 2e9;
		memset(Arr, 0, sizeof(Arr));

		for (int i = 0; i < n; ++i)
		{
			cin >> num[i];
		}

		for (int i = 0; i < n / 2; ++i)
		{
			lo = min(num[i], num[n - i - 1]);
			hi = max(num[i], num[n - i - 1]);

			ostart = lo + 1;
			oend = k + hi;

			for (int t = ostart; t <= oend; ++t)
			{
				if (t != num[i] + num[n - i - 1])
				{
					Arr[t]--;
				}
			}

		}

		for (int i = 2; i <= 2 * k; ++i)
		{
			res = min(res, Arr[i]);
		}

		cout << res + (n/2)*2 << '\n';
	}
}


#include <iostream>
#include <string.h>
#include <algorithm>
#include <vector>

using namespace std;

int main(void)
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int caseN;
	cin >> caseN;

	while (caseN--)
	{
		int n, k;
		cin >> n >> k;
		vector<int> num(n);
		vector<int> Arr(2 * k+1);
        vector<int> cnt(2*k + 1);
		int lo, hi, ostart, oend;
		int res = 2e9;

		for (int i = 0; i < n; ++i)
		{
			cin >> num[i];
		}

        for(int i = 0; i < n/2; ++i)
        {
            ++cnt[num[i] + num[n-i-1]];
        }

		for (int i = 0; i < n / 2; ++i)
		{
			lo = min(num[i], num[n - i - 1]);
			hi = max(num[i], num[n - i - 1]);

			ostart = lo + 1;
			oend = k + hi;

            ++Arr[ostart];
            --Arr[oend+1];

		}

        for(int i = 1; i <= 2*k; ++i)
        {
            Arr[i] += Arr[i-1];
        }

		for (int i = 2; i <= 2 * k; ++i)
		{
			res = min(res, n - Arr[i] - cnt[i]);
		}

		cout << res<< '\n';
	}
}


#include <iostream>
#include <string.h>
#include <algorithm>
#include <vector>

using namespace std;

int main(void)
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int caseN;
	cin >> caseN;

	while (caseN--)
	{
		int n, k;
		cin >> n >> k;
		vector<int> num(n);
		vector<int> Arr(2 * k + 1,0);
		int lo, hi, ostart, oend;
		int res = 2e9;

		for (int i = 0; i < n; ++i)
		{
			cin >> num[i];
		}

		for (int i = 0; i < n / 2; ++i)
		{
			lo = min(num[i], num[n - i - 1]);
			hi = max(num[i], num[n - i - 1]);

			ostart = lo + 1;
			oend = k + hi;

			Arr[num[i] + num[n - i - 1]]--;

			for (int t = ostart; t <= oend; ++t)
			{
				Arr[t]--;
			}
		}

		for (int i = 2; i <= 2 * k; ++i)
		{
			res = min(res, Arr[i]);
		}

		cout << res + n << '\n';
	}
}


#include <iostream>
#include <string.h>
#include <algorithm>

using namespace std;

int main(void)
{
	int caseN;
	cin >> caseN;

	while (caseN--)
	{
		int n, k;
		int num[200001];
		int Arr[400001];
		cin >> n >> k;
		int lo, hi, ostart, oend;
		int res = 2e9;
		memset(Arr, 0, sizeof(Arr));

		for (int i = 0; i < n; ++i)
		{
			cin >> num[i];
		}

		for (int i = 0; i < n / 2; ++i)
		{
			lo = min(num[i], num[n - i - 1]);
			hi = max(num[i], num[n - i - 1]);

			ostart = lo + 1;
			oend = k + hi;

			for (int t = ostart; t <= oend; ++t)
			{
				if (t != num[i] + num[n - i - 1])
				{
					Arr[t]++;
				}
			}

			for (int t = 2; t < ostart; ++t)
			{
				Arr[t] += 2;
			}

			for (int t = oend + 1; t <= 2 * k; ++t)
			{
				Arr[t] += 2;
			}
		}

		for (int i = 2; i <= 2 * k; ++i)
		{
			res = min(res, Arr[i]);
		}

		cout << res << endl;
	}
}


#include <iostream>
#include <string.h>
#include <algorithm>

using namespace std;

int main(void)
{
	int caseN;
	cin >> caseN;

	while (caseN--)
	{
		int n, k;
		int num[200001];
		int Arr[200001];
		cin >> n >> k;
		int lo, hi, ostart, oend;
		int res = 2e9;
		memset(Arr, 0, sizeof(Arr));

		for (int i = 0; i < n; ++i)
		{
			cin >> num[i];
		}

		for (int i = 0; i < n / 2; ++i)
		{
			lo = min(num[i], num[n - i - 1]);
			hi = max(num[i], num[n - i - 1]);

			ostart = lo + 1;
			oend = k + hi;

			for (int t = ostart; t <= oend; ++t)
			{
				if (t != num[i] + num[n - i - 1])
				{
					Arr[t]++;
				}
			}

			for (int t = 2; t < ostart; ++t)
			{
				Arr[t] += 2;
			}

			for (int t = oend + 1; t <= 2 * k; ++t)
			{
				Arr[t] += 2;
			}
		}

		for (int i = 2; i <= 2 * k; ++i)
		{
			res = min(res, Arr[i]);
		}

		cout << res << endl;
	}
}


#include <iostream>
#include <string.h>
#include <algorithm>

using namespace std;

int main(void)
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
	int caseN;
	cin >> caseN;

	while (caseN--)
	{
		int n, k;
		int num[200001];
		int Arr[400001];
		cin >> n >> k;
		int lo, hi, ostart, oend;
		int res = 2e9;
		memset(Arr, 0, sizeof(Arr));

		for (int i = 0; i < n; ++i)
		{
			cin >> num[i];
		}

		for (int i = 0; i < n / 2; ++i)
		{
			lo = min(num[i], num[n - i - 1]);
			hi = max(num[i], num[n - i - 1]);

			ostart = lo + 1;
			oend = k + hi;

			for (int t = ostart; t <= oend; ++t)
			{
				if (t != num[i] + num[n - i - 1])
				{
					Arr[t]--;
				}
				else
				{
				    Arr[t] -= 2;
				}
			}

		}

		for (int i = 2; i <= 2 * k; ++i)
		{
			res = min(res, Arr[i]);
		}

		cout << res + (n/2)*2 << '\n';
	}
}


#include <iostream>
#include <string.h>
#include <algorithm>
#include <vector>

using namespace std;

int main(void)
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
	int caseN;
	cin >> caseN;

	while (caseN--)
	{
		int n, k;
		int num[200001];
		vector<int> Arr(400005,0);
		cin >> n >> k;
		int lo, hi, ostart, oend;
		int res = 2e9;
		for (int i = 0; i < n; ++i)
		{
			cin >> num[i];
		}

		for (int i = 0; i < n / 2; ++i)
		{
			lo = min(num[i], num[n - i - 1]);
			hi = max(num[i], num[n - i - 1]);

			ostart = lo + 1;
			oend = k + hi;

			for (int t = ostart; t <= oend; ++t)
			{
				if (t != num[i] + num[n - i - 1])
				{
					Arr[t]++;
				}
			}

			for (int t = 2; t < ostart; ++t)
			{
				Arr[t] += 2;
			}

			for (int t = oend + 1; t <= 2 * k; ++t)
			{
				Arr[t] += 2;
			}
		}

		for (int i = 2; i <= 2 * k; ++i)
		{
			res = min(res, Arr[i]);
		}

		cout << res << endl;
	}
}


#include <iostream>
#include <string.h>
#include <algorithm>

using namespace std;

int main(void)
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
	int caseN;
	cin >> caseN;

	while (caseN--)
	{
		int n, k;
		int num[200001];
		int Arr[400001];
		cin >> n >> k;
		int lo, hi, ostart, oend;
		int res = 2e9;
		memset(Arr, 0, sizeof(Arr));

		for (int i = 0; i < n; ++i)
		{
			cin >> num[i];
		}

		for (int i = 0; i < n / 2; ++i)
		{
			lo = min(num[i], num[n - i - 1]);
			hi = max(num[i], num[n - i - 1]);

			ostart = lo + 1;
			oend = k + hi;

			Arr[num[i]+num[n-i-1]]--;

			for (int t = ostart; t <= oend; ++t)
			{
					Arr[t]--;
			}
		}

		for (int i = 2; i <= 2 * k; ++i)
		{
			res = min(res, Arr[i]);
		}

		cout << res + (n/2)*2 << '\n';
	}
}


//__builtin_clz (x) Count the number of zeros at the beginning of the number x.
//__builtin_ctz (x) COunt the number of zeros at the end of the number
//__builtin_popcount (x): the number of ones in the number
//__builtin_parity ( x ): the parity (even or odd) of the number of ones  *(Odd-1, even-0)
//__builtin_clzll (x) :For long long add suggix ll
// C++ program to multiply two numbers represented
// as strings.
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> V;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define mod 1000000007
#define mod 1000000007 //998244353
#define rep(i,x,y) for(int i=x; i<y; i++)

int cost(int arr[],int x, int k,int n)
{
	int c=0;
	for(int i=0;i<n/2;i++)
	{
		if((arr[i]+arr[n-i-1])<x)
		{
			if(min(arr[i],arr[n-1-i])+(x-arr[i]-arr[n-i-1]) <=k)
			c+=1;
			else
			c+=2;
		}
		else if((arr[i]+arr[n-i-1])>x)
		{
			int temp = max(arr[i],arr[n-i-1])-(arr[i]+arr[n-i-1]-x);
			if(temp>=1&&temp<=k)
			c+=1;
			else
			c+=2;
		}

	}
	return c;
}

int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t;
    cin>>t;
    while(t--)
    {
		int n,k;
		cin>>n>>k;
		int arr[n];
		for(int i=0;i<n;i++)
		cin>>arr[i];
		int l=0,h=2*k+2;
		int ans=INT_MAX;
		while(l<h)
		{
			int mid=(l+h)/2;
			int c1 =cost(arr,mid,k,n);
			int c2 = cost(arr,mid-1,k,n);
			if(c1<=c2)
			{
				ans=min(c1,ans);
				l=mid+1;
			}
			else
			{
				ans=min(ans,c2);
			    h=mid;
			}
		}
		cout<<ans<<"\n";
	}
}


//__builtin_clz (x) Count the number of zeros at the beginning of the number x.
//__builtin_ctz (x) COunt the number of zeros at the end of the number
//__builtin_popcount (x): the number of ones in the number
//__builtin_parity ( x ): the parity (even or odd) of the number of ones  *(Odd-1, even-0)
//__builtin_clzll (x) :For long long add suggix ll
// C++ program to multiply two numbers represented
// as strings.
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> V;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define mod 1000000007
#define mod 1000000007 //998244353
#define rep(i,x,y) for(int i=x; i<y; i++)

int cost(int arr[],int x, int k,int n)
{
	int c=0;
	for(int i=0;i<n/2;i++)
	{
		if((arr[i]+arr[n-i-1])<x)
		{
			if(min(arr[i],arr[n-1-i])+(x-arr[i]-arr[n-i-1]) <=k)
			c+=1;
			else
			c+=2;
		}
		else if((arr[i]+arr[n-i-1])>x)
		{
			int temp = max(arr[i],arr[n-i-1])-(arr[i]+arr[n-i-1]-x);
			if(temp>=1&&temp<=k)
			c+=1;
			else
			c+=2;
		}

	}
	return c;
}

int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t;
    cin>>t;
    while(t--)
    {
		int n,k;
		cin>>n>>k;
		int arr[n];
		for(int i=0;i<n;i++)
		cin>>arr[i];
		int l=0,h=2*k+1;
		int ans=INT_MAX;
		while(l<h)
		{
			int mid=(l+h)/2;
			int c1 =cost(arr,mid,k,n);
			int c2 = cost(arr,mid-1,k,n);
			if(c1<=c2)
			{
				ans=min(c1,ans);
				l=mid+1;
			}
			else
			{
				ans=min(ans,c2);
			    h=mid;
			}
		}
		cout<<ans<<"\n";
	}
}


//__builtin_clz (x) Count the number of zeros at the beginning of the number x.
//__builtin_ctz (x) COunt the number of zeros at the end of the number
//__builtin_popcount (x): the number of ones in the number
//__builtin_parity ( x ): the parity (even or odd) of the number of ones  *(Odd-1, even-0)
//__builtin_clzll (x) :For long long add suggix ll
// C++ program to multiply two numbers represented
// as strings.
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> V;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define mod 1000000007
#define mod 1000000007 //998244353
#define rep(i,x,y) for(int i=x; i<y; i++)

int cost(int arr[],int x, int k,int n)
{
	int c=0;
	for(int i=0;i<n/2;i++)
	{
		if((arr[i]+arr[n-i-1])<x)
		{
			if(min(arr[i],arr[n-1-i])+(x-arr[i]-arr[n-i-1]) <=k)
			c+=1;
			else
			c+=2;
		}
		else if((arr[i]+arr[n-i-1])>x)
		{
			int temp = max(arr[i],arr[n-i-1])-(arr[i]+arr[n-i-1]-x);
			if(temp>=1&&temp<=k)
			c+=1;
			else
			c+=2;
		}

	}
	return c;
}

int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t;
    cin>>t;
    while(t--)
    {
		int n,k;
		cin>>n>>k;
		int arr[n];
		for(int i=0;i<n;i++)
		cin>>arr[i];
		int l=0,h=2*k+1;
		int ans=INT_MAX;
		while(l<h)
		{
			int mid=(l+h)/2;
			int c1 =cost(arr,mid,k,n);
			int c2 = cost(arr,mid-1,k,n);
			if(c1<=c2)
			{
				ans=c1;
				l=mid+1;
			}
			else
			{
			    h=mid;
			}
		}
		cout<<ans<<"\n";
	}
}


//__builtin_clz (x) Count the number of zeros at the beginning of the number x.
//__builtin_ctz (x) COunt the number of zeros at the end of the number
//__builtin_popcount (x): the number of ones in the number
//__builtin_parity ( x ): the parity (even or odd) of the number of ones  *(Odd-1, even-0)
//__builtin_clzll (x) :For long long add suggix ll
// C++ program to multiply two numbers represented
// as strings.
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> V;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define mod 1000000007
#define mod 1000000007 //998244353
#define rep(i,x,y) for(int i=x; i<y; i++)

int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t;
    cin>>t;
    while(t--)
    {
		int n,k;
		cin>>n>>k;
		ll arr[n];
		for(int i=0;i<n;i++)
		cin>>arr[i];
		vector<ll> count(2*k+2,0);
		for(int i=0;i<n/2;i++)
		{
			count[arr[i]+arr[n-i-1]]++;
		}
		vector<ll> diff(2*k+3,0);
		for(int i=0;i<n/2;i++)
		{
			ll mini = min(arr[i],arr[n-i-1])+1;
			ll maxi = max(arr[i],arr[n-i-1])+k;
			diff[mini]+=1;
			diff[maxi+1]-=1;
		}
		vector<ll> prefix(2*k+3,0);
		prefix[0]=diff[0];
		for(int i=1;i<2*k+3;i++)
		prefix[i]= prefix[i-1]+diff[i];

	    ll ans=INT_MAX;
	    for(int i=2;i<=2*k;i++)
	    {
			ll temp = prefix[i]-count[i]+(n/2-prefix[i])*2;
			ans = min(ans,temp);
		}
		cout<<ans<<"\n";

	}
}


//__builtin_clz (x) Count the number of zeros at the beginning of the number x.
//__builtin_ctz (x) COunt the number of zeros at the end of the number
//__builtin_popcount (x): the number of ones in the number
//__builtin_parity ( x ): the parity (even or odd) of the number of ones  *(Odd-1, even-0)
//__builtin_clzll (x) :For long long add suggix ll
// C++ program to multiply two numbers represented
// as strings.
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> V;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define mod 1000000007
#define mod 1000000007 //998244353
#define rep(i,x,y) for(int i=x; i<y; i++)

int cost(int arr[],int x, int k,int n)
{
	int c=0;
	for(int i=0;i<n/2;i++)
	{
		if((arr[i]+arr[n-i-1])<x)
		{
			if(min(arr[i],arr[n-1-i])+(x-arr[i]-arr[n-i-1]) <=k)
			c+=1;
			else
			c+=2;
		}
		else if((arr[i]+arr[n-i-1])>x)
		{
			int temp = max(arr[i],arr[n-i-1])-(arr[i]+arr[n-i-1]-x);
			if(temp>=1&&temp<=k)
			c+=1;
			else
			c+=2;
		}

	}
	return c;
}

int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t;
    cin>>t;
    while(t--)
    {
		int n,k;
		cin>>n>>k;
		int arr[n];
		for(int i=0;i<n;i++)
		cin>>arr[i];
		int l=1,h=2*k;
		int ans=0;
		while(l<h)
		{
			int mid=(l+h)/2;
			int c1 =cost(arr,mid,k,n);
			int c2 = cost(arr,mid-1,k,n);
			if(c1<=c2)
			{
				ans=c1;
				l=mid+1;
			}
			else
			h=mid;
		}
		cout<<ans<<"\n";
	}
}


//__builtin_clz (x) Count the number of zeros at the beginning of the number x.
//__builtin_ctz (x) COunt the number of zeros at the end of the number
//__builtin_popcount (x): the number of ones in the number
//__builtin_parity ( x ): the parity (even or odd) of the number of ones  *(Odd-1, even-0)
//__builtin_clzll (x) :For long long add suggix ll
// C++ program to multiply two numbers represented
// as strings.
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> V;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define mod 1000000007
#define mod 1000000007 //998244353
#define rep(i,x,y) for(int i=x; i<y; i++)

int cost(int arr[],int x, int k,int n)
{
	int c=0;
	for(int i=0;i<n/2;i++)
	{
		if((arr[i]+arr[n-i-1])<x)
		{
			if(min(arr[i],arr[n-1-i])+(x-arr[i]-arr[n-i-1]) <=k)
			c+=1;
			else
			c+=2;
		}
		else if((arr[i]+arr[n-i-1])>x)
		{
			int temp = max(arr[i],arr[n-i-1])-(arr[i]+arr[n-i-1]-x);
			if(temp>=1&&temp<=k)
			c+=1;
			else
			c+=2;
		}

	}
	return c;
}

int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t;
    cin>>t;
    while(t--)
    {
		int n,k;
		cin>>n>>k;
		int arr[n];
		for(int i=0;i<n;i++)
		cin>>arr[i];
		int l=0,h=2*k+1;
		int ans=INT_MAX;
		while(l<h)
		{
			int mid=(l+h)/2;
			int c1 =cost(arr,mid,k,n);
			int c2 = cost(arr,mid-1,k,n);
			if(c1<=c2)
			{
				ans=min(c1,ans);
				l=mid+1;
			}
			else
			{
			    h=mid;
			}
		}
		cout<<ans<<"\n";
	}
}


//__builtin_clz (x) Count the number of zeros at the beginning of the number x.
//__builtin_ctz (x) COunt the number of zeros at the end of the number
//__builtin_popcount (x): the number of ones in the number
//__builtin_parity ( x ): the parity (even or odd) of the number of ones  *(Odd-1, even-0)
//__builtin_clzll (x) :For long long add suggix ll
// C++ program to multiply two numbers represented
// as strings.
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> V;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define mod 1000000007
#define mod 1000000007 //998244353
#define rep(i,x,y) for(int i=x; i<y; i++)

int cost(int arr[],int x, int k,int n)
{
	int c=0;
	for(int i=0;i<n/2;i++)
	{
		if((arr[i]+arr[n-i-1])<x)
		{
			if(min(arr[i],arr[n-1-i])+(x-arr[i]-arr[n-i-1]) <=k)
			c+=1;
			else
			c+=2;
		}
		else if((arr[i]+arr[n-i-1])>x)
		{
			int temp = max(arr[i],arr[n-i-1])-(arr[i]+arr[n-i-1]-x);
			if(temp>=1&&temp<=k)
			c+=1;
			else
			c+=2;
		}

	}
	return c;
}

int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t;
    cin>>t;
    while(t--)
    {
		int n,k;
		cin>>n>>k;
		int arr[n];
		for(int i=0;i<n;i++)
		cin>>arr[i];
		int l=0,h=2*k+2;
		int ans=INT_MAX;
		while(l<h)
		{
			int mid=(l+h)/2;
			int c1 =cost(arr,mid,k,n);
			int c2 = cost(arr,mid-1,k,n);
			if(c1<c2)
			{
				ans=min(c1,ans);
				l=mid+1;
			}
			else
			{
				ans=min(ans,c2);
			    h=mid;
			}
		}
		cout<<ans<<"\n";
	}
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int

void solve(){
	int n,k;
	cin>>n>>k;

	int a[n];
	for(int i=0;i<n;i++){
		cin>>a[i];
	}

	vector<ll> v;
	for(int i=0;i<n/2;i++){
		v.push_back(a[i]+a[n-1-i]);
	}

	sort(v.begin(),v.end());

	int count=1,freq=0;
	vector<int> val;
	for(int i=0;i<v.size();i++){
		if(v[i]==v[i-1])
			count++;
		else{
			if(count>freq){
				freq=count;
				val.clear();
				val.push_back(v[i-1]);
			}
			if(count==freq){
				val.push_back(v[i-1]);
			}
			count=1;
		}
	}

	if(count>freq){
		val.clear();
		val.push_back(v[n/2-1]);
	}
	if(count==freq)
		val.push_back(v[n/2-1]);

	val.push_back(k+1);

	int ans=0,sum,finalans=-1;
	for(int i=0;i<val.size();i++){
		ans=0;int value=val[i];
		for(int i=0;i<n/2;i++){
			sum=a[i]+a[n-1-i];
			if(sum>value){
				if(sum-value<=a[i]-1 || sum-value<=a[n-1-i]-1)
					ans+=1;
				else
					ans+=2;
			}

			if(sum<value){
				if(value-sum<=k-a[i] || value-sum<=k-a[n-1-i])
					ans+=1;
				else
					ans+=2;
			}
		}
		if(ans<finalans || finalans ==-1)
			finalans=ans;
	}

	cout<<finalans<<endl;
}

int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);

	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif

	int t;cin>>t;

	while(t--){
		solve();
	}

}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int

void solve(){
	int n,k;
	cin>>n>>k;

	int a[n];
	for(int i=0;i<n;i++){
		cin>>a[i];
	}

	//sum we have already
	int val[2*k+1]={0};
	for(int i=0;i<n/2;i++){
		val[a[i]+a[n-1-i]]+=1;
	}

	int pos1[2*k+2]={0};
	for(int i=0;i<n/2;i++){
		int mi=min(a[i],a[n-1-i]);
		int ma=max(a[i],a[n-1-i]);

		pos1[mi+1]+=1;
		pos1[ma+k+1]-=1;
	}
	for(int i=1;i<2*k+1;i++){
		pos1[i]+=pos1[i-1];
		// cout<<pos1[i]<<endl;
	}

	int ans=0,final=1e9;
	for(int i=2;i<2*k+1;i++){
		ans = (pos1[i]-val[i]) + 2*(n/2 - pos1[i]);
		// cout<<i<<" "<<ans<<endl;
		if(ans<final) final=ans;
	}
	cout<<final<<endl;

}

int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);

	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif

	int t;cin>>t;

	while(t--){
		solve();
	}

}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int

void solve(){
	int n,k;
	cin>>n>>k;

	int a[n];
	for(int i=0;i<n;i++){
		cin>>a[i];
	}

	int ans=0,sum,finalans=-1;
	for(int j=2;j<2*k+1;j++){
		ans=0;int value=j;
		for(int i=0;i<n/2;i++){
			sum=a[i]+a[n-1-i];
			if(sum>value){//
				if(sum-value<=a[i]-1 || sum-value<=a[n-1-i]-1)
					ans+=1;
				else
					ans+=2;
			}

			if(sum<value){
				if(value-sum<=k-a[i] || value-sum<=k-a[n-1-i])
					ans+=1;
				else
					ans+=2;
			}
		}
		if(ans<finalans || finalans ==-1)
			finalans=ans;
	}

	cout<<finalans<<endl;
}

int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);

	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif

	int t;cin>>t;

	while(t--){
		solve();
	}

}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int

void solve(){
	int n,k;
	cin>>n>>k;

	int a[n];
	for(int i=0;i<n;i++){
		cin>>a[i];
	}

	vector<ll> v;
	for(int i=0;i<n/2;i++){
		v.push_back(a[i]+a[n-1-i]);
	}

	sort(v.begin(),v.end());

	int count=1,freq=0;
	vector<int> val;
	for(int i=0;i<v.size();i++){
		if(v[i]==v[i-1])
			count++;
		else{
			if(count>freq){
				freq=count;
				val.clear();
				val.push_back(v[i-1]);
			}
			if(count==freq){
				val.push_back(v[i-1]);
			}
			count=1;
		}
	}

	if(count>freq){
		val.clear();
		val.push_back(v[n/2-1]);
	}
	if(count==freq)
		val.push_back(v[n/2-1]);

	val.push_back(k+1);

	int ans=0,sum,finalans=-1;
	for(int j=0;j<val.size();j++){
		ans=0;int value=val[j];
		for(int i=0;i<n/2;i++){
			sum=a[i]+a[n-1-i];
			if(sum>value){//
				if(sum-value<=a[i]-1 || sum-value<=a[n-1-i]-1)
					ans+=1;
				else
					ans+=2;
			}

			if(sum<value){
				if(value-sum<=k-a[i] || value-sum<=k-a[n-1-i])
					ans+=1;
				else
					ans+=2;
			}
		}
		if(ans<finalans || finalans ==-1)
			finalans=ans;
	}

	cout<<finalans<<endl;
}

int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);

	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif

	int t;cin>>t;

	while(t--){
		solve();
	}

}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int

void solve(){
	int n,k;
	cin>>n>>k;

	int a[n];
	for(int i=0;i<n;i++){
		cin>>a[i];
	}

	vector<ll> v;
	for(int i=0;i<n/2;i++){
		v.push_back(a[i]+a[n-1-i]);
	}

	sort(v.begin(),v.end());

	int count=1,freq=0;
	vector<int> val;
	for(int i=0;i<v.size();i++){
		if(v[i]==v[i-1])
			count++;
		else{
			if(count>freq){
				freq=count;
				val.clear();
				val.push_back(v[i-1]);
			}
			if(count==freq){
				val.push_back(v[i-1]);
			}
			count=1;
		}
	}

	if(count>freq){
		val.clear();
		val.push_back(v[n/2-1]);
	}
	if(count==freq)
		val.push_back(v[n/2-1]);

	val.push_back(k+1,k+2,2*k);

	int ans=0,sum,finalans=-1;
	for(int j=0;j<val.size();j++){
		ans=0;int value=val[j];
		for(int i=0;i<n/2;i++){
			sum=a[i]+a[n-1-i];
			if(sum>value){//
				if(sum-value<=a[i]-1 || sum-value<=a[n-1-i]-1)
					ans+=1;
				else
					ans+=2;
			}

			if(sum<value){
				if(value-sum<=k-a[i] || value-sum<=k-a[n-1-i])
					ans+=1;
				else
					ans+=2;
			}
		}
		if(ans<finalans || finalans ==-1)
			finalans=ans;
	}

	cout<<finalans<<endl;
}

int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);

	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif

	int t;cin>>t;

	while(t--){
		solve();
	}

}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int

void solve(){
	int n,k;
	cin>>n>>k;

	int a[n];
	for(int i=0;i<n;i++){
		cin>>a[i];
	}

	vector<ll> v;
	for(int i=0;i<n/2;i++){
		v.push_back(a[i]+a[n-1-i]);
	}

	sort(v.begin(),v.end());

	int count=1,freq=0;
	vector<int> val;
	for(int i=0;i<v.size();i++){
		if(v[i]==v[i-1])
			count++;
		else{
			if(count>freq){
				freq=count;
				val.clear();
				val.push_back(v[i-1]);
			}
			if(count==freq){
				val.push_back(v[i-1]);
			}
			count=1;
		}
	}

	if(count>freq){
		val.clear();
		val.push_back(v[n/2-1]);
	}
	if(count==freq)
		val.push_back(v[n/2-1]);

	val.push_back(k+1);

	int ans=0,sum,finalans=-1;
	for(int j=0;j<val.size();j++){
		ans=0;int value=val[j];
		for(int i=0;i<n/2;i++){
			sum=a[i]+a[n-1-i];
			if(sum>value){
				if(sum-value<=a[i]-1 || sum-value<=a[n-1-i]-1)
					ans+=1;
				else
					ans+=2;
			}

			if(sum<value){
				if(value-sum<=k-a[i] || value-sum<=k-a[n-1-i])
					ans+=1;
				else
					ans+=2;
			}
		}
		if(ans<finalans || finalans ==-1)
			finalans=ans;
	}

	cout<<finalans<<endl;
}

int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);

	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif

	int t;cin>>t;

	while(t--){
		solve();
	}

}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int

void solve(){
	int n,k;
	cin>>n>>k;

	int a[n];
	for(int i=0;i<n;i++){
		cin>>a[i];
	}

	vector<ll> v;
	for(int i=0;i<n/2;i++){
		v.push_back(a[i]+a[n-1-i]);
	}

	sort(v.begin(),v.end());

	int count=1,freq=0;
	vector<int> val;
	for(int i=0;i<v.size();i++){
		if(v[i]==v[i-1])
			count++;
		else{
			if(count>freq){
				freq=count;
				val.clear();
				val.push_back(v[i-1]);
			}
			if(count==freq){
				val.push_back(v[i-1]);
			}
			count=1;
		}
	}

	if(count>freq){
		val.clear();
		val.push_back(v[n/2-1]);
	}
	if(count==freq)
		val.push_back(v[n/2-1]);

	val.push_back(k+1);
	val.push_back(k+2);
	val.push_back(k*2);

	int ans=0,sum,finalans=-1;
	for(int j=0;j<val.size();j++){
		ans=0;int value=val[j];
		for(int i=0;i<n/2;i++){
			sum=a[i]+a[n-1-i];
			if(sum>value){//
				if(sum-value<=a[i]-1 || sum-value<=a[n-1-i]-1)
					ans+=1;
				else
					ans+=2;
			}

			if(sum<value){
				if(value-sum<=k-a[i] || value-sum<=k-a[n-1-i])
					ans+=1;
				else
					ans+=2;
			}
		}
		if(ans<finalans || finalans ==-1)
			finalans=ans;
	}

	cout<<finalans<<endl;
}

int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);

	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif

	int t;cin>>t;

	while(t--){
		solve();
	}

}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define forq(i , a , b) for (int i = (a); i <= (b); ++i)
#define forr(i , b) forq( i , 0 , b - 1 )
#define F first
#define S second
#define IF ->first
#define IS ->second
#define endl '\n'
#define qqmemset(array , val) memset (array , val , sizeof(array))
#define ALLV(vect) vect.begin() , vect.end()
#define mid (st + en) / 2
#define lef 2 * Node
#define rig lef + 1
mt19937 rng( chrono::steady_clock::now().time_since_epoch().count() );
#define Ran(a, b) rng() % ( (b) - (a) + 1 ) + (a)

ll R = 7 + 1e9 , NUMTESTCASE ;
const ll NN = 10 + 1e6 ;
const double pi = acos(-1.0) ;
int di [8] = {1 , 0 , -1 , 0  , 1 , -1 , 1  , -1 } , dj [8] = {0 , 1 , 0  , -1 , 1 , -1 , -1 , 1  } ;
int n , Arr [NN] , k ;
int Cnt [NN][3] ;
pair <int , int> Brr [NN] ;
int main()
{
    //ios_base::sync_with_stdio(false); cin.tie(NULL);
    for (cin >> NUMTESTCASE ; NUMTESTCASE ; NUMTESTCASE --) {
        scanf("%d%d" , &n , &k) ;
        forq (i , 1 , n) scanf("%d" , Arr + i) ;
        forq (i , 1 , n / 2) {
            Brr [i] = {Arr [i] , Arr [n - i + 1] } ;
            if (Brr [i].F < Brr [i].S) swap(Brr [i].F , Brr [i].S) ;
        }
        forq (i , 1 , n / 2) Cnt [i][0] = Cnt [i][1] = Cnt [i][3] = 0 ;
        forq (i , 1 , n / 2 ) Cnt [Brr [i].F][1] ++ , Cnt [Brr [i].S][2] ++ ;
        forq (i , 1 , n / 2 ) Cnt [Brr [i].F + Brr [i].S][0] += 2 ;
        forq (i , 1 , k) Cnt [i][1] += Cnt [i - 1][1] , Cnt [i][2] += Cnt [i - 1][2] ;
        int Ans = INT_MAX , Test ;
        forq (Sum , 2 , k) {
            Test = Cnt [k][1] - Cnt [Sum - 1][1] + Cnt [k][2] - Cnt [Sum - 1][2] ;
            Test += Cnt [Sum - 1][1] + Cnt [Sum - 1][2] - Cnt [Sum][0] ;
            Ans = min(Ans , Test) ;
        }
        forq (Sum , k + 1 , 2 * k ) {
            Test = n - Cnt [Sum][0] ;
            Test /= 2 ;
            Test += Cnt [Sum - k - 1][1] + Cnt [Sum - k - 1][2] ;
            Ans = min(Ans , Test) ;
        }
        printf("%d\n" , Ans) ;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define forq(i , a , b) for (int i = (a); i <= (b); ++i)
#define forr(i , b) forq( i , 0 , b - 1 )
#define F first
#define S second
#define IF ->first
#define IS ->second
#define endl '\n'
#define qqmemset(array , val) memset (array , val , sizeof(array))
#define ALLV(vect) vect.begin() , vect.end()
#define mid (st + en) / 2
#define lef 2 * Node
#define rig lef + 1
mt19937 rng( chrono::steady_clock::now().time_since_epoch().count() );
#define Ran(a, b) rng() % ( (b) - (a) + 1 ) + (a)

ll R = 7 + 1e9 , NUMTESTCASE ;
const ll NN = 10 + 1e6 ;
const double pi = acos(-1.0) ;
int di [8] = {1 , 0 , -1 , 0  , 1 , -1 , 1  , -1 } , dj [8] = {0 , 1 , 0  , -1 , 1 , -1 , -1 , 1  } ;
int n , Arr [NN] , k ;
ll Cnt [NN][4] ;
pair <int , int> Brr [NN] ;
int main()
{
    //ios_base::sync_with_stdio(false); cin.tie(NULL);
    for (cin >> NUMTESTCASE ; NUMTESTCASE ; NUMTESTCASE --) {
        scanf("%d%d" , &n , &k) ;
        forq (i , 1 , n) scanf("%d" , Arr + i) ;
        forq (i , 1 , n / 2) {
            Brr [i] = {Arr [i] , Arr [n - i + 1] } ;
            if (Brr [i].F < Brr [i].S) swap(Brr [i].F , Brr [i].S) ;
        }
        forq (i , 1 , 2 * k) Cnt [i][0] = Cnt [i][1] = Cnt [i][2] = 0 ;
        forq (i , 1 , n / 2 ) Cnt [Brr [i].F][1] ++ , Cnt [Brr [i].S][2] ++ ;
        forq (i , 1 , n / 2 ) Cnt [Brr [i].F + Brr [i].S][0] += 2 ;
        forq (i , 1 , k) Cnt [i][1] += Cnt [i - 1][1] , Cnt [i][2] += Cnt [i - 1][2] ;
        int Ans = INT_MAX , Test ;
        forq (i , 1 , 2 * k) Cnt [i][3] = Cnt [i - 1][3] +  Cnt [i][0] ;
        forq (Sum , 2 , k) {
            Test = Cnt [Sum - 1][3] / 2 ;
            Test += Cnt [2 * k][3] - Cnt [Sum][3] ;

            Ans = min(Ans , Test) ;
        }
        forq (Sum , k + 1 , 2 * k ) {
            Test = n - Cnt [Sum][0] ;
            Test /= 2 ;
            Test += Cnt [Sum - k - 1][1] + Cnt [Sum - k - 1][2] ;
            Ans = min(Ans , Test) ;
        }
        printf("%d\n" , Ans) ;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define forq(i , a , b) for (int i = (a); i <= (b); ++i)
#define forr(i , b) forq( i , 0 , b - 1 )
#define F first
#define S second
#define IF ->first
#define IS ->second
#define endl '\n'
#define qqmemset(array , val) memset (array , val , sizeof(array))
#define ALLV(vect) vect.begin() , vect.end()
#define mid (st + en) / 2
#define lef 2 * Node
#define rig lef + 1
mt19937 rng( chrono::steady_clock::now().time_since_epoch().count() );
#define Ran(a, b) rng() % ( (b) - (a) + 1 ) + (a)

ll R = 7 + 1e9 , NUMTESTCASE ;
const ll NN = 10 + 1e6 ;
const double pi = acos(-1.0) ;
int di [8] = {1 , 0 , -1 , 0  , 1 , -1 , 1  , -1 } , dj [8] = {0 , 1 , 0  , -1 , 1 , -1 , -1 , 1  } ;
int n , Arr [NN] , k ;
ll Cnt [NN][4] ;
pair <int , int> Brr [NN] ;
int main()
{
    //ios_base::sync_with_stdio(false); cin.tie(NULL);
    for (cin >> NUMTESTCASE ; NUMTESTCASE ; NUMTESTCASE --) {
        scanf("%d%d" , &n , &k) ;
        forq (i , 1 , n) scanf("%d" , Arr + i) ;
        forq (i , 1 , n / 2) {
            Brr [i] = {Arr [i] , Arr [n - i + 1] } ;
            if (Brr [i].F < Brr [i].S) swap(Brr [i].F , Brr [i].S) ;
        }
        forq (i , 1 , n / 2) Cnt [i][0] = Cnt [i][1] = Cnt [i][2] = 0 ;
        forq (i , 1 , n / 2 ) Cnt [Brr [i].F][1] ++ , Cnt [Brr [i].S][2] ++ ;
        forq (i , 1 , n / 2 ) Cnt [Brr [i].F + Brr [i].S][0] += 2 ;
        forq (i , 1 , k) Cnt [i][1] += Cnt [i - 1][1] , Cnt [i][2] += Cnt [i - 1][2] ;
        int Ans = INT_MAX , Test ;
        forq (i , 1 , 2 * k) Cnt [i][3] = Cnt [i - 1][3] +  Cnt [i][0] ;
        forq (Sum , 2 , k) {
            Test = Cnt [Sum - 1][3] / 2 ;
            Test += Cnt [2 * k][3] - Cnt [Sum][3] ;

            Ans = min(Ans , Test) ;
        }
        forq (Sum , k + 1 , 2 * k ) {
            Test = n - Cnt [Sum][0] ;
            Test /= 2 ;
            Test += Cnt [Sum - k - 1][1] + Cnt [Sum - k - 1][2] ;
            Ans = min(Ans , Test) ;
        }
        printf("%d\n" , Ans) ;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define forq(i , a , b) for (int i = (a); i <= (b); ++i)
#define forr(i , b) forq( i , 0 , b - 1 )
#define F first
#define S second
#define IF ->first
#define IS ->second
#define endl '\n'
#define qqmemset(array , val) memset (array , val , sizeof(array))
#define ALLV(vect) vect.begin() , vect.end()
#define mid (st + en) / 2
#define lef 2 * Node
#define rig lef + 1
mt19937 rng( chrono::steady_clock::now().time_since_epoch().count() );
#define Ran(a, b) rng() % ( (b) - (a) + 1 ) + (a)

ll R = 7 + 1e9 , NUMTESTCASE ;
const ll NN = 10 + 1e6 ;
const double pi = acos(-1.0) ;
int di [8] = {1 , 0 , -1 , 0  , 1 , -1 , 1  , -1 } , dj [8] = {0 , 1 , 0  , -1 , 1 , -1 , -1 , 1  } ;
int n , Arr [NN] , k ;
int Cnt [NN][3] ;
pair <int , int> Brr [NN] ;
int main()
{
    //ios_base::sync_with_stdio(false); cin.tie(NULL);
    for (cin >> NUMTESTCASE ; NUMTESTCASE ; NUMTESTCASE --) {
        scanf("%d%d" , &n , &k) ;
        forq (i , 1 , n) scanf("%d" , Arr + i) ;
        forq (i , 1 , n / 2) {
            Brr [i] = {Arr [i] , Arr [n - i + 1] } ;
            if (Brr [i].F < Brr [i].S) swap(Brr [i].F , Brr [i].S) ;
        }
        qqmemset(Cnt , 0) ;
        forq (i , 1 , n / 2 ) Cnt [Brr [i].F][1] ++ , Cnt [Brr [i].S][2] ++ ;
        forq (i , 1 , n / 2 ) Cnt [Brr [i].F + Brr [i].S][0] += 2 ;
        forq (i , 1 , k) Cnt [i][1] += Cnt [i - 1][1] , Cnt [i][2] += Cnt [i - 1][2] ;
        int Ans = INT_MAX , Test ;
        forq (Sum , 2 , k) {
            Test = Cnt [k][1] - Cnt [Sum - 1][1] + Cnt [k][2] - Cnt [Sum - 1][2] ;
            Test += Cnt [Sum - 1][1] + Cnt [Sum - 1][2] - Cnt [Sum][0] ;
            Ans = min(Ans , Test) ;
        }
        forq (Sum , k + 1 , 2 * k ) {
            Test = n - Cnt [Sum][0] ;
            Test /= 2 ;
            Test += Cnt [Sum - k - 1][1] + Cnt [Sum - k - 1][2] ;
            Ans = min(Ans , Test) ;
        }
        printf("%d\n" , Ans) ;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define forq(i , a , b) for (int i = (a); i <= (b); ++i)
#define forr(i , b) forq( i , 0 , b - 1 )
#define F first
#define S second
#define IF ->first
#define IS ->second
#define endl '\n'
#define qqmemset(array , val) memset (array , val , sizeof(array))
#define ALLV(vect) vect.begin() , vect.end()
#define mid (st + en) / 2
#define lef 2 * Node
#define rig lef + 1
mt19937 rng( chrono::steady_clock::now().time_since_epoch().count() );
#define Ran(a, b) rng() % ( (b) - (a) + 1 ) + (a)

ll R = 7 + 1e9 , NUMTESTCASE ;
const ll NN = 10 + 1e6 ;
const double pi = acos(-1.0) ;
int di [8] = {1 , 0 , -1 , 0  , 1 , -1 , 1  , -1 } , dj [8] = {0 , 1 , 0  , -1 , 1 , -1 , -1 , 1  } ;
int n , Arr [NN] , k ;
ll Cnt [NN][4] ;
pair <int , int> Brr [NN] ;
int main()
{
    //ios_base::sync_with_stdio(false); cin.tie(NULL);
    for (cin >> NUMTESTCASE ; NUMTESTCASE ; NUMTESTCASE --) {
        scanf("%d%d" , &n , &k) ;
        forq (i , 1 , n) scanf("%d" , Arr + i) ;
        forq (i , 1 , n / 2) {
            Brr [i] = {Arr [i] , Arr [n - i + 1] } ;
            if (Brr [i].F < Brr [i].S) swap(Brr [i].F , Brr [i].S) ;
        }
        forq (i , 1 , 2 * k) Cnt [i][0] = Cnt [i][1] = Cnt [i][2] = 0 ;
        forq (i , 1 , n / 2 ) Cnt [Brr [i].F][1] ++ , Cnt [Brr [i].S][2] ++ ;
        forq (i , 1 , n / 2 ) Cnt [Brr [i].F + Brr [i].S][0] += 2 ;
        forq (i , 1 , k) Cnt [i][1] += Cnt [i - 1][1] , Cnt [i][2] += Cnt [i - 1][2] ;
        int Ans = INT_MAX , Test ;
        forq (Sum , 2 , k) {
            Test = n - Cnt [Sum][0] ;
            Test /= 2 ;
            Test += Cnt [k][2] - Cnt [Sum - 1][2] ;
            Ans = min(Ans , Test) ;
        }
        forq (Sum , k + 1 , 2 * k) {
            Test = n - Cnt [Sum][0] ;
            Test /= 2 ;
            Test += Cnt [Sum - k - 1][1] ;
            Ans = min(Ans , Test) ;
        }
        printf("%d\n" , Ans) ;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define forq(i , a , b) for (int i = (a); i <= (b); ++i)
#define forr(i , b) forq( i , 0 , b - 1 )
#define F first
#define S second
#define IF ->first
#define IS ->second
#define endl '\n'
#define qqmemset(array , val) memset (array , val , sizeof(array))
#define ALLV(vect) vect.begin() , vect.end()
#define mid (st + en) / 2
#define lef 2 * Node
#define rig lef + 1
mt19937 rng( chrono::steady_clock::now().time_since_epoch().count() );
#define Ran(a, b) rng() % ( (b) - (a) + 1 ) + (a)

ll R = 7 + 1e9 , NUMTESTCASE ;
const ll NN = 10 + 1e6 ;
const double pi = acos(-1.0) ;
int di [8] = {1 , 0 , -1 , 0  , 1 , -1 , 1  , -1 } , dj [8] = {0 , 1 , 0  , -1 , 1 , -1 , -1 , 1  } ;
int n , Arr [NN] , k ;
ll Cnt [NN][4] ;
pair <int , int> Brr [NN] ;
int main()
{
    //ios_base::sync_with_stdio(false); cin.tie(NULL);
    for (cin >> NUMTESTCASE ; NUMTESTCASE ; NUMTESTCASE --) {
        scanf("%d%d" , &n , &k) ;
        forq (i , 1 , n) scanf("%d" , Arr + i) ;
        forq (i , 1 , n / 2) {
            Brr [i] = {Arr [i] , Arr [n - i + 1] } ;
            if (Brr [i].F < Brr [i].S) swap(Brr [i].F , Brr [i].S) ;
        }
        forq (i , 1 , n / 2) Cnt [i][0] = Cnt [i][1] = Cnt [i][3] = 0 ;
        forq (i , 1 , n / 2 ) Cnt [Brr [i].F][1] ++ , Cnt [Brr [i].S][2] ++ ;
        forq (i , 1 , n / 2 ) Cnt [Brr [i].F + Brr [i].S][0] += 2 ;
        forq (i , 1 , k) Cnt [i][1] += Cnt [i - 1][1] , Cnt [i][2] += Cnt [i - 1][2] ;
        int Ans = INT_MAX , Test ;
        forq (i , 1 , 2 * k) Cnt [i][3] = Cnt [i - 1][3] +  Cnt [i][0] ;
        forq (Sum , 2 , k) {
            Test = Cnt [Sum - 1][3] / 2 ;
            Test += Cnt [2 * k][3] - Cnt [Sum][3] ;

            Ans = min(Ans , Test) ;
        }
        forq (Sum , k + 1 , 2 * k ) {
            Test = n - Cnt [Sum][0] ;
            Test /= 2 ;
            Test += Cnt [Sum - k - 1][1] + Cnt [Sum - k - 1][2] ;
            Ans = min(Ans , Test) ;
        }
        printf("%d\n" , Ans) ;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define forq(i , a , b) for (int i = (a); i <= (b); ++i)
#define forr(i , b) forq( i , 0 , b - 1 )
#define F first
#define S second
#define IF ->first
#define IS ->second
#define endl '\n'
#define qqmemset(array , val) memset (array , val , sizeof(array))
#define ALLV(vect) vect.begin() , vect.end()
#define mid (st + en) / 2
#define lef 2 * Node
#define rig lef + 1
mt19937 rng( chrono::steady_clock::now().time_since_epoch().count() );
#define Ran(a, b) rng() % ( (b) - (a) + 1 ) + (a)

ll R = 7 + 1e9 , NUMTESTCASE ;
const ll NN = 10 + 1e6 ;
const double pi = acos(-1.0) ;
int di [8] = {1 , 0 , -1 , 0  , 1 , -1 , 1  , -1 } , dj [8] = {0 , 1 , 0  , -1 , 1 , -1 , -1 , 1  } ;
int n , Arr [NN] , k ;
ll Cnt [NN][4] ;
pair <int , int> Brr [NN] ;
int main()
{
    //ios_base::sync_with_stdio(false); cin.tie(NULL);
    for (cin >> NUMTESTCASE ; NUMTESTCASE ; NUMTESTCASE --) {
        scanf("%d%d" , &n , &k) ;
        forq (i , 1 , n) scanf("%d" , Arr + i) ;
        forq (i , 1 , n / 2) {
            Brr [i] = {Arr [i] , Arr [n - i + 1] } ;
            if (Brr [i].F < Brr [i].S) swap(Brr [i].F , Brr [i].S) ;
        }
        forq (i , 1 , 2 * k) Cnt [i][0] = Cnt [i][1] = Cnt [i][2] = 0 ;
        forq (i , 1 , n / 2 ) Cnt [Brr [i].F][1] ++ , Cnt [Brr [i].S][2] ++ ;
        forq (i , 1 , n / 2 ) Cnt [Brr [i].F + Brr [i].S][0] += 2 ;
        forq (i , 1 , k) Cnt [i][1] += Cnt [i - 1][1] , Cnt [i][2] += Cnt [i - 1][2] ;
        int Ans = INT_MAX , Test ;
        forq (Sum , 2 , k) {
            Test = n - Cnt [Sum][0] ;
            Test /= 2 ;
            Test += Cnt [k][1] - Cnt [Sum - 1][1] ;
            Ans = min(Ans , Test) ;
        }
        forq (Sum , k + 1 , 2 * k) {
            Test = n - Cnt [Sum][0] ;
            Test /= 2 ;
            Test += Cnt [Sum - k - 1][2] ;
            Ans = min(Ans , Test) ;
        }
        printf("%d\n" , Ans) ;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define forq(i , a , b) for (int i = (a); i <= (b); ++i)
#define forr(i , b) forq( i , 0 , b - 1 )
#define F first
#define S second
#define IF ->first
#define IS ->second
#define endl '\n'
#define qqmemset(array , val) memset (array , val , sizeof(array))
#define ALLV(vect) vect.begin() , vect.end()
#define mid (st + en) / 2
#define lef 2 * Node
#define rig lef + 1
mt19937 rng( chrono::steady_clock::now().time_since_epoch().count() );
#define Ran(a, b) rng() % ( (b) - (a) + 1 ) + (a)

ll R = 7 + 1e9 , NUMTESTCASE ;
const ll NN = 10 + 1e6 ;
const double pi = acos(-1.0) ;
int di [8] = {1 , 0 , -1 , 0  , 1 , -1 , 1  , -1 } , dj [8] = {0 , 1 , 0  , -1 , 1 , -1 , -1 , 1  } ;
int n , Arr [NN] , k ;
ll Cnt [NN][3] ;
pair <int , int> Brr [NN] ;
int main()
{
    //ios_base::sync_with_stdio(false); cin.tie(NULL);
    for (cin >> NUMTESTCASE ; NUMTESTCASE ; NUMTESTCASE --) {
        scanf("%d%d" , &n , &k) ;
        forq (i , 1 , n) scanf("%d" , Arr + i) ;
        forq (i , 1 , n / 2) {
            Brr [i] = {Arr [i] , Arr [n - i + 1] } ;
            if (Brr [i].F < Brr [i].S) swap(Brr [i].F , Brr [i].S) ;
        }
        forq (i , 1 , n / 2) Cnt [i][0] = Cnt [i][1] = Cnt [i][3] = 0 ;
        forq (i , 1 , n / 2 ) Cnt [Brr [i].F][1] ++ , Cnt [Brr [i].S][2] ++ ;
        forq (i , 1 , n / 2 ) Cnt [Brr [i].F + Brr [i].S][0] += 2 ;
        forq (i , 1 , k) Cnt [i][1] += Cnt [i - 1][1] , Cnt [i][2] += Cnt [i - 1][2] ;
        int Ans = INT_MAX , Test ;
        forq (Sum , 2 , k) {
            Test = Cnt [k][1] - Cnt [Sum - 1][1] + Cnt [k][2] - Cnt [Sum - 1][2] ;
            Test += Cnt [Sum - 1][1] + Cnt [Sum - 1][2] - Cnt [Sum][0] ;
            Ans = min(Ans , Test) ;
        }
        forq (Sum , k + 1 , 2 * k ) {
            Test = n - Cnt [Sum][0] ;
            Test /= 2 ;
            Test += Cnt [Sum - k - 1][1] + Cnt [Sum - k - 1][2] ;
            Ans = min(Ans , Test) ;
        }
        printf("%d\n" , Ans) ;
    }
    return 0;
}


    #include<bits/stdc++.h>
    #include<algorithm>
    #include<cmath>
    #include<climits>
    using namespace std;
    typedef long long int lli;
    typedef vector<int> vi;
    typedef vector<long long int> vlli;
    typedef pair<int,int> pii;
    typedef pair<long long int,long long int> plli;
    typedef vector< vi > vvi ;
    typedef vector< vlli > vvlli  ;
    #define fi(i,a,b) for(int i=a;i<=b;i++)
    #define flli(i,a,b) for(long long int i=a;i<=b;i++)
    #define bi(i,a,b) for(int i=a;i>=b;i--)
    #define blli(i,a,b) for(long long int i=a;i>=b;i--)
    #define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
    #define all(x) x.begin(),x.end()
    #define sz(x) x.size()
    #define pi 2*acos(0.0)
    #define pb push_back
    #define tr(v,it) for(decltype(v.begin()) it=v.begin();it!=v.end();it++)
    #define present(v,num) (v.find(num)!=v.end())
    #define cpresent(v,num) (find(v.begin(),v.end(),num)!=v.end())
    #define pq priority_queue
    #define mp make_pair
    const int inf=INT_MAX;
    const lli INF =LLONG_MAX;
    const lli mod = 1e9+7;
    int main() {
        #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
        #endif
        fast;
        lli t;cin>>t;
        flli(t1,0,t-1)
        {
        	lli n,k;cin>>n>>k;
        	vlli a(n);
        	flli(i,0,n-1)cin>>a[i];
        	lli ans=INF;
        	vlli sum(2*k+1,0);
        	flli(i,0,n/2-1)
        	{
        		sum[a[i]+a[n-i-1]]++;
        	}
        	lli x=INF;
        	lli count=0;
        	flli(i,1,2*k)
        	{
        		if(sum[i]>count)
        		{
        			count=sum[i];
        			x=i;
        		}
        	}
        	count=0;
        	flli(i,0,n/2-1)
        	{
        		if(a[i]+a[n-i-1]==x)continue;
        		if(a[i]+a[n-i-1]<x)
        		{
        			lli var=x-(a[i]+a[n-i-1]);
        			if(min(a[i],a[n-i-1])+var>k)count+=2;
        			else count+=1;
        		}
        		else if(a[i]+a[n-i-1]>x)
        		{
        			lli var=a[i]+a[n-i-1]-x;
        			if(max(a[i],a[n-i-1])-var<=0)count+=2;
        			else count+=1;
        		}
        	}
        	ans=min(ans,count);
        	count=0;
        	x=k+1;
        	flli(i,0,n/2-1)
        	{
        		if(a[i]+a[n-i-1]==x)continue;
        		if(a[i]+a[n-i-1]<x)
        		{
        			lli var=x-(a[i]+a[n-i-1]);
        			if(min(a[i],a[n-i-1])+var>k)count+=2;
        			else count+=1;
        		}
        		else if(a[i]+a[n-i-1]>x)
        		{
        			lli var=a[i]+a[n-i-1]-x;
        			if(max(a[i],a[n-i-1])-var<=0)count+=2;
        			else count+=1;
        		}
        	}
        	ans=min(ans,count);
        	cout<<ans<<endl;
        }
        return 0;
    }


    #include<bits/stdc++.h>
    #include<algorithm>
    #include<cmath>
    #include<climits>
    using namespace std;
    typedef long long int lli;
    typedef vector<int> vi;
    typedef vector<long long int> vlli;
    typedef pair<int,int> pii;
    typedef pair<long long int,long long int> plli;
    typedef vector< vi > vvi ;
    typedef vector< vlli > vvlli  ;
    #define fi(i,a,b) for(int i=a;i<=b;i++)
    #define flli(i,a,b) for(long long int i=a;i<=b;i++)
    #define bi(i,a,b) for(int i=a;i>=b;i--)
    #define blli(i,a,b) for(long long int i=a;i>=b;i--)
    #define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
    #define all(x) x.begin(),x.end()
    #define sz(x) x.size()
    #define pi 2*acos(0.0)
    #define pb push_back
    #define tr(v,it) for(decltype(v.begin()) it=v.begin();it!=v.end();it++)
    #define present(v,num) (v.find(num)!=v.end())
    #define cpresent(v,num) (find(v.begin(),v.end(),num)!=v.end())
    #define pq priority_queue
    #define mp make_pair
    const int inf=INT_MAX;
    const lli INF =LLONG_MAX;
    const lli mod = 1e9+7;
    int main() {
        #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
        #endif
        fast;
        int t;cin>>t;
        while(t--)
        {
        	lli n,k;cin>>n>>k;
        	vlli a(n);
        	flli(i,0,n-1)cin>>a[i];
        	vlli sum(2*k+1,0);
        	vlli maxi;
        	vlli mini;
        	flli(i,0,n/2-1)
        	{
        		maxi.pb(max(a[i],a[n-1-i]));
        		mini.pb(min(a[i],a[n-1-i]));
        		sum[a[i]+a[n-1-i]]++;
        	}
        	sort(all(maxi));
        	sort( all(mini));
        	lli ans=INF;
        	flli(i,2,2*k)
        	{
        		//we will take the one with minimum cost
        		//let say if sum[i]=x, then we are sure that cost < n-2*x
        		lli curr=0;
        		lli type1=0;
        		if(maxi.back()+k<i)type1=0;
        		else
        		{
        			auto temp=lower_bound(all(maxi),i-k-1);
        			type1=temp-maxi.begin();
        		}
        		curr+=2*type1;
        		lli type2=0;
        		if(mini.back()+1<=i)type2=0;
        		else
        		{
        			auto temp=lower_bound(all(mini),i);
        			type2=temp-mini.begin();
        		}
        		//cout<<type2<<endl;
        		curr+=2*type2;
        		curr+=(n/2-sum[i]-type1-type2);
        		ans=min(ans,curr);
        	}
        	cout<<ans<<endl;
        }
        cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
        return 0;
    }


    #include<bits/stdc++.h>
    #include<algorithm>
    #include<cmath>
    #include<climits>
    using namespace std;
    typedef long long int lli;
    typedef vector<int> vi;
    typedef vector<long long int> vlli;
    typedef pair<int,int> pii;
    typedef pair<long long int,long long int> plli;
    typedef vector< vi > vvi ;
    typedef vector< vlli > vvlli  ;
    #define fi(i,a,b) for(int i=a;i<=b;i++)
    #define flli(i,a,b) for(long long int i=a;i<=b;i++)
    #define bi(i,a,b) for(int i=a;i>=b;i--)
    #define blli(i,a,b) for(long long int i=a;i>=b;i--)
    #define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
    #define all(x) x.begin(),x.end()
    #define sz(x) x.size()
    #define pi 2*acos(0.0)
    #define pb push_back
    #define tr(v,it) for(decltype(v.begin()) it=v.begin();it!=v.end();it++)
    #define present(v,num) (v.find(num)!=v.end())
    #define cpresent(v,num) (find(v.begin(),v.end(),num)!=v.end())
    #define pq priority_queue
    #define mp make_pair
    const int inf=INT_MAX;
    const lli INF =LLONG_MAX;
    const lli mod = 1e9+7;
    lli maxcount(vlli &maxi,lli i,lli k)
    {
    	lli szmaxi=sz(maxi);
    	lli l=0,r=szmaxi-1;
    	while(l<=r)
    	{
    		lli mid=(l+r)/2;
    		if(maxi[mid]+k<i)
    		{
    			if(mid==szmaxi-1)return mid;
    			else if(maxi[mid+1]+k<i) l=mid+1;
    			else return mid;
    		}
    		else r=mid-1;
    	}
    	return -1;
    }
    lli mincount(vlli &mini,lli i)
    {
    	lli szmini=sz(mini);
    	lli l=0,r=szmini-1;
    	while(l<=r)
    	{
    		lli mid=(l+r)/2;
    		if(mini[mid]+1>i)
    		{
    			if(mid==szmini-1)return mid;
    			else if(mini[mid+1]+1>i)l=mid+1;
    			else return mid;
    		}
    		else r=mid-1;
    	}
    	return -1;
    }
    int main() {
        #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
        #endif
        fast;
        int t;cin>>t;
        while(t--)
        {
        	lli n,k;cin>>n>>k;
        	vlli a(n);
        	flli(i,0,n-1)cin>>a[i];
        	vlli sum(2*k+1,0);
        	vlli maxi;
        	vlli mini;
        	flli(i,0,n/2-1)
        	{
        		maxi.pb(max(a[i],a[n-1-i]));
        		mini.pb(min(a[i],a[n-1-i]));
        		sum[a[i]+a[n-1-i]]++;
        	}
        	sort(all(maxi));
        	sort(mini.rbegin(),mini.rend());
        	lli ans=INF;
        	flli(i,2,2*k)
        	{
        		lli type1=maxcount(maxi,i,k);
        		//cout<<type1<<endl;
        		lli type2=mincount(mini,i);
        		lli curr=2*(type1+type2+2);
        		curr+=(n/2-sum[i]-(type1+1)-(type2+1));
        		ans=min(ans,curr);
        		//cout<<ans<<endl;
        	}
        	cout<<ans<<endl;
        }
        cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
        return 0;
    }


    #include<bits/stdc++.h>
    #include<algorithm>
    #include<cmath>
    #include<climits>
    using namespace std;
    typedef long long int lli;
    typedef vector<int> vi;
    typedef vector<long long int> vlli;
    typedef pair<int,int> pii;
    typedef pair<long long int,long long int> plli;
    typedef vector< vi > vvi ;
    typedef vector< vlli > vvlli  ;
    #define fi(i,a,b) for(int i=a;i<=b;i++)
    #define flli(i,a,b) for(long long int i=a;i<=b;i++)
    #define bi(i,a,b) for(int i=a;i>=b;i--)
    #define blli(i,a,b) for(long long int i=a;i>=b;i--)
    #define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
    #define all(x) x.begin(),x.end()
    #define sz(x) x.size()
    #define pi 2*acos(0.0)
    #define pb push_back
    #define tr(v,it) for(decltype(v.begin()) it=v.begin();it!=v.end();it++)
    #define present(v,num) (v.find(num)!=v.end())
    #define cpresent(v,num) (find(v.begin(),v.end(),num)!=v.end())
    #define pq priority_queue
    #define mp make_pair
    const int inf=INT_MAX;
    const lli INF =LLONG_MAX;
    const lli mod = 1e9+7;
    bool cmp(plli i, plli j)
    {
    	return(i.first<j.first && i.second<j.second);
    }
    int main() {
        #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
        #endif
        fast;
        lli t;cin>>t;
        flli(t1,0,t-1)
        {
        	lli n,k;cin>>n>>k;
        	vlli a(n);
        	flli(i,0,n-1)cin>>a[i];
        	lli ans=INF;
        	vlli sum(2*k+1,0);
        	flli(i,0,n/2-1)
        	{
        		sum[a[i]+a[n-i-1]]++;
        	}
        	lli x=INF;
        	lli count=0;
        	vector<plli> summ;
        	flli(i,1,2*k)
        	{
        		summ.pb(mp(sum[i],i));
        	}
        	sort(summ.rbegin(),summ.rend(),cmp);
        	//flli(i,0,sz(summ)-1)cout<<summ[i].first<<" "<<summ[i].second<<endl;
        	fi(i,0,10)
        	{
        		count = 0;
        		x=summ[i].second;
        	flli(i,0,n/2-1)
        	{
        		if(a[i]+a[n-i-1]==x)continue;
        		if(a[i]+a[n-i-1]<x)
        		{
        			lli var=x-(a[i]+a[n-i-1]);
        			if(min(a[i],a[n-i-1])+var>k)count+=2;
        			else count+=1;
        		}
        		else if(a[i]+a[n-i-1]>x)
        		{
        			lli var=a[i]+a[n-i-1]-x;
        			if(max(a[i],a[n-i-1])-var<=0)count+=2;
        			else count+=1;
        		}
        	}
        	ans=min(ans,count);
        	}
        	cout<<ans<<endl;
        }
        return 0;
    }


    #include<bits/stdc++.h>
    #include<algorithm>
    #include<cmath>
    #include<climits>
    using namespace std;
    typedef long long int lli;
    typedef vector<int> vi;
    typedef vector<long long int> vlli;
    typedef pair<int,int> pii;
    typedef pair<long long int,long long int> plli;
    typedef vector< vi > vvi ;
    typedef vector< vlli > vvlli  ;
    #define fi(i,a,b) for(int i=a;i<=b;i++)
    #define flli(i,a,b) for(long long int i=a;i<=b;i++)
    #define bi(i,a,b) for(int i=a;i>=b;i--)
    #define blli(i,a,b) for(long long int i=a;i>=b;i--)
    #define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
    #define all(x) x.begin(),x.end()
    #define sz(x) x.size()
    #define pi 2*acos(0.0)
    #define pb push_back
    #define tr(v,it) for(decltype(v.begin()) it=v.begin();it!=v.end();it++)
    #define present(v,num) (v.find(num)!=v.end())
    #define cpresent(v,num) (find(v.begin(),v.end(),num)!=v.end())
    #define pq priority_queue
    #define mp make_pair
    const int inf=INT_MAX;
    const lli INF =LLONG_MAX;
    const lli mod = 1e9+7;
    bool cmp(plli i, plli j)
    {
    	return(i.first<j.first && i.second<j.second);
    }
    int main() {
        #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
        #endif
        fast;
        lli t;cin>>t;
        flli(t1,0,t-1)
        {
        	lli n,k;cin>>n>>k;
        	vlli a(n);
        	flli(i,0,n-1)cin>>a[i];
        	lli ans=INF;
        	vlli sum(2*k+1,0);
        	flli(i,0,n/2-1)
        	{
        		sum[a[i]+a[n-i-1]]++;
        	}
        	lli x=INF;
        	lli count=0;
        	vector<plli> summ;
        	flli(i,1,2*k)
        	{
        		summ.pb(mp(sum[i],i));
        	}
        	sort(summ.rbegin(),summ.rend(),cmp);
        	//flli(i,0,sz(summ)-1)cout<<summ[i].first<<" "<<summ[i].second<<endl;
        	fi(i,0,5)
        	{
        		count = 0;
        	flli(i,0,n/2-1)
        	{
        		if(a[i]+a[n-i-1]==x)continue;
        		if(a[i]+a[n-i-1]<x)
        		{
        			lli var=x-(a[i]+a[n-i-1]);
        			if(min(a[i],a[n-i-1])+var>k)count+=2;
        			else count+=1;
        		}
        		else if(a[i]+a[n-i-1]>x)
        		{
        			lli var=a[i]+a[n-i-1]-x;
        			if(max(a[i],a[n-i-1])-var<=0)count+=2;
        			else count+=1;
        		}
        	}
        	ans=min(ans,count);
        	}
        	cout<<ans<<endl;
        }
        return 0;
    }


#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5+5;
int t,n,k,a[maxn],mp[2*maxn],res;
struct P{
    int n,t;
    bool operator < (const P t1){
        return t>t1.t;
    }
};
vector <P> m;

int count(int sum){
    int cnt=0;
    for (int i=0;i<n/2;i++){
        int te=a[i]+a[n-1-i];
        if (te==sum) continue;
        if ((te > sum && sum>= 1+min(a[i],a[n-i-1])) || ( te<sum && sum <= k+max(a[i],a[n-i-1]))) cnt++;
        else cnt +=2;
    }
    return cnt;
}
int main (){
   // freopen("in.txt","r",stdin);
    scanf ("%d",&t);
    while(t--){
        fill (mp,mp+2*maxn,-1);
        scanf ("%d%d",&n,&k); res=n/2;
        for (int i=0;i<n;i++)
            scanf ("%d",&a[i]);
        for (int i=0;i<n/2;i++)
            if (mp[a[i]+a[n-1-i]]==-1){
                m.push_back(P{a[i]+a[n-1-i],1});
                mp[a[i]+a[n-1-i]]=m.size()-1;
            }else m[mp[a[i]+a[n-i-1]]].t++;
        auto sum= max_element(m.begin(),m.end());
        for (int i=0;i<m.size();i++)
            if (m[i].t==sum->t) res=min(res,count(m[i].n));
        printf("%d\n",res);
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5+5;
int t,n,k,a[maxn],mp[2*maxn],res;
struct P{
    int n,t;
    bool operator < (const P t1){
        return t>t1.t;
    }
};
vector <P> m;

int count(int sum){
    int cnt=0;
    for (int i=0;i<n/2;i++){
        int te=a[i]+a[n-1-i];
        if (te==sum) continue;
        if ((te > sum && sum>= 1+min(a[i],a[n-i-1])) || ( te<sum && sum <= k+max(a[i],a[n-i-1]))) cnt++;
        else cnt +=2;
    }
    return cnt;
}
int main (){
    //freopen("in.txt","r",stdin);
    scanf ("%d",&t);
    while(t--){
        fill (mp,mp+2*maxn,-1);
        scanf ("%d%d",&n,&k); res=n/2;
        for (int i=0;i<n;i++)
            scanf ("%d",&a[i]);
        for (int i=0;i<n/2;i++)
            if (mp[a[i]+a[n-1-i]]==-1){
                m.push_back(P{a[i]+a[n-1-i],1});
                mp[a[i]+a[n-1-i]]=m.size()-1;
            }else m[mp[a[i]+a[n-i-1]]].t++;
        sort(m.begin(),m.end());
        for (int i=0;i<m.size();i++){
            res=min(res,count(m[i].n));
           //printf("%d %d %d\n",m[i].n,m[i].t,count(m[i].n));
        }m.clear();
        printf("%d\n",res);
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5+5;
int t,n,k,a[maxn],res,b[maxn<<1];

int main (){
   //freopen("in.txt","r",stdin);
    scanf ("%d",&t);
    while(t--){
        scanf ("%d%d",&n,&k);
        for (int i=0;i<n;i++)
            scanf ("%d",&a[i]);
        memset(b,0,sizeof(b));
        for (int i=0;i<n/2;i++){
            int sum = a[i]+a[n-i-1];
            int mx = max(a[i],a[n-i-1]);
            int mi = min (a[i],a[n-i-1]);
            b[2]+=2; b[mi+1]--; b[mx+k+1]++; b[2*k+1]-=2;
            b[sum]--; b[sum+1]++;
        }
        res=b[2];
        for (int i=2;i<=2*k;i++)
            b[i]+=b[i-1],res=min(res,b[i]);
        printf("%d\n",res);
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5+5;
int t,n,k,a[maxn],res;
set <int> s;

int count(int sum){
    int cnt=0;
    for (int i=0;i<n/2;i++){
        int te=a[i]+a[n-1-i];
        if (te==sum) continue;
        if ((te > sum && sum>= 1+min(a[i],a[n-i-1])) || ( te<sum && sum <= k+max(a[i],a[n-i-1]))) cnt++;
        else cnt +=2;
    }
    return cnt;
}
int main (){
    //freopen("in.txt","r",stdin);
    scanf ("%d",&t);
    while(t--){
        scanf ("%d%d",&n,&k); res=n/2;
        for (int i=0;i<n;i++)
            scanf ("%d",&a[i]);
        for (int i=0;i<n/2;i++)
            s.insert(a[i]+a[n-i-1]);
        for (auto it : s)  res=min(res,count(it));
        s.clear();
        printf("%d\n",res);
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5+5;
int t,n,k,a[maxn],res;
set <int> s;

int count(int sum){
    int cnt=0;
    for (int i=0;i<n/2;i++){
        int te=a[i]+a[n-1-i];
        if (te==sum) continue;
        if ((te > sum && sum>= 1+min(a[i],a[n-i-1])) || ( te<sum && sum <= k+max(a[i],a[n-i-1]))) cnt++;
        else cnt +=2;
    }
    return cnt;
}
int main (){
    //freopen("in.txt","r",stdin);
    scanf ("%d",&t);
    while(t--){
        scanf ("%d%d",&n,&k); res=n/2;
        for (int i=0;i<n;i++)
            scanf ("%d",&a[i]);
        for (int i=0;i<n/2;i++)
            s.insert(a[i]+a[n-i-1]);
        for (auto it : s)  res=min(res,count(it));
        printf("%d\n",res);
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5+5;
int t,n,k,a[maxn],res;
set <int> s;

int count(int sum){
    int cnt=0;
    for (int i=0;i<n/2;i++){
        int te=a[i]+a[n-1-i];
        if (te==sum) continue;
        if ( sum>= 1+min(a[i],a[n-i-1]) && sum <= k+max(a[i],a[n-i-1])) cnt++;
        else cnt +=2;
        if (cnt>=res) break;
    }
    return cnt;
}

int main (){
    //freopen("in.txt","r",stdin);
    scanf ("%d",&t);
    while(t--){
        scanf ("%d%d",&n,&k); res=n/2;
        for (int i=0;i<n;i++)
            scanf ("%d",&a[i]);
        for (int i=0;i<n/2;i++)
            s.insert(a[i]+a[n-i-1]);
        for (auto it : s)  res=min(res,count(it));
        s.clear();
        printf("%d\n",res);
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5+5;
int t,n,k,a[maxn],res,b[maxn<<1];

int main (){
    //freopen("in.txt","r",stdin);
    scanf ("%d",&t);
    while(t--){
        scanf ("%d%d",&n,&k); res=n/2;
        for (int i=0;i<n;i++)
            scanf ("%d",&a[i]);
        memset(b,0,sizeof(b));
        for (int i=0;i<=n/2;i++){
            int sum = a[i]+a[n-i-1];
            int mx = max(a[i],a[n-i-1]);
            int mi = min (a[i],a[n-i-1]);
            b[2]+=2; b[mi+1]--; b[mx+k+1]++; b[2*k+1]-=2;
            b[sum]--; b[sum+1]++;
        }
        for (int i=2;i<=2*k;i++)
            b[i]+=b[i-1],res=min(res,b[i]);
        printf("%d\n",res);
    }
    return 0;
}


import java.util.Scanner;
public class CodeForce {

        public static void main(String[] args)
        {
            Scanner scan = new Scanner(System.in);
            int t = scan.nextInt();
            int l = 0,m=0,x=0;//for Even
            int h=-1,y=0;
            int q = 0;
            while(l<t)
            {
                System.out.println("");
                int n = scan.nextInt();
                int a[ ] = new int[n];
                for(int i = 0;i<n/2;i++)
                {
                        m = m + 2;
                        a[i] = m;
                        x = x + m;
                }
                for(int i = n/2;i<n-1;i++)
                {
                      h = h + 2;
                       a[i] = h;
                       y = y + h;
                }
                for(int i=1;i<=x;i++)
                {
                    if(y + i == x && y % 2 != 0)
                    {
                        System.out.println("YES");
                        a[n-1] = i;
                        y = y + i;
                        break;
                    }
                }
                if(y == x)
                {
                    while(q<n)
                    {
                       System.out.print(a[q] + " ");
                       q++;
                    }
                }
                else
                {
                        System.out.print("NO");
                }
                m=0;
                x=0;
                 h=-1;
                 y=0;
                 q = 0;
                l++;
            }
        }
}


import java.util.Scanner;
public class CodeForce {

        public static void main(String[] args)
        {
            Scanner scan = new Scanner(System.in);
            int t = scan.nextInt(),q=0;
            while(q<t)
            {
                int n = scan.nextInt();
                int a[ ]=new int[n];
                int i =0;
                int y = 2,h=0;
                int x = 1,z=0;
                while(i<n)
                {
                    if(i<n/2)
                    {
                        z = z + y;
                        a[i] = y;
                        y = y + 2;
                    }
                    else if(i<n-1)
                    {
                        h = h + x;
                        a[i] = x;
                        x = x + 2;
                    }
                    i++;
                }
                int r = 1;
                boolean p = false;
                while(r<=z)
                {
                    if(r+h == z)
                    {
                        a[n-1] = r;
                        p = true;
                        break;
                    }
                    r = r + 2;
                }
                if(p == false)
                {
                    System.out.println("NO");
                }
                else
                {
                    int m = 0;
                     System.out.println("YES");
                        while(m<n)
                        {
                            System.out.print(a[m] + " ");
                            m++;
                        }
                }
                i =0;
                y = 2;
                h=0;
                x = 1;
                z=0;
                System.out.println(" ");
                q++;
            }
        }
}


import java.util.*;
public class Solution{
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int t=sc.nextInt();

        for(int i=0;i<t;i++)
        {
            int n=sc.nextInt();
            int[] arr = new int[n];
            int[] arr1 = new int[n];
            int[] arr2 = new int[n];
            int x=n/2;
            if(x%2!=0)
            {
                System.out.println("No");

            }
            else
            {

                for(int j=2;j<n;j++)
                {
                    if(j%2==0)
                    {
                        arr[j]=j;
                    }
                    else
                    {
                        arr1[j]=j;
                    }
                }

                for(int j=0;j<n;j++)
                {
                    if(arr[j]!=0)
                    {
                        arr2[j]=arr[j];
                    }
                }
                 for(int j=0;j<n;j++)
                {
                    if(arr1[j]!=0)
                    {
                        arr2[j]=arr1[j];
                    }
                }
                 System.out.println("Yes");
                 for(int j=0;j<n;j++)
                {
                   System.out.print(arr2 + " ");
                }

            }
        }
    }
}


import java.util.*;
public class Solution{
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int t=sc.nextInt();

        for(int i=0;i<t;i++)
        {
            int n=sc.nextInt();
            int[] arr = new int[n];
            int[] arr1 = new int[n];
            int[] arr2 = new int[n];
            int x=n/2;
            if(x%2!=0)
            {
                System.out.println("No");

            }
            else{
                System.out.println("Yes");
                for(int i=1;i<=n/2;i++)
                System.out.print(2*i+" ");
                for(int i=1;i<=n/2-1;i++)
                System.out.print((2*i-1)+" ");
                System.out.println(n+n/2-1);

             }
        }
    }
}


import java.util.*;
public class Solution{
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int t=sc.nextInt();

        for(int i=0;i<t;i++)
        {
            int n=sc.nextInt();
            int[] arr = new int[n];
            int[] arr1 = new int[n];
            int[] arr2 = new int[n];
            int x=n/2;
            if(x%2!=0)
            {
                System.out.println("No");

            }
            else{
                System.out.println("Yes");
                for(int i=1;i<=n/2;i++)
                System.out.print(2*i+" ");
                for(int i=1;i<=n/2-1;i++)
                System.out.print((2*i-1)+" ");
                System.out.println(n+n/2-1);

             }
        }
    }


import java.util.*;
public class Solution{
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int t=sc.nextInt();

        for(int i=0;i<t;i++)
        {
            int n=sc.nextInt();
            int[] arr = new int[n];
            int[] arr1 = new int[n];
            int x=n/2;
            if(x%2!=0)
            {
                System.out.println("No");

            }
            else
            {

                for(int j=2;j<n;j++)
                {
                    if(j%2==0)
                    {
                        arr[j]=j;
                    }
                    else
                    {
                        arr1[j]=j;
                    }
                }
                 System.out.println("Yes");
                for(int j=0;j<n;j++)
                {
                     System.out.print(arr+" ");
                }
                 for(int j=0;j<n;j++)
                {
                     System.out.println(arr1+" ");
                }

            }
        }
    }
}


import java.util.*;
public class Solution{
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int t=sc.nextInt();

        for(int i=0;i<t;i++)
        {
            int n=sc.nextInt();
            int[] arr = new int[n];
            int[] arr1 = new int[n];
            int x=n/2;
            if(x%2!=0)
            {
                System.out.println("No");

            }
            else
            {

                for(int j=2;j<n;j++)
                {
                    if(j%2==0)
                    {
                        arr[j]=j;
                    }
                    else
                    {
                        arr1[j]=j;
                    }
                }
                 System.out.println("Yes");
                 System.out.print(arr+" ");
                 System.out.println(arr1+" ");

            }
        }
    }
}


import java.util.*;
public class Solution{
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int t=sc.nextInt();

        for(int i=0;i<t;i++)
        {
            int n=sc.nextInt();
            int[] arr = new int[n];
            int[] arr1 = new int[n];
            int[] arr2 = new int[n];
            int x=n/2;
            if(x%2!=0)
            {
                System.out.println("No");

            }
            else{
                System.out.println("Yes");
                for(int j=1;j<=n/2;j++)
                System.out.print(2*j+" ");
                for(int j=1;j<=n/2-1;j++)
                System.out.print((2*j-1)+" ");
                System.out.println(n+n/2-1);

             }
        }
    }
}


import java.util.*;
public class Solution{
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int t=sc.nextInt();

        for(int i=0;i<t;i++)
        {
            int n=sc.nextInt();
            int[] arr = new int[n];
            int[] arr1 = new int[n];
            int[] arr2 = new int[n];
            int x=n/2;
            if(x%2!=0)
            {
                System.out.println("No");

            }
            else
            {

                for(int j=2;j<n;j++)
                {
                    if(j%2==0)
                    {
                        arr[j]=j;
                    }
                    else
                    {
                        arr1[j]=j;
                    }
                }

                for(int j=0;j<n;j++)
                {
                    if(arr[j]!=0)
                    {
                        arr2[j]=arr[j];
                    }
                }
                 for(int j=0;j<n;j++)
                {
                    if(arr1[j]!=0)
                    {
                        arr2[j]=arr1[j];
                    }
                }
                 System.out.println("Yes");
                 for(int j=0;j<n;j++)
                {
                   System.out.print(arr2[j] + " ");
                }

            }
        }
    }
}


import java.util.*;
public class Solution{
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int t=sc.nextInt();

        for(int i=0;i<t;i++)
        {
            int n=sc.nextInt();
            int[] arr = new int[n];
            int[] arr1 = new int[n];
            int x=n/2;
            if(x%2!=0)
            {
                System.out.println("No");

            }
            else
            {

                for(int j=2;j<n;j++)
                {
                    if(j%2==0)
                    {
                        arr[j]=j;
                    }
                    else
                    {
                        arr1[j]=j;
                    }
                }
                 System.out.println("Yes");
                for(int j=0;j<n;j++)
                {
                     System.out.print(arr[j]+" ");
                }
                for(int j=0;j<n;j++)
                {
                     System.out.print(arr1[j]+" ");
                }

            }
        }
    }
}


//package Progarmming.CodeForces.Sep2020;

import java.util.Scanner;

public class BalancedArray {
    public static void main(String[] args) {
        Scanner s =new Scanner(System.in);
        int n= s.nextInt();
        int even=2;
        int odd=1;
        int save=n/2;
        if(n%4!=0) {
            System.out.println("NO");
        }
        else {
            System.out.println("YES");
            for(int i =0 ;i<n/2;i++){
                System.out.print(even+" ");
                even+=2;
            }
            for(int i =n/2+1;i<n;i++){
                System.out.print(odd+" ");
                //System.out.println("i value "+ i);
                odd+=2;
            }
            System.out.println(3*(n/2)-1);

        }

    }
}


//package Progarmming.CodeForces.Sep2020;

import java.util.Scanner;

public class BalancedArray {
    public static void main(String[] args) {
        Scanner s =new Scanner(System.in);
        int test = s.nextInt();

        while(test-- >0) {
            int n= s.nextInt();
            int even=2;
            int odd=1;
            int save=n/2;

            if (n % 4 != 0) {
                System.out.println("NO");
            } else {
                System.out.println("YES");
                for (int i = 0; i < n / 2; i++) {
                    System.out.print(even + " ");
                    even += 2;
                }
                for (int i = n / 2 + 1; i < n; i++) {
                    System.out.print(odd + " ");
                    //System.out.println("i value "+ i);
                    odd += 2;
                }
                System.out.println(3 * (n / 2) - 1);

            }
        }

    }
}


package Progarmming.CodeForces.Sep2020;

import java.util.Scanner;

public class BalancedArray {
    public static void main(String[] args) {
        Scanner s =new Scanner(System.in);
        int test = s.nextInt();

        while(test-- >0) {
            int n= s.nextInt();
            int even=2;
            int odd=1;
            int save=n/2;

            if (n % 4 != 0) {
                System.out.println("NO");
            } else {
                System.out.println("YES");
                for (int i = 0; i < n / 2; i++) {
                    System.out.print(even + " ");
                    even += 2;
                }
                for (int i = n / 2 + 1; i < n; i++) {
                    System.out.print(odd + " ");
                    //System.out.println("i value "+ i);
                    odd += 2;
                }
                System.out.println(3 * (n / 2) - 1);

            }
        }

    }
}


import java.util.Scanner;
public class BalancedArray
{
    public static void main(String args[])
    {
        Scanner input = new Scanner(System.in);
        int t = input.nextInt();
        int k = 0;
        while(k<t)
        {
            int ce = 10, co = 1, cte = 0, cto = 0;
            int n = input.nextInt();
            int arr[] = new int[n];
            if (((n/2)%2) == 0)
            {
                System.out.println("YES");
                for(int i = 0; i <= n - 1; i++)
                {
                    if (i < (n/2))
                    {
                        arr[i] = ce;
                        System.out.print(arr[i]);
                        System.out.print(" ");
                        cte += ce;
                        ce += 10;
                    }
                    else
                    {
                        if(i == (n-1))
                        {
                            arr[i] = cte - cto;
                            System.out.print(arr[i]);
                            System.out.print(" ");
                        }
                        else
                        {
                            arr[i] = co;
                            System.out.print(arr[i]);
                            System.out.print(" ");
                            cto += co;
                            co += 2;
                        }
                    }
                }
                /*
                for(int i = 0; i <= n - 1; i++)
                {
                    System.out.print(arr[i]);
                    System.out.print(" ");
                }
                 */
            }
            else
            {
                System.out.println("NO");
            }
            k++;
        }
    }
}


import java.util.Scanner;
public class BalancedArray
{
    public static void main(String args[])
    {
        Scanner input = new Scanner(System.in);
        int t = input.nextInt();
        int k = 0;
        while(k<t)
        {
            int ce = 10, co = 1, cte = 0, cto = 0;
            int n = input.nextInt();
            int arr[] = new int[n];
            if (((n/2)%2) == 0)
            {
                System.out.println("YES");
                for(int i = 0; i <= n - 1; i++)
                {
                    if (i < (n/2))
                    {
                        arr[i] = ce;
                        cte += ce;
                        ce += 10;
                    }
                    else
                    {
                        if(i == (n-1))
                        {
                            arr[i] = cte - cto;
                        }
                        else
                        {
                            arr[i] = co;
                            cto += co;
                            co += 2;
                        }
                    }
                }
                for(int i = 0; i <= n - 1; i++)
                {
                    System.out.print(arr[i]);
                    System.out.print(" ");
                }
            }
            else
            {
                System.out.println("NO");
            }
            k++;
        }
    }
}


import java.util.Scanner;
public class BalancedArray
{
    public static void main(String args[])
    {
        Scanner input = new Scanner(System.in);
        int t = input.nextInt();
        int k = 0;
        while(k<t)
        {
            int ce = 2, co = 1, cte = 0, cto = 0;
            int n = input.nextInt();
            int arr[] = new int[n];
            if (((n/2)%2) == 0)
            {
                System.out.println("YES");
                for(int i = 0; i <= n - 1; i++)
                {
                    if (i < (n/2))
                    {
                        arr[i] = ce;
                        System.out.print(arr[i]);
                        System.out.print(" ");
                        cte += ce;
                        ce += 2;
                    }
                    else
                    {
                        if(i == (n-1))
                        {
                            arr[i] = cte - cto;
                            System.out.print(arr[i]);
                            System.out.print(" ");
                        }
                        else
                        {
                            arr[i] = co;
                            System.out.print(arr[i]);
                            System.out.print(" ");
                            cto += co;
                            co += 2;
                        }
                    }
                }
                /*
                for(int i = 0; i <= n - 1; i++)
                {
                    System.out.print(arr[i]);
                    System.out.print(" ");
                }
                 */
            }
            else
            {
                System.out.println("NO");
            }
            k++;
        }
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.InputMismatchException;
import java.util.*;
import java.io.*;
import java.lang.*;
public class BalancedArray{
    public static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;
        private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars==-1)
                throw new InputMismatchException();

            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                }
                catch (IOException e) {
                    throw new InputMismatchException();
                }

                if(numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            }
            catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
        public int nextInt() {
            int c = read();

            while(isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-') {
                sgn = -1;
                c = read();
            }

            int res = 0;
            do {
                if(c<'0'||c>'9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public long nextLong() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;

            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));
            return res * sgn;
        }

        public double nextDouble() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, nextInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, nextInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }

        public String readString() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));

            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String next() {
            return readString();
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }

    public static void main(String args[])
    {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader input = new InputReader(inputStream);
        PrintWriter w = new PrintWriter(outputStream);
        int t;
        t = input.nextInt();
        while(t-->0)
        {
            int ce = 2, co = 1, cte = 0, cto = 0, out = 0;
            int n = input.nextInt();
            if (((n/2)%2) == 0)
            {
                w.println("YES");
                for(int i = 0; i <= n - 1; i++)
                {
                    if (i < (n/2))
                    {
                        out = ce;
                        w.print(out);
                        w.print(" ");
                        cte += ce;
                        ce += 2;
                    }
                    else
                    {
                        if(i == (n-1))
                        {
                            out = cte - cto;
                            w.print(out);
                            w.print(" ");
                        }
                        else
                        {
                            out = co;
                            w.print(out);
                            w.print(" ");
                            cto += co;
                            co += 2;
                        }
                    }
                }
            }
            else
            {
                w.println("NO");
            }
        }
        w.close();
    }
}
/*
import java.util.Scanner;
public class BalancedArray
{
    public static void main(String args[])
    {
        Scanner input = new Scanner(System.in);
        int t = input.nextInt();
        int k = 0;
        while(t-->0)
        {
            int ce = 2, co = 1, cte = 0, cto = 0, out = 0;
            int n = input.nextInt();
            if (((n/2)%2) == 0)
            {
                w.println("YES");
                for(int i = 0; i <= n - 1; i++)
                {
                    if (i < (n/2))
                    {
                        out = ce;
                        w.print(out);
                        w.print(" ");
                        cte += ce;
                        ce += 2;
                    }
                    else
                    {
                        if(i == (n-1))
                        {
                            out = cte - cto;
                            w.print(out);
                            w.print(" ");
                        }
                        else
                        {
                            out = co;
                            w.print(out);
                            w.print(" ");
                            cto += co;
                            co += 2;
                        }
                    }
                }
            }
            else
            {
                w.print("NO");
            }
            k++;
        }
    }
}
 */


import java.util.Scanner;
public class BalancedArray
{
    public static void main(String args[])
    {
        Scanner input = new Scanner(System.in);
        int t = input.nextInt();
        int k = 0;
        while(t-->0)
        {
            int ce = 2, co = 1, cte = 0, cto = 0, out = 0;
            int n = input.nextInt();
            if (((n/2)%2) == 0)
            {
                System.out.println("YES");
                for(int i = 0; i <= n - 1; i++)
                {
                    if (i < (n/2))
                    {
                        out = ce;
                        System.out.print(out);
                        System.out.print(" ");
                        cte += ce;
                        ce += 2;
                    }
                    else
                    {
                        if(i == (n-1))
                        {
                            out = cte - cto;
                            System.out.print(out);
                            System.out.print(" ");
                        }
                        else
                        {
                            out = co;
                            System.out.print(out);
                            System.out.print(" ");
                            cto += co;
                            co += 2;
                        }
                    }
                }
            }
            else
            {
                System.out.println("NO");
            }
            k++;
        }
    }
}


import java.util.Scanner;

public class Codeforces1343B {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int t = sc.nextInt();
		for(int tt =0 ; tt< t; tt++) {
			int n = sc.nextInt();
			if(n%4 ==0) {
				System.out.println("YES");
				long sum = 0 ;
				for(int i = 2 ; i <= n ; i+=2) {
					System.out.print(i + " ");
					sum += i;
				}
				long sum2 = 0;
				int j =1;
				for(int i = 1 ; i < n/2 ; i++) {
					System.out.print(j + " ");
					sum2 += j;
					j += 2;
				}
				System.out.println(sum - sum2);
			}else System.out.println("NO");
		}

		sc.close();
	}
}


import java.util.Scanner;

public class Codeforces1343B {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int t = sc.nextInt();
		for(int tt =0 ; tt< t; tt++) {
			int n = sc.nextInt();
			if(n%4 ==0) {
				System.out.println("YES");
				long sum = 0 ;
				for(int i = 2 ; i <= n ; i+=2) {
					System.out.print(i + " ");
					sum += i;
				}
				long sum2 = 0;
				for(int i = 1 ; i <= n/2 ; i+=2) {
					System.out.print(i + " ");
					sum2 += i;
				}
				System.out.println(sum - sum2);
			}else System.out.println("NO");
		}

		sc.close();
	}
}