#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
using ll = long long;
using namespace std;
ll mod = 1e9 + 7;
void inout() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}
int main() {
  inout();
  ll t;
  cin >> t;
  while (t--) {
    ll n, k;
    cin >> n >> k;
    vector<ll> a(n + 1);
    for (int i = 1; i <= n; i++) cin >> a[i];
    ll pre[2 * k + 15];
    memset(pre, 0, sizeof(pre));
    ll ans = n, l, r;
    ll tmp = n;
    map<ll, ll> mapi;
    for (int i = 1; i <= n / 2; i++) {
      mapi[a[i] + a[tmp]] += 1;
      l = min(a[i], a[tmp]) + 1;
      r = max(a[i], a[tmp]) + k;
      pre[l] += 1;
      pre[r + 1] -= 1;
      tmp -= 1;
    }
    for (int i = 1; i <= 2 * k + 14; i++) pre[i] = pre[i - 1] + pre[i];
    ll cnt0, cnt1, cnt2;
    for (int i = 2; i <= 2 * k; i++) {
      cnt0 = mapi[i];
      cnt1 = pre[i] - cnt0;
      cnt2 = (n / 2) - cnt1 - cnt0;
      tmp = cnt1 + cnt2 * 2;
      ans = min(ans, tmp);
    }
    cout << ans << "\n";
  }
  return 0;
}
