#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t;
  cin >> t;
  while (t--) {
    long long n, k;
    cin >> n >> k;
    vector<long long> vc(n), pre(2 * k + 10, 0);
    for (auto &i : vc) {
      cin >> i;
    }
    map<long long, long long> cnt;
    for (int i = 0; i < n / 2; ++i) {
      cnt[vc[i] + vc[n - i - 1]]++;
      pre[min(vc[i], vc[n - i - 1]) + 1]++;
      pre[max(vc[i], vc[n - i - 1]) + k + 1]--;
    }
    for (int i = 2; i < pre.size() - 2; ++i) {
      pre[i] += pre[i - 1];
    }
    long long ans = INT_MAX;
    for (int i = 2; i <= 2 * k + 2; ++i) {
      ans = min(ans, pre[i] - cnt[i] + (n / 2 - pre[i]) * 2);
    }
    cout << ans << "\n";
  }
  return 0;
}
