#include <bits/stdc++.h>
using namespace std;
template <class T>
ostream &operator<<(ostream &os, const vector<T> &p) {
  os << "[";
  for (auto &it : p) os << it << " ";
  return os << "]";
}
template <class S, class T>
ostream &operator<<(ostream &os, const pair<S, T> &p) {
  return os << "(" << p.first << "," << p.second << ")";
}
template <class T>
bool umin(T &a, T b) {
  return a > b ? (a = b, true) : false;
}
template <class T>
bool umax(T &a, T b) {
  return a < b ? (a = b, true) : false;
}
const long long N = 2e5 + 10;
void solve() {
  long long n;
  cin >> n;
  long long k;
  cin >> k;
  vector<long long> sum(2 * k + 1), mx(2 * k + 1), mn(2 * k + 1);
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) cin >> a[i];
  for (long long i = 0; i < n / 2; i++) {
    mx[max(a[i], a[n - 1 - i])]++;
    mn[min(a[i], a[n - 1 - i])]++;
    sum[a[i] + a[n - 1 - i]]++;
  }
  for (long long i = 2; i <= 2 * k; i++) mx[i] += mx[i - 1];
  for (long long i = 2 * k; i >= 2; i--) mn[i - 1] += mn[i];
  long long ans = n;
  for (long long i = 2; i <= 2 * k; i++) {
    long long two = mn[i] + ((i - k - 1) >= 1 ? mx[i - k - 1] : 0LL);
    long long zero = sum[i];
    long long one = n / 2 - two - zero;
    umin(ans, 2 * two + one);
  }
  cout << ans << endl;
}
signed main() {
  ios_base::sync_with_stdio(false), cin.tie(nullptr);
  long long q = 1;
  cin >> q;
  while (q--) {
    solve();
  }
  return 0;
}
