#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  int t;
  cin >> t;
  long long n, k;
  while (t--) {
    cin >> n >> k;
    long long arr[n + 1];
    for (int i = 0; i < int(n); i++) cin >> arr[i + 1];
    long long N = 2 * k + 2;
    long long value[N];
    long long change[N];
    memset(change, 0, sizeof change);
    memset(value, 0, sizeof value);
    long long sum, mii, maa;
    for (int i = 1; i <= (n / 2); i++) {
      sum = arr[i] + arr[n - i + 1];
      value[sum]--;
      mii = min(arr[i], arr[n - i + 1]);
      maa = max(arr[i], arr[n - i + 1]);
      change[mii + 1]--;
      change[maa + k + 1]++;
    }
    long long temp = n;
    for (int i = 0; i < int(N); i++) {
      temp += change[i];
      value[i] += temp;
    }
    long long MIN = n;
    for (int i = 0; i < int(N); i++) {
      if (MIN > value[i]) MIN = value[i];
    }
    cout << MIN << "\n";
  }
  return 0;
}
