#include <bits/stdc++.h>
#pragma GCC optimize(3)
using namespace std;
const long long N = 2199;
inline long long read() {
  long long s = 0, w = 1;
  register char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') w = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9')
    s = (s << 3) + (s << 1) + (ch ^ 48), ch = getchar();
  return s * w;
}
long long n, a[N];
signed main() {
  for (register long long T = read(); T; T--) {
    n = read();
    for (register long long i = 1; i <= n; i++) a[i] = read();
    long long flg = 1;
    for (register long long i = 1; i <= n; i++) {
      if (abs(a[i] - i) & 1) {
        flg = 0;
        break;
      }
    }
    if (!flg) {
      puts("-1");
      continue;
    }
    vector<long long> g, w;
    for (register long long i = 1; i <= n; i++) w.emplace_back(a[i]);
    for (register long long i = n; i >= 3; i--, i--) {
      long long now = 0;
      for (register long long j = 1; j <= n; j++) {
        if (w[j - 1] == i) {
          now = j;
          break;
        }
      }
      g.emplace_back(now);
      reverse(w.begin(), w.begin() + now);
      long long pp = 0;
      for (register long long j = 1; j <= n; j++) {
        if (w[j - 1] == i - 1) {
          pp = j;
          break;
        }
      }
      g.emplace_back(pp - 1), reverse(w.begin(), w.begin() + pp - 1);
      g.emplace_back(pp + 1), reverse(w.begin(), w.begin() + pp + 1);
      g.emplace_back(3), reverse(w.begin(), w.begin() + 3);
      g.emplace_back(i), reverse(w.begin(), w.begin() + i);
    }
    printf("%lld\n", (long long)g.size());
    for (auto i : g) printf("%lld ", i);
    puts("");
  }
  return 0;
}
