#include <bits/stdc++.h>
using namespace std;
const long long M = 600000;
int n, a[2200];
int Find(int x) {
  for (int i = 1; i <= n; i++)
    if (a[i] == x) return i;
}
void solve() {
  cin >> n;
  bool ok = 1;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    if (a[i] % 2 != i % 2) {
      ok = 0;
    }
  }
  if (!ok) {
    cout << -1 << '\n';
    return;
  }
  vector<int> res;
  for (int i = n; i > 1; i -= 2) {
    if (a[i] == i && a[i - 1] == i - 1) continue;
    int pos = Find(i);
    res.push_back(pos);
    reverse(a + 1, a + 1 + pos);
    pos = Find(i - 1);
    pos--;
    res.push_back(pos);
    reverse(a + 1, a + 1 + pos);
    pos += 2;
    res.push_back(pos);
    reverse(a + 1, a + 1 + pos);
    pos = 3;
    res.push_back(pos);
    reverse(a + 1, a + 1 + pos);
    pos = i;
    res.push_back(pos);
    reverse(a + 1, a + 1 + pos);
  }
  cout << res.size() << '\n';
  for (auto x : res) cout << x << " ";
  cout << '\n';
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long T = 1;
  cin >> T;
  for (int i = 1; i <= T; i++) {
    solve();
  }
  return 0;
}
