#include <bits/stdc++.h>
using namespace std;
int recur_depth = 0;
const long long sz = 2100;
long long ara[sz];
int main() {
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    scanf("%lld", &n);
    bool ok = 1;
    for (long long i = 1; i <= n; ++i) {
      scanf("%lld", &ara[i]);
      if ((ara[i] & 1) != (i & 1)) ok = 0;
    }
    if (!ok) {
      printf("-1\n");
      continue;
    }
    vector<int> ans;
    long long lim = n;
    while (!is_sorted(ara + 1, ara + lim + 1)) {
      for (long long i = 1; i <= lim; ++i) {
        if (ara[i] == lim) {
          ans.push_back(i);
          reverse(ara + 1, ara + i + 1);
          break;
        }
      }
      long long idx;
      for (long long i = 1; i <= lim; ++i) {
        if (ara[i] == lim - 1) {
          ans.push_back(i - 1);
          reverse(ara + 1, ara + i);
          idx = i;
          break;
        }
      }
      idx++;
      ans.push_back(idx);
      reverse(ara + 1, ara + idx + 1);
      ans.push_back(3);
      reverse(ara + 1, ara + 3 + 1);
      ans.push_back(lim);
      reverse(ara + 1, ara + lim + 1);
      lim -= 2;
    }
    printf("%d\n", (int)ans.size());
    for (int& x : ans) printf("%d ", x);
    if (!ans.empty()) printf("\n");
  }
  return 0;
}
