#include <bits/stdc++.h>
using namespace std;
int vis[400005];
int bfx[200005];
int d[400005];
int main() {
  int t, n, k, i, j;
  cin >> t;
  while (t--) {
    cin >> n >> k;
    for (i = 1; i <= n; i++) {
      cin >> bfx[i];
    }
    for (i = 1; i <= 2 * k; i++) {
      vis[i] = 0;
      d[i] = 0;
    }
    for (i = 1; i <= n / 2; i++) {
      int big = max(bfx[i], bfx[n - i + 1]);
      int small = min(bfx[i], bfx[n - i + 1]);
      d[small + 1]++;
      d[big + k + 1]--;
      d[bfx[i] + bfx[n - i + 1]]--;
      d[bfx[i] + bfx[n - i + 1] + 1]++;
      d[2] += 2;
      d[small + 1] -= 2;
      d[big + k + 1] += 2;
      d[2 * k + 1] -= 2;
    }
    int ans = 1e9;
    int sum;
    int pre = 0;
    for (i = 2; i <= 2 * k; i++) {
      pre += d[i];
      ans = min(ans, pre);
    }
    cout << ans << endl;
  }
  return 0;
}
