#include <bits/stdc++.h>
const long long int inf = (1e9 + 3);
const int M97 = ((int)1e9 + 7);
using namespace std;
long long int i, j, k;
void solve() {
  int n;
  cin >> n >> k;
  int a[n];
  for (int zzz = 0; zzz < n; zzz++) {
    cin >> a[zzz];
  }
  vector<int> ones(2 * k + 3), zeroes(2 * k + 3);
  for (i = 0; i < n / 2; i++) {
    pair<int, int> x =
        make_pair(min(a[i], a[n - 1 - i]) + 1, max(a[i], a[n - i - 1]) + k);
    zeroes[a[i] + a[n - i - 1]]++;
    ones[x.first]++;
    ones[x.second + 1]--;
  }
  int one = 0;
  int ans = inf;
  for (i = 2; i < 2 * k + 1; i++) {
    one += ones[i];
    int local = one - zeroes[i];
    local += ((n / 2 - one) << 1);
    ans = min(ans, local);
  }
  cout << ans << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int T;
  cin >> T;
  while (T--) solve();
  return 0;
}
