#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, k;
    cin >> n >> k;
    int i, j, x, y, z, N;
    int a[n];
    for (i = 0; i < n; i++) {
      cin >> a[i];
    }
    N = 2 * k + 1;
    int b[N + 1];
    for (i = 0; i <= N; i++) {
      b[i] = 0;
    }
    for (i = 0; i < n / 2; i++) {
      x = min(a[i], a[n - i - 1]);
      y = max(a[i], a[n - i - 1]);
      z = a[i] + a[n - i - 1];
      b[0] += 2;
      b[x + 1] -= 1;
      b[z] -= 1;
      b[z + 1] += 1;
      b[k + y + 1] += 1;
    }
    int sum = 0, ans = n + 1;
    for (i = 0; i <= N; i++) {
      sum += b[i];
      ans = min(ans, sum);
    }
    cout << ans << endl;
  }
  return 0;
}
