#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, k;
    cin >> n >> k;
    int a[n];
    for (int i = 0; i < n; i++) cin >> a[i];
    vector<int> cnt(2 * k + 5);
    cnt[1] = n;
    for (int i = 0; i < n / 2; i++) {
      int f = a[i], s = a[n - 1 - i];
      if (f < s) swap(f, s);
      int mn = s + 1, mx = f + k;
      cnt[mn]--;
      cnt[mx + 1]++;
      cnt[f + s]--;
      cnt[f + s + 1]++;
    }
    int ans = n;
    for (int i = 2; i <= 2 * k; i++) {
      cnt[i] += cnt[i - 1];
      ans = min(ans, cnt[i]);
    }
    cout << ans << "\n";
  }
  return 0;
}
