#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int maxn = 2e5 + 5;
const int inf = 0x3f3f3f3f;
int d[maxn << 1], p[maxn];
int main() {
  int T, n, k;
  scanf("%d", &T);
  while (T--) {
    memset(d, 0, sizeof(d));
    scanf("%d%d", &n, &k);
    for (int i = 1; i <= n; i++) scanf("%d", &p[i]);
    for (int i = 1; i <= n / 2; i++) {
      int sum = p[i] + p[n - i + 1];
      int mi = min(p[i], p[n - i + 1]), mx = max(p[i], p[n - i + 1]);
      d[2] += 2;
      d[mi + 1]--;
      d[mx + k + 1]++;
      d[sum]--;
      d[sum + 1]++;
    }
    int ans = inf, num = 0;
    for (int i = 2; i <= (k << 1); i++) {
      ans = min(ans, num += d[i]);
    }
    printf("%d\n", ans);
  }
  return 0;
}
