#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    int n, k;
    scanf("%d %d", &n, &k);
    vector<int> a(n), b(2 * k + 1, 0), range(2 * k + 2, 0);
    for (int i = 0; i < n; i++) {
      scanf("%d", &a[i]);
    }
    for (int i = 0; i < n / 2; i++) {
      b[a[i] + a[n - i - 1]]++;
      range[min(a[i], a[n - i - 1]) + 1]++;
      range[max(a[i], a[n - i - 1]) + k + 1]--;
    }
    int cur = 0;
    for (int i = 2; i <= 2 * k; i++) {
      cur += range[i];
      range[i] = cur;
    }
    int ans = n;
    for (int i = 2; i <= 2 * k; i++) {
      int x = range[i] - b[i];
      int y = n - range[i] * 2;
      ans = min(ans, x + y);
    }
    printf("%d\n", ans);
  }
}
