#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  vector<int> ans(2 * k + 10);
  for (int i = 0; i < n / 2; ++i) {
    int j = n - i - 1;
    int x = max(a[i], a[j]) + k;
    int y = min(a[i], a[j]) + 1;
    int z = a[i] + a[j];
    ans[2] += 2;
    ans[y] -= 1;
    ans[x + 1] += 1;
    ans[z] -= 1;
    ans[z + 1] += 1;
  }
  int res = 1e9;
  for (int i = 2; i <= 2 * k; ++i) {
    ans[i + 1] += ans[i];
    res = min(res, ans[i]);
  }
  cout << res;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    solve();
    cout << '\n';
  }
  return 0;
}
