#include <bits/stdc++.h>
using namespace std;
int n, k;
int a[200005];
int cnt[400005];
int cv[400005];
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    memset(cnt, 0, sizeof(cnt));
    memset(cv, 0, sizeof(cv));
    scanf("%d%d", &n, &k);
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
    for (int i = 1; i * 2 <= n; i++) {
      cnt[a[i] + a[n - i + 1]]++;
      cv[min(a[i], a[n - i + 1]) + 1]++, cv[max(a[i], a[n - i + 1]) + k + 1]--;
    }
    for (int i = 3; i <= 2 * k; i++) cv[i] += cv[i - 1];
    int ans = 200005;
    for (int x = 2; x <= 2 * k; x++) {
      ans = min(ans, n - cnt[x] - cv[x]);
    }
    printf("%d\n", ans);
  }
  return 0;
}
