#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t;
  scanf("%lld", &t);
  while (t--) {
    int n, k;
    cin >> n >> k;
    vector<long long> a(n);
    for (auto &it : a) cin >> it;
    map<int, int> cnt;
    for (long long i = 0; i < n / 2; i++) cnt[a[i] + a[n - i - 1]]++;
    int pre[2 * k + 5];
    memset(pre, 0, sizeof(pre));
    for (long long i = 0; i < n / 2; i++) {
      int l1 = 1 + a[i], r1 = k + a[i];
      int l2 = 1 + a[n - i - 1], r2 = k + a[n - i - 1];
      pre[min(l1, l2)]++;
      pre[max(r1, r2) + 1]--;
    }
    for (long long i = 1; i < 2 * k + 2; i++) pre[i] += pre[i - 1];
    int ans = 1e9;
    for (long long i = 2; i < 2 * k + 1; i++)
      ans = min(ans, (pre[i] - cnt[i]) + (n / 2 - pre[i]) * 2);
    cout << ans << endl;
  }
}
