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: import java.io.*;
  import java.util.*;
   
  public class Main { 
      static Random random;
   
      /* public static void main(String[] args){
          new Thread(null, new Template (), "Main", 1<<26).start();
      } */
   
      public static void main(String[] args) {
          FastScanner in = new FastScanner();
          PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
          random = new Random();
           
          // long timeStamp = System.currentTimeMillis();
          Solver solver = new Solver();
          solver.solve(in, out);
          out.close();
          // System.err.println("TIME: "+(System.currentTimeMillis()-timeStamp)+" ms");
      }
       
      /* ------------------------------------- START -------------------------------------------- */
      static class Solver {
          public void solve(FastScanner in, PrintWriter out) {
              int tests = in.nextInt();
              for(int cases = 0; cases < tests; cases++)
                  solveOne(in, out);
          }
  
          private void solveOne(FastScanner in, PrintWriter out) {
              int n = in.nextInt();
              int input[] = new int[n];
  
              boolean possible = true;
  
              for(int i = 0; i<n; i++){
                  input[i] = in.nextInt()-1;
                  possible &= (i%2 == input[i]%2);
              }
  
              if(!possible){
                  out.println(-1);
                  return;
              }
  
              ArrayList<Integer> output = new ArrayList<>();
              for(int target = n-1; target>0; target-=2){
                  int index = find(input, target);
                  output.add(index+1);
                  reverse(input, index);
  
                  index = find(input, target-1)-1;
                  output.add(index+1);
                  reverse(input, index);
  
                  index = target;
                  output.add(index+1);
                  reverse(input, index);
  
                  index = find(input, target);
                  output.add(index+1);
                  reverse(input, index);
  
                  index = target;
                  output.add(index+1);
                  reverse(input, index);
              }
  
              out.println(output.size());
              for(int x: output){
                  out.print(x);
                  out.print(' ');
              }
              out.println();
          }
  
          private static final int find(int[] perm, int x){
              int i = 0;
              while(true){
                  if(perm[i] == x)
                      return i;
                  ++i;
              }
          }
  
          private static final void reverse(int[] perm, int index){
              for(int i = 0, j = index; i<j; ++i, --j){
                  {int swapTmp = perm[i]; perm[i] = perm[j]; perm[j] = swapTmp;}
              }
          }
      }
      /* -------------------------------------- END --------------------------------------------- */
       
      /* Shuffle function to shuffle before Arrays.sort */
      static void shuffle(int[] arr){
          int swapTemp;
          for(int i = arr.length-1; i>= 1; i--){
              int pos = random.nextInt(i+1);
              if(pos == i) continue;
              {swapTemp = arr[i]; arr[i] = arr[pos]; arr[pos] = swapTemp;}
          }
      }
       
      /* Fast Input reader */
      static class FastScanner {
          BufferedReader reader;
          StreamTokenizer tokenizer;
          public FastScanner() {
              reader = new BufferedReader(new InputStreamReader(System.in));
              tokenizer = new StreamTokenizer(reader);
              tokenizer.resetSyntax();
              tokenizer.whitespaceChars(0, 32);
              tokenizer.wordChars(33, 126);
          }
          private void nextToken(){
              try{ tokenizer.nextToken(); }
              catch (Exception e) { e.printStackTrace(); }
          }
          String next() {
              nextToken();
              return tokenizer.sval;
          }
          int nextInt() {
              nextToken();
              return Integer.parseInt(tokenizer.sval);
          }
          long nextLong() {
              nextToken();
              return Long.parseLong(tokenizer.sval);
          }
          double nextDouble() {
              nextToken();
              return Double.parseDouble(tokenizer.sval);
          }
          String nextLine() {
              try{
                  String string = reader.readLine();
                  return string;
              } catch (Exception e) {
                  e.printStackTrace();
                  return "";
              }
          }
      }
  }