#include <bits/stdc++.h>
using namespace std;
const int maxn = 2021 + 5;
int TC, N, A[maxn];
vector<int> ans;
void rev(int x) {
  ans.push_back(x);
  reverse(A + 1, A + x + 1);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> TC;
  while (TC--) {
    cin >> N;
    for (int i = (1); i < (N + 1); i++) cin >> A[i];
    int sol = 1;
    ans.clear();
    for (int i = (1); i < (N + 1); i++) sol &= A[i] % 2 == i % 2;
    if (!sol) {
      cout << "-1\n";
      continue;
    }
    for (; N > 1; N -= 2) {
      int x = find(A + 1, A + N + 1, N) - A;
      rev(x);
      int y = find(A + 1, A + N + 1, N - 1) - A;
      rev(y - 1);
      rev(y + 1);
      rev(3);
      rev(N);
    }
    cout << ans.size() << "\n";
    for (int x : ans) cout << x << " ";
    cout << "\n";
  }
}
