#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using ii = pair<int, int>;
void solve() {
  int n, k;
  cin >> n >> k;
  vi a(n);
  for (auto &(x) : (a)) cin >> x;
  vi cnt(2 * k + 2, 0), prefix(2 * k + 2, 0);
  for (int i = 0; i < n / 2; i++) cnt[a[i] + a[n - i - 1]]++;
  for (int i = 0; i < n / 2; i++) {
    int mn = min(a[i], a[n - i - 1]) + 1;
    int mx = max(a[i], a[n - i - 1]) + k;
    prefix[mn]++;
    prefix[mx + 1]--;
  }
  for (int i = 1; i <= 2 * k; i++) prefix[i] += prefix[i - 1];
  int ans = n;
  for (int i = 1; i <= 2 * k; i++)
    ans = min(ans, prefix[i] - cnt[i] + 2 * (n / 2 - prefix[i]));
  cout << ans << "\n";
}
signed main() {
  ios_base::sync_with_stdio(false), cin.tie(nullptr);
  int t;
  cin >> t;
  while (t--) solve();
}
