#include <bits/stdc++.h>
using namespace std;
int a[2005], ans[10005], n, le;
int read() {
  char ch = getchar();
  int X = 0;
  bool fl = 0;
  while (ch < '0' || ch > '9') {
    if (ch == '-') fl = 1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    X = (X << 1) + (X << 3) + ch - '0';
    ch = getchar();
  }
  if (fl) return ~(X - 1);
  return X;
}
int ck(int x) {
  for (int i = 1; i <= n; i++)
    if (a[i] == x) return i;
}
int T;
int main() {
  T = read();
  for (; T; T--) {
    n = read();
    le = 0;
    bool fl = 0;
    for (int i = 1; i <= n; i++) a[i] = read();
    for (int i = 1; i <= n; i++)
      if (abs(a[i] - i) & 1) {
        puts("-1");
        fl = 1;
        break;
      }
    if (fl) {
      continue;
    }
    for (int i = 1; i <= n / 2; i++) {
      int p1 = ck(i * 2 - 1);
      reverse(a + 1, a + p1 + 1);
      ans[++le] = p1;
      int p2 = ck(i * 2);
      reverse(a + 1, a + p2);
      ans[++le] = p2 - 1;
      reverse(a + 1, a + p2 + 2);
      ans[++le] = p2 + 1;
      reverse(a + 1, a + 4);
      ans[++le] = 3;
      reverse(a + 1, a + n - i * 2 + 3);
      ans[++le] = n - i * 2 + 2;
    }
    reverse(a + 1, a + 1 + n);
    ans[++le] = n;
    cout << le << '\n';
    for (int i = 1; i <= le; i++) cout << ans[i] << ' ';
    puts("");
  }
  return 0;
}
