#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const int maxn = 4e5 + 10;
int arr[maxn];
int d[maxn];
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    int n, k;
    scanf("%d%d", &n, &k);
    for (int i = 1; i <= n; i++) {
      scanf("%d", &arr[i]);
    }
    for (int i = 1; i <= 2 * k + 1; i++) {
      d[i] = 0;
    }
    for (int i = 1; i <= n / 2; i++) {
      int sum = arr[i] + arr[n - i + 1];
      int minn = min(arr[i], arr[n - i + 1]) + 1;
      int maxx = max(arr[i], arr[n - i + 1]) + k;
      d[2] += 2;
      d[minn]--;
      d[maxx + 1]++;
      d[sum]--;
      d[sum + 1]++;
    }
    int ans = inf;
    int sum = 0;
    for (int i = 2; i <= 2 * k; i++) {
      sum += d[i];
      ans = min(ans, sum);
    }
    printf("%d\n", ans);
  }
  return 0;
}
