#include <bits/stdc++.h>
using namespace std;
int main() {
  long long z;
  cin >> z;
  while (z--) {
    long long n, k, te = 0, i = 0, mi = 0, ma = 0;
    cin >> n >> k;
    vector<long long> a(n);
    ;
    for (i = 0; i < n; i++) cin >> a[i];
    vector<long long> p(2 * k + 2);
    ;
    vector<long long> s(2 * k + 2);
    ;
    vector<long long> c(2 * k + 2);
    ;
    for (i = 0; i < n / 2; i++) {
      te = a[i] + a[n - i - 1];
      c[te]++;
      mi = min(a[i], a[n - i - 1]);
      ma = max(a[i], a[n - i - 1]);
      p[mi + 1]++;
      p[ma + k + 1]--;
    }
    for (i = 1; i < 2 * k + 2; i++) p[i] = p[i] + p[i - 1];
    for (i = 0; i < 2 * k + 2; i++) s[i] = n / 2 - p[i];
    mi = n / 2;
    te = 0;
    for (i = 2; i < 2 * k + 1; i++) {
      te = 2 * s[i] + p[i] - c[i];
      mi = min(te, mi);
    }
    cout << mi << endl;
  }
  return 0;
}
