#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll power(ll x, ll y);
const ll MOD = 1000000007;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ll t;
  cin >> t;
  while (t--) {
    ll n, k;
    cin >> n >> k;
    ll arr[n];
    for (int i = 0; i < n; i++) cin >> arr[i];
    unordered_map<ll, ll> f;
    ll pre[2 * k + 1];
    memset(pre, 0, sizeof(pre));
    ;
    for (int i = 0; i < n / 2; i++) {
      ll l = arr[i], r = arr[n - i - 1];
      if (r < l) swap(l, r);
      f[l + r]++;
      pre[1 + l]++;
      pre[k + r + 1]--;
    }
    for (int i = 1; i <= 2 * k; i++) pre[i] += pre[i - 1];
    ll res = n + 1;
    for (int x = 2; x <= 2 * k; x++)
      res = min(res, pre[x] - f[x] + (n / 2 - pre[x]) * 2);
    cout << res << "\n";
  }
}
ll power(ll x, ll y) {
  ll res = 1;
  x %= MOD;
  while (y > 0) {
    if (y & 1) res = (res * x) % MOD;
    y = y >> 1, x = (x * x) % MOD;
  }
  return res;
}
