#include <bits/stdc++.h>
using namespace std;
int sum[400005], check[400005], v[200005];
int main() {
  int n, k, t;
  scanf("%d", &t);
  while (t--) {
    scanf("%d%d", &n, &k);
    for (int i = 0; i < n; i++) scanf("%d", &v[i]);
    for (int i = 0; i < n / 2; i++) sum[v[i] + v[n - i - 1]]++;
    int ans = 5000000;
    for (int i = 0; i < n / 2; i++) {
      int x = max(v[i], v[n - i - 1]);
      int y = min(v[i], v[n - i - 1]);
      check[y + 1]++;
      check[x + k + 1]--;
    }
    for (int i = 1; i <= 2 * k + 1; i++) check[i] += check[i - 1];
    for (int i = 2; i <= 2 * k; i++) {
      ans = min(ans, (n / 2 - check[i]) * 2 + check[i] - sum[i]);
    }
    cout << ans << endl;
    for (int i = 0; i <= 2 * k + 2; i++) sum[i] = check[i] = 0;
  }
}
