#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  vector<int> b(2 * k + 1);
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n / 2; i++) {
    b[a[i] + a[n - i - 1]]++;
  }
  vector<int> c(2 * k + 2);
  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;
    c[mn]++;
    c[mx + 1]--;
  }
  for (int i = 1; i < 2 * k + 2; i++) c[i] += c[i - 1];
  int ans = INT32_MAX;
  for (int i = 2; i < 2 * k + 1; i++)
    ans = min(ans, (c[i] - b[i]) + (n / 2 - c[i]) * 2);
  cout << ans << endl;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
}
