#include <bits/stdc++.h>
using namespace std;
void usain_bolt() {
  ios::sync_with_stdio(false);
  cin.tie(0);
}
const int N = 2e5 + 5;
int a[N], sum[2 * N];
int main() {
  usain_bolt();
  int tt;
  cin >> tt;
  for (; tt; --tt) {
    int n, k;
    cin >> n >> k;
    for (int i = 1; i <= n; ++i) cin >> a[i];
    for (int i = 1; i <= n / 2; ++i) {
      int c = a[i], d = a[n - i + 1];
      int mn = min(c, d);
      int mx = max(c, d);
      sum[1] += 2;
      sum[mn + 1] -= 2;
      sum[mn + 1] += 1;
      sum[mn + mx] -= 1;
      sum[mn + mx + 1] += 1;
      sum[mx + k + 1] -= 1;
      sum[mx + k + 1] += 2;
      sum[2 * k + 1] -= 2;
    }
    int cnt = 0, min_sum = 2e9;
    for (int i = 1; i <= 2 * k; ++i) {
      cnt += sum[i];
      min_sum = min(min_sum, cnt);
    }
    cout << min_sum << "\n";
    memset(sum, 0, sizeof(sum));
  }
  return 0;
}
