#include <bits/stdc++.h>
using namespace std;
int a[1000000], psum[1000000];
map<long long, long long> mp, pp;
vector<long long> v;
int main() {
  std::ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  long long t;
  cin >> t;
  while (t--) {
    int n, k;
    cin >> n >> k;
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int i = 0; i < (2 * k + 2); i++) {
      psum[i] = 0;
    }
    for (int i = 0; i < n / 2; i++) {
      int mn = min(a[i], a[n - i - 1]);
      int mx = max(a[i], a[n - i - 1]);
      psum[1] += 2;
      psum[mn + 1] -= 1;
      psum[mn + mx] -= 1;
      psum[mx + mn + 1] += 1;
      psum[mx + k + 1] += 1;
    }
    int ans = INT_MAX, sum = 0;
    for (int i = 1; i <= (2 * k + 1); i++) psum[i] += psum[i - 1];
    for (int i = 1; i < (2 * k + 1); i++) ans = min(ans, psum[i]);
    cout << ans << endl;
  }
  return 0;
}
