#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, n, k, i, d[200001], v[400005], ans, a, b, sum;
  cin >> t;
  while (t--) {
    cin >> n >> k;
    for (i = 0; i < n; i++) {
      cin >> d[i];
    }
    for (i = 2; i <= 2 * k + 1; i++) v[i] = 0;
    for (i = 0; i < n / 2; i++) {
      a = d[i];
      b = d[n - 1 - i];
      v[2] += 2;
      v[1 + min(a, b)] += -1;
      v[a + b] += -1;
      v[a + b + 1] += 1;
      v[max(a, b) + k + 1] += 1;
    }
    ans = 99999999;
    sum = 0;
    for (i = 2; i <= 2 * k; i++) {
      sum += v[i];
      ans = min(ans, sum);
    }
    cout << ans << endl;
  }
  return 0;
}
