#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n, k, mn, mx;
  cin >> n >> k;
  vector<int> a(n);
  int sum = 0;
  vector<int> chg(2 * k + 1, 0);
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n / 2; i++) {
    mn = min(a[i], a[n - i - 1]);
    mx = max(a[i], a[n - i - 1]);
    chg[mn + 1]--;
    chg[mn + mx]--;
    if (mn + mx < 2 * k) {
      chg[mn + mx + 1]++;
    }
    chg[mx + k + 1]++;
  }
  chg[0] = n;
  for (int i = 1; i < 2 * k + 1; i++) {
    chg[i] = chg[i - 1] + chg[i];
  }
  int mnn = INT32_MAX;
  for (int i = 1; i < 2 * k + 1; i++) {
    mnn = mnn > chg[i] ? chg[i] : mnn;
  }
  cout << mnn << endl;
}
int main() {
  int tc;
  cin >> tc;
  while (tc--) solve();
}
