#include <bits/stdc++.h>
using namespace std;
int greaterX(vector<int> &v, int x) {
  int l = 0;
  int r = v.size() - 1;
  while (l != r) {
    int mid = (l + r) / 2;
    if (v[mid] <= x)
      l = mid + 1;
    else
      r = mid;
  }
  if (v[r] <= x) r++;
  return v.size() - r;
}
int lowerX(vector<int> &v, int x) {
  int l = 0;
  int r = v.size() - 1;
  while (l != r) {
    int mid = (l + r + 1) / 2;
    if (v[mid] >= x)
      r = mid - 1;
    else
      l = mid;
  }
  if (v[l] >= x) return 0;
  return l + 1;
}
int main() {
  int TC;
  scanf("%d", &TC);
  int vet[200010];
  while (TC--) {
    int n, k;
    scanf("%d %d", &n, &k);
    vector<int> upper;
    vector<int> lower;
    for (int i = 0; i < n; i++) scanf("%d", &vet[i]);
    map<int, int> MAP;
    for (int i = 0; i < n / 2; i++) {
      MAP[vet[i] + vet[n - i - 1]]++;
      upper.push_back(max(vet[i], vet[n - i - 1]) + k);
      lower.push_back(min(vet[i], vet[n - i - 1]) + 1);
    }
    sort(upper.begin(), upper.end());
    sort(lower.begin(), lower.end());
    int best = n;
    for (int x = 1; x <= 2 * k; x++) {
      best = min(best, n / 2 - MAP[x] + greaterX(lower, x) + lowerX(upper, x));
    }
    printf("%d\n", best);
  }
}
