description: You have a permutation: an array a = [a_1, a_2, …, a_n] of distinct integers from 1 to n. The length of the permutation n is odd.
  
  You need to sort the permutation in increasing order.
  
  In one step, you can choose any prefix of the permutation with an odd length and reverse it. Formally, if a = [a_1, a_2, …, a_n], you can choose any odd integer p between 1 and n, inclusive, and set a to [a_p, a_{p-1}, …, a_1, a_{p+1}, a_{p+2}, …, a_n].
  
  Find a way to sort a using no more than 5n/2 reversals of the above kind, or determine that such a way doesn't exist. The number of reversals doesn't have to be minimized.
  
  Input
  
  Each test contains multiple test cases. The first line contains the number of test cases t (1 ≤ t ≤ 100). Description of the test cases follows.
  
  The first line of each test case contains a single integer n (3 ≤ n ≤ 2021; n is odd) — the length of the permutation.
  
  The second line contains n distinct integers a_1, a_2, …, a_n (1 ≤ a_i ≤ n) — the permutation itself. 
  
  It is guaranteed that the sum of n over all test cases does not exceed 2021.
  
  Output
  
  For each test case, if it's impossible to sort the given permutation in at most 5n/2 reversals, print a single integer -1.
  
  Otherwise, print an integer m (0 ≤ m ≤ 5n/2), denoting the number of reversals in your sequence of steps, followed by m integers p_i (1 ≤ p_i ≤ n; p_i is odd), denoting the lengths of the prefixes of a to be reversed, in chronological order.
  
  Note that m doesn't have to be minimized. If there are multiple answers, print any.
  
  Example
  
  Input
  
  
  3
  3
  1 2 3
  5
  3 4 5 2 1
  3
  2 1 3
  
  
  Output
  
  
  4
  3 3 3 3
  2
  3 5
  -1
  
  Note
  
  In the first test case, the permutation is already sorted. Any even number of reversals of the length 3 prefix doesn't change that fact.
  
  In the second test case, after reversing the prefix of length 3 the permutation will change to [5, 4, 3, 2, 1], and then after reversing the prefix of length 5 the permutation will change to [1, 2, 3, 4, 5].
  
  In the third test case, it's impossible to sort the permutation.
solution: #include <bits/stdc++.h>
  using namespace std;
  mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
  int rnd(int l, int r) { return uniform_int_distribution<int>(l, r)(rng); }
  char gc(void) {
    const int S = 3e7;
    static char buf[S], *s = buf, *t = buf;
    if (s == t) t = buf + fread(s = buf, 1, S, stdin);
    if (s == t) return EOF;
    return *s++;
  }
  void read(char &c) {
    while (c = gc(), c == ' ' || c == '\n')
      ;
  }
  void read(string &s) {
    char c;
    while (c = gc(), c != ' ' && c != '\n' && c != EOF) s += c;
  }
  void read(char *s) {
    char c;
    while (c = gc(), c != ' ' && c != '\n' && c != EOF) *s = c, s++;
  }
  template <class T>
  void read(T &ret) {
    char c;
    if (c = gc(), c == EOF) return;
    while (c != '-' && c != '.' && (c < '0' || c > '9')) c = gc();
    int sgn = (c == '-') ? -1 : 1;
    ret = (c == '-') ? 0 : (c - '0');
    while (c = gc(), c >= '0' && c <= '9') ret = ret * 10 + (c - '0');
    if (c == ' ' || c == '\n') {
      ret *= sgn;
      return;
    }
    T bit = 0.1;
    while (c = gc(), c >= '0' && c <= '9') ret += (c - '0') * bit, bit /= 10;
    ret *= sgn;
  }
  void I(){};
  template <class T, class... A>
  void I(T &a, A &...x) {
    read(a);
    I(x...);
  }
  void write(char x) { putchar(x); }
  void write(string x) { cout << x; }
  void write(const char *x) { printf(x); }
  void write(double x) { printf("%.10lf", x); }
  void write(long double x) { printf("%.10Lf", x); }
  template <class T>
  void write(T x) {
    if (x < 0) putchar('-'), x *= -1;
    if (x > 9) write(x / 10);
    putchar(x % 10 + '0');
  }
  void O(){};
  template <class T, class... A>
  void O(T a, A... x) {
    write(a);
    O(x...);
  }
  template <class T>
  void Min(T &a, const T b) {
    if (a > b) a = b;
  }
  template <class T>
  void Max(T &a, const T b) {
    if (a < b) a = b;
  }
  const double PI = acos(-1);
  const int inf = 0x3f3f3f3f;
  const long long linf = 0x3f3f3f3f3f3f3f3f;
  const int N = 2030 + 10;
  const int mod = 998244353;
  int n, ar[N];
  void solve() {
    I(n);
    for (int i = 1; i <= n; i++) I(ar[i]);
    for (int i = 1; i <= n; i++) {
      if (ar[i] % 2 != i % 2) {
        O(-1);
        return;
      }
    }
    vector<int> v;
    for (int i = n; i >= 3; i -= 2) {
      int p = 1;
      while (ar[p] != i) p += 2;
      v.push_back(p);
      reverse(ar + 1, ar + 1 + p);
      p = 2;
      while (ar[p] != i - 1) p += 2;
      p--;
      v.push_back(p);
      reverse(ar + 1, ar + 1 + p);
      p += 2;
      v.push_back(p);
      reverse(ar + 1, ar + 1 + p);
      p = 3;
      v.push_back(p);
      reverse(ar + 1, ar + 1 + p);
      p = i;
      v.push_back(p);
      reverse(ar + 1, ar + 1 + p);
    }
    for (int i = 1; i <= n; i++)
      ;
    O(v.size(), '\n');
    for (auto i : v) O(i, ' ');
  }
  int main() {
    ;
    int _;
    I(_);
    while (_--) {
      solve();
      O('\n');
    }
  }
  