#include <bits/stdc++.h>
using namespace std;
const int N = 3e3 + 5;
int a[N];
vector<int> ans;
void solve(int x) {
  if (x == 1) return;
  ans.push_back(x);
  for (int p = 1, q = x; p < q; p++, q--) {
    swap(a[p], a[q]);
  }
}
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    ans.clear();
    int n;
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
      scanf("%d", &a[i]);
    }
    int f = 0;
    for (int i = n; i >= 3; i--) {
      if (i & 1) {
        int j = 1, k = 1;
        while (a[j] != i) {
          j++;
        }
        while (a[k] != i - 1) {
          k++;
        }
        if (j % 2 == 1 && k % 2 == 0) {
          solve(j);
          k = 1;
          while (a[k] != i - 1) {
            k++;
          }
          solve(k - 1);
          while (a[k] != i - 1) {
            k++;
          }
          solve(k + 1);
          solve(3);
          solve(i);
        } else {
          f = 1;
          break;
        }
      }
    }
    if (f) {
      printf("-1\n");
    } else {
      printf("%d\n", ans.size());
      for (auto it : ans) {
        printf("%d ", it);
      }
      printf("\n");
    }
  }
  return 0;
}
