#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2105 * 5;
int n;
int a[MAXN];
int ans[MAXN], anstot;
long long Read() {
  long long x = 0, f = 1;
  char c = getchar();
  while (c > '9' || c < '0') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = (x * 10) + (c ^ 48);
    c = getchar();
  }
  return x * f;
}
template <typename T>
void Put1(T x) {
  if (x > 9) Put1(x / 10);
  putchar(x % 10 ^ 48);
}
template <typename T>
void Put(T x, char c = -1) {
  if (x < 0) putchar('-'), x = -x;
  Put1(x);
  if (c >= 0) putchar(c);
}
template <typename T>
T Max(T x, T y) {
  return x > y ? x : y;
}
template <typename T>
T Min(T x, T y) {
  return x < y ? x : y;
}
template <typename T>
T Abs(T x) {
  return x < 0 ? -x : x;
}
void solve(int x) {
  if (x == 1) return;
  for (int i = 1; i <= x / 2; ++i) swap(a[i], a[x - i + 1]);
  ans[++anstot] = x;
}
int main() {
  for (int T = Read(); T; --T) {
    n = Read();
    bool ls = 0;
    for (int i = 1; i <= n; ++i) {
      a[i] = Read();
      if ((a[i] & 1) ^ (i & 1)) ls = 1;
    }
    if (ls) {
      Put(-1, '\n');
      continue;
    }
    for (int i = 1; i <= n; ++i)
      if (a[i] ^ i) ls = 1;
    if (!ls) {
      Put(0, '\n');
      continue;
    }
    anstot = 0;
    for (int i = 1; i < n; i += 2) {
      int ID1 = 0, ID2 = 0;
      for (int j = 1; j <= n; ++j)
        if (a[j] == i)
          ID1 = j;
        else if (a[j] == i + 1)
          ID2 = j;
      if (ID1 > ID2) ID2 = ID1 - ID2 + 1;
      solve(ID1);
      solve(ID2 - 1);
      ID1 = ID2 - 1;
      int val = ID2 + 1;
      ID1 = val - ID1 + 1;
      ID2 = val - ID2 + 1;
      solve(val);
      solve(ID1);
      ID1 = 1;
      ID2 = 2;
      solve(n - i + 1);
    }
    solve(n);
    Put(anstot, '\n');
    for (int i = 1; i <= anstot; ++i) Put(ans[i], ' ');
    putchar('\n');
  }
  return 0;
}
