#include <bits/stdc++.h>
using namespace std;
int solvere() {
  int n, i, k;
  cin >> n >> k;
  vector<int> a(n);
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  vector<int> no_change(2 * k + 1, 0);
  for (i = 0; i < n / 2; i++) no_change[a[i] + a[n - i - 1]]++;
  vector<int> one_change_atmost(2 * k + 2, 0);
  int left, right;
  for (i = 0; i < n / 2; i++) {
    left = min(a[i], a[n - i - 1]) + 1;
    right = max(a[i], a[n - i - 1]) + k + 1;
    one_change_atmost[left] += 1;
    one_change_atmost[right] -= 1;
  }
  for (i = 1; i <= 2 * k; i++) one_change_atmost[i] += one_change_atmost[i - 1];
  int m, ans = n;
  for (i = 2; i <= 2 * k; i++) {
    m = (one_change_atmost[i] - no_change[i]) +
        2 * (n / 2 - one_change_atmost[i]);
    ans = min(ans, m);
  }
  cout << ans << endl;
  return 0;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int t = 1;
  cin >> t;
  while (t--) solvere();
  return 0;
}
