#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
int a[3333], cnt = 0, p[3333];
vector<int> ans;
bool odd(int x) { return (x & 1) ? 1 : 0; }
void upd(int x) {
  if (x > 1) ans.push_back(x);
  for (register int i = 1; i <= x; ++i) p[a[i]] = i;
}
void work(int k) {
  reverse(a + 1, a + p[k] + 1);
  upd(p[k]);
  reverse(a + 1, a + p[k - 1] - 1 + 1);
  upd(p[k - 1] - 1);
  reverse(a + 1, a + p[k - 1] + 1 + 1);
  upd(p[k - 1] + 1);
  reverse(a + 1, a + p[k] + 1);
  upd(p[k]);
  reverse(a + 1, a + k + 1);
  upd(k);
  if (k > 1) work(k - 2);
}
int main() {
  int t = read();
  while (t--) {
    int n = read();
    bool flag = 1;
    for (register int i = 1; i <= n; ++i) {
      a[i] = read(), p[a[i]] = i;
      if (odd(i) ^ odd(a[i])) flag = 0;
    }
    if (!flag) {
      puts("-1");
      continue;
    }
    cnt = 0, ans.clear();
    work(n);
    printf("%d\n", (int)ans.size());
    for (int x : ans) printf("%d ", x);
    puts("");
  }
  return 0;
}
