#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  for (int i = 0; i < t; i++) {
    int n, k;
    cin >> n >> k;
    vector<long long> A(n + 1), pref(2 * k + 2, 0);
    for (int i = 1; i <= n; i++) {
      cin >> A[i];
    }
    map<long long, int> sumWeHave;
    for (int i = 1; i <= n / 2; i++) {
      pref[min(A[i], A[n - i + 1]) + 1]++;
      pref[max(A[i], A[n - i + 1]) + k + 1]--;
      sumWeHave[A[i] + A[n - i + 1]]++;
    }
    for (int i = 1; i <= 2 * k; i++) {
      pref[i] = pref[i] + pref[i - 1];
    }
    long long ans = 2 * k + 1e9;
    for (int i = 1; i <= 2 * k; i++) {
      ans = min(ans, 2 * (n / 2 - pref[i]) + abs(-sumWeHave[i] + pref[i]));
    }
    cout << ans << '\n';
  }
  return 0;
}
