#include <bits/stdc++.h>
using namespace std;
int n, cn;
int arr[2021];
void solve() {
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> arr[i];
  }
  for (int i = 0; i < n; ++i) {
    if (i % 2 == arr[i] % 2) {
      cout << -1 << endl;
      return;
    }
  }
  vector<int> res;
  cn = n;
  int ai, bi;
  for (int it = 0; it < n / 2; ++it, cn -= 2) {
    for (int i = 0; i < cn; ++i) {
      if (arr[i] == cn) {
        bi = i;
      } else if (arr[i] == cn - 1) {
        ai = i;
      }
    }
    if (ai > bi) {
      res.push_back(bi + 1);
      reverse(arr, arr + (bi + 1));
      bi = 0;
      res.push_back(ai);
      reverse(arr, arr + (ai));
      bi = ai - 1;
      res.push_back(cn);
      reverse(arr, arr + cn);
      bi = cn - bi - 1;
      ai = bi - 1;
      res.push_back(bi + 1);
      reverse(arr, arr + (bi + 1));
      bi = 0;
      ai = 1;
      res.push_back(cn);
      reverse(arr, arr + cn);
    } else {
      res.push_back(bi + 1);
      reverse(arr, arr + (bi + 1));
      ai = bi - ai;
      bi = 0;
      res.push_back(ai);
      reverse(arr, arr + ai);
      bi = ai - 1;
      res.push_back(cn);
      reverse(arr, arr + cn);
      bi = cn - bi - 1;
      ai = bi - 1;
      res.push_back(bi + 1);
      reverse(arr, arr + (bi + 1));
      bi = 0;
      ai = 1;
      res.push_back(cn);
      reverse(arr, arr + cn);
    }
  }
  cout << res.size() << endl;
  for (int i = 0; i < res.size(); ++i) {
    cout << res[i] << ' ';
  }
  cout << endl;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
