#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 55;
int a[maxn];
int ans[maxn * 2];
int solve() {
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; ++i) cin >> a[i];
  for (int i = 0; i < n / 2; ++i) {
    int mn = min(a[i], a[n - i - 1]);
    int mx = max(a[i], a[n - i - 1]);
    ans[2] += 2;
    ans[mn + 1]--;
    ans[mn + mx]--;
    ans[mn + mx + 1]++;
    ans[mx + k + 1]++;
    ans[2 * k + 1] -= 2;
  }
  int answer = n;
  for (int i = 2; i <= k * 2; ++i) {
    ans[i] += ans[i - 1];
    answer = min(answer, ans[i]);
  }
  for (int i = 0; i <= k * 2 + 2; ++i) ans[i] = 0;
  cout << answer << '\n';
  return 0;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int t;
  cin >> t;
  while (t--) solve();
  return 0;
}
