#include <bits/stdc++.h>
using namespace std;
using ll = long long;
void solve() {
  int n;
  cin >> n;
  vector<int> perm(n + 1);
  for (int i = 1; i <= n; i++) cin >> perm[i];
  for (int i = 1; i <= n; i++) {
    if (i % 2 != perm[i] % 2 || (perm[n] != n && n % 2 == 0)) {
      cout << -1 << '\n';
      return;
    }
  }
  vector<int> ans;
  auto process = [&](int p) {
    for (int i = 1; i <= p / 2; i++) {
      swap(perm[i], perm[p - i + 1]);
    }
    ans.push_back(p);
  };
  for (int i = n - (n % 2 == 0); i >= 2; i -= 2) {
    int loceven = -1, locodd = -1;
    for (int j = 1; j <= n; j++) {
      if (perm[j] == i) locodd = j;
      if (perm[j] == i - 1) loceven = j;
    }
    if (locodd > loceven) {
      process(locodd);
      for (int j = 1; j <= n; j++) {
        if (perm[j] == i) locodd = j;
        if (perm[j] == i - 1) loceven = j;
      }
    }
    if (locodd != 1) {
      process(locodd);
    }
    process(loceven - 1);
    process(loceven + 1);
    process(3);
    process(i);
  }
  cout << ans.size() << '\n';
  for (int a : ans) {
    cout << a << " ";
  }
  cout << '\n';
  return;
}
int main() {
  cin.tie(0);
  cin.sync_with_stdio(0);
  int t;
  cin >> t;
  while (t-- > 0) {
    solve();
  }
  return 0;
}
