#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 1e6 + 5;
long long n, m, t;
long long v[MAXN];
long long cha[MAXN];
int main() {
  cin >> t;
  while (t--) {
    cin >> n >> m;
    for (long long i = 1; i <= n; i++) scanf("%lld", &v[i]);
    for (long long i = 1; i <= 2 * m + 1; i++) cha[i] = 0;
    map<long long, long long> ma;
    for (long long i = 1; i <= n / 2; i++) {
      long long tmp = v[i] + v[n - i + 1], maxm = max(v[i], v[n - i + 1]),
                minm = min(v[i], v[n - i + 1]);
      cha[2] += 2, cha[minm + 1] -= 2;
      cha[maxm + m + 1] += 2, cha[2 * m + 1] -= 2;
      cha[minm + 1]++, cha[maxm + m + 1]--;
      cha[tmp]--, cha[tmp + 1]++;
    }
    long long tmp = 0;
    long long ans = 1e9;
    for (long long i = 2; i <= m * 2; i++) {
      tmp += cha[i];
      ans = min(tmp, ans);
    }
    cout << ans << endl;
  }
}
