#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long inf = INT64_MAX;
void solve() {
  long long n, k;
  cin >> n >> k;
  vector<long long> v(n);
  vector<long long> aux(2 * k + 2, 0);
  for (long long i = 0; i < n; i++) {
    cin >> v[i];
  }
  for (long long i = 0; i < n / 2; i++) {
    long long a = v[i];
    long long b = v[n - 1 - i];
    long long r = (a + b) + max(k - a, k - b);
    long long l = (a + b) - max(a - 1, b - 1);
    aux[l] -= 1;
    aux[r + 1] += 1;
    aux[a + b] -= 1;
    aux[a + b + 1] += 1;
  }
  long long cur = n, best = cur;
  for (long long i = 1; i <= 2 * k; i++) {
    cur += aux[i];
    best = min(best, cur);
  }
  cout << best << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int test = 1;
  cin >> test;
  while (test-- > 0) {
    solve();
  }
  return 0;
}
