#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000 * 1000 * 1000 + 7;
const int MAXN = 1000 * 100 + 1;
const int INF = INT_MAX;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int t = 1;
  cin >> t;
  while (t--) {
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    map<int, int> mp;
    for (int &x : a) cin >> x;
    vector<int> pre(2 * k + 5, 0);
    for (int i = 0; 2 * i < n; ++i) {
      mp[a[i] + a[n - i - 1]]++;
      int mx = a[i], mn = a[n - i - 1];
      if (mx < mn) swap(mx, mn);
      pre[mn + 1] += 1;
      pre[mx + k + 1] += -1;
    }
    for (int i = 1; i < 2 * k + 5; ++i) pre[i] += pre[i - 1];
    int res = INT_MAX;
    for (int i = 2; i <= 2 * k; ++i) {
      int cnt0 = mp[i];
      int cnt1 = pre[i] - cnt0;
      int cnt2 = n / 2 - cnt1 - cnt0;
      res = min(res, cnt1 + 2 * cnt2);
    }
    cout << res, cout << "\n";
  }
  return 0;
}
