#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    vector<int> cnt(2 * k + 2), pref(2 * k + 2);
    for (int i = 0, j = n - 1; i < j; i++, j--) {
      int x = a[i] + a[j];
      cnt[x]++;
      int lo = min(a[i], a[j]) + 1, hi = max(a[i], a[j]) + k;
      pref[lo]++;
      pref[hi + 1]--;
    }
    for (int i = 1; i <= 2 * k; i++) pref[i] += pref[i - 1];
    int ans = 1e9;
    for (int i = 2; i <= 2 * k; i++) {
      int x = (pref[i] - cnt[i]) + ((n / 2 - pref[i]) * 2);
      ans = min(ans, x);
    }
    cout << ans << endl;
  }
}
