#include <bits/stdc++.h>
using namespace std;
int A[3003];
vector<int> F;
void solve(int x, int y, int n) {
  int num = A[x];
  F.push_back(y);
  reverse(A + 1, A + 1 + y);
  if (x <= y) {
    for (int i = 1; i <= n; i++)
      if (A[i] == num) {
        x = i;
        break;
      }
  }
  F.push_back(x - 1);
  reverse(A + 1, A + x);
  F.push_back(x + 1);
  reverse(A + 1, A + x + 2);
  F.push_back(3);
  reverse(A + 1, A + 4);
  F.push_back(n);
  reverse(A + 1, A + 1 + n);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL), cout.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> A[i];
    int flag = 0;
    for (int i = 1; i <= n; i++)
      if (A[i] % 2 != i % 2) flag = 1;
    if (flag == 1) {
      cout << -1 << "\n";
      continue;
    }
    F.clear();
    for (int i = n; i >= 3; i -= 2) {
      int x = -1, y = -1;
      for (int j = 1; j <= i; j++) {
        if (A[j] == i - 1) x = j;
        if (A[j] == i) y = j;
      }
      solve(x, y, i);
    }
    cout << F.size() << "\n";
    for (auto f : F) cout << f << " ";
    cout << "\n";
  }
  return 0;
}
