#include <bits/stdc++.h>
using namespace std;
const int oo = 1e9 + 9;
const long long inf = 1e18 + 18;
const int max6 = 1e6 + 6;
const int modx = 1e9 + 123;
const int mody = 997;
const int base = 137;
int a[max6], dd[max6], cnt[max6];
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, k;
    cin >> n >> k;
    for (int i = 0; i <= 2 * k; ++i) dd[i] = cnt[i] = 0;
    for (int i = 1; i <= n; ++i) cin >> a[i];
    int m = n / 2;
    for (int i = 1; i <= m; ++i) {
      int gmax = max(a[i], a[n - i + 1]) + k;
      int gmin = min(a[i], a[n - i + 1]) + 1;
      dd[gmin]++;
      dd[gmax + 1]--;
      cnt[a[i] + a[n - i + 1]]++;
    }
    int res = oo;
    dd[1] += dd[0];
    for (int i = 2; i <= 2 * k; ++i) {
      dd[i] += dd[i - 1];
      res = min(res, n - dd[i] - cnt[i]);
    }
    cout << res << "\n";
  }
}
