#include <bits/stdc++.h>
using namespace std;
int ara[400010];
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, k;
    cin >> n >> k;
    for (int i = 0; i <= 2 * k + 1; i++) ara[i] = 0;
    int now[n + 5];
    for (int i = 1; i <= n; i++) scanf("%d", &now[i]);
    for (int i = 1; i <= n / 2; i++) {
      int x = now[i];
      int y = now[n - i + 1];
      int mx = max(x + k, y + k);
      int mn = min(x + 1, y + 1);
      int p = x + y;
      ara[p + 1]++, ara[mx + 1]--;
      ara[mn]++, ara[p]--;
      ara[1] += 2;
      ara[mn] -= 2;
      ara[mx + 1] += 2;
      ara[2 * k + 1] -= 2;
    }
    int mn2 = 1e9;
    for (int i = 2; i <= 2 * k; i++) {
      ara[i] += ara[i - 1];
      mn2 = min(ara[i], mn2);
    }
    cout << mn2 << endl;
  }
}
