#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 1;
  cin >> t;
  while (t--) {
    int n, k;
    cin >> n >> k;
    vector<int> v(n + 1);
    vector<int> rs(2 * k + 1);
    vector<int> mini;
    vector<int> maxi;
    for (int i = 1; i <= n; i++) {
      cin >> v[i];
      if (v[i] > k) v[i] = 0;
    }
    int c = 0;
    for (int i = 1; i <= n / 2; i++) {
      if (v[i] != 0 && v[n - i + 1] != 0) {
        rs[v[i] + v[n - i + 1]]++;
        mini.push_back(min(v[i], v[n - i + 1]) + 1);
        maxi.push_back(max(v[i], v[n - i + 1]) + k);
      } else if ((v[i] != 0 && v[n - i + 1] != 0))
        c++;
      else if (v[i] == 0) {
        mini.push_back(v[n - i + 1] + 1);
        maxi.push_back(v[n - i + 1] + k);
      } else if (v[n - i + 1]) {
        mini.push_back(v[i] + 1);
        maxi.push_back(v[i] + k);
      }
    }
    int ans = n;
    sort(mini.begin(), mini.end());
    sort(maxi.begin(), maxi.end());
    for (int i = 2; i <= 2 * k; i++) {
      int x = upper_bound(mini.begin(), mini.end(), i) - mini.begin();
      int y = lower_bound(maxi.begin(), maxi.end(), i) - maxi.begin();
      int oc = x - y;
      int tc = mini.size() - x + y;
      ans = min(ans, oc + 2 * tc + c - rs[i]);
    }
    cout << ans << endl;
  }
}
