#include <bits/stdc++.h>
using namespace std;
int max(int a, int b) {
  if (a > b) {
    return a;
  } else {
    return b;
  }
}
int min(int a, int b) {
  if (a < b) {
    return a;
  } else {
    return b;
  }
}
void solution(vector<int> ar, int n, int k) {
  vector<long long> pref(2 * k + 2, 0);
  vector<long long> cnt(2 * k + 1, 0);
  for (int i = 0; i < n / 2; i++) {
    cnt[ar[i] + ar[n - 1 - i]]++;
  }
  for (int i = 0; i < n / 2; i++) {
    int lf1 = 1 + ar[i];
    int lf2 = 1 + ar[n - 1 - i];
    int rt1 = k + ar[i];
    int rt2 = k + ar[n - 1 - i];
    assert(max(lf1, lf2) <= min(rt1, rt2));
    pref[min(lf1, lf2)]++;
    pref[max(rt1, rt2) + 1]--;
  }
  for (int i = 1; i <= 2 * k + 1; i++) {
    pref[i] += pref[i - 1];
  }
  long long ans = 1e9;
  for (int sum = 2; sum <= 2 * k; sum++) {
    ans = min(ans, (pref[sum] - cnt[sum]) + (n / 2 - pref[sum]) * 2);
  }
  cout << ans;
}
int main() {
  int t;
  cin >> t;
  for (int i = 0; i < t; i++) {
    int n, k;
    cin >> n >> k;
    vector<int> ar(n);
    for (int j = 0; j < n; j++) {
      cin >> ar[j];
    }
    solution(ar, n, k);
    cout << "\n";
  }
}
