#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using pi = pair<int, int>;
const int mxn = 2021 + 5;
int n, a[mxn];
void solve() {
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    --a[i];
  }
  for (int i = 0; i < n; ++i) {
    if ((a[i] & 1) != (i & 1)) {
      cout << "-1\n";
      return;
    }
  }
  vi ans;
  for (int i = n - 1; i >= 2; i -= 2) {
    int x = 0, y = 0;
    while (a[x] != i) ++x;
    ans.push_back(x);
    reverse(a, a + x + 1);
    while (a[y] != i - 1) ++y;
    ans.push_back(y - 1);
    reverse(a, a + y);
    ans.push_back(y + 1);
    reverse(a, a + y + 2);
    ans.push_back(2);
    reverse(a, a + 3);
    ans.push_back(i);
    reverse(a, a + i + 1);
  }
  cout << (int)(ans).size() << '\n';
  for (const int x : ans) cout << x + 1 << ' ';
  cout << '\n';
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) solve();
}
