#include <bits/stdc++.h>
using namespace std;
const int N = 4e5 + 10;
struct info {
  int l, r, v;
};
int a[N], b[N];
inline void Fun(int l, int r, int v) {
  b[l] += v;
  b[r + 1] -= v;
}
void solve() {
  int T;
  scanf("%d", &T);
  while (T--) {
    int n, k;
    scanf("%d%d", &n, &k);
    for (int i = 1; i <= n; ++i) scanf("%d", a + i);
    vector<info> vi;
    int m = n / 2;
    for (int i = 1; i <= m; ++i) {
      int Max = max(a[i], a[n - i + 1]);
      int Min = min(a[i], a[n - i + 1]);
      vi.push_back({Min + 1, Max + k, a[i] + a[n - i + 1]});
    }
    int s = 2 * k;
    for (int i = 1; i <= s; ++i) b[i] = 0;
    for (auto p : vi) {
      Fun(1, p.l - 1, 2);
      Fun(p.r + 1, 2 * k + 1, 2);
      Fun(p.l, p.r, 1);
      Fun(p.v, p.v, -1);
    }
    int Min_tot = 1e8;
    for (int i = 2; i <= 2 * k; ++i) Min_tot = min(Min_tot, b[i] += b[i - 1]);
    printf("%d\n", min(Min_tot, m));
  }
}
int main() {
  solve();
  return 0;
}
