#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  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> imos(2 * k + 100);
    map<int, int> x_cand;
    for (int i = 0; i < n / 2; i++) {
      x_cand[a[i] + a[n - 1 - i]]++;
      imos[min(a[i], a[n - 1 - i]) + 1]++;
      imos[max(a[i], a[n - 1 - i]) + k + 1]--;
    }
    for (int i = 0; i <= 2 * k + 20; i++) imos[i + 1] += imos[i];
    int ans = 1145141919;
    for (auto it = x_cand.begin(); it != x_cand.end(); it++) {
      int x = (*it).first, num = (*it).second;
      ans = min(ans, (imos[x] - num) * 1 + (n / 2 - imos[x]) * 2);
    }
    ans = min(ans, n / 2);
    cout << ans << "\n";
  }
  return 0;
}
