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 Main2{
  	//1 6 5 2 7 4 3
  	//7 2 5 6 1 4 3
  	//5 2 7 6 1 4 3
  
  	static LinkedList<Integer>ans;
  	static void reverse(int[]in,int len){
  		ans.add(len);
  		for(int i=0,j=len-1;i<j;i++,j--){
  			int tmp=in[i];
  			in[i]=in[j];
  			in[j]=tmp;
  		}
  	}
  	static void main() throws Exception{
  		int n=sc.nextInt();
  		int[]in=sc.intArr(n);
  		for(int i=0;i<n;i++){
  			if((in[i]&1)==(i&1)){
  				pw.println(-1);
  				return;
  			}
  		}
  		ans=new LinkedList<>();
  		while(n>1){
  			int posn=0;
  			while(in[posn]!=n)posn++;
  			reverse(in,posn+1);
  			int posn1=0;
  			while(in[posn1]!=(n-1))posn1++;
  			reverse(in,posn1);
  			reverse(in,posn1+2);
  			reverse(in,3);
  			reverse(in,n);
  			n-=2;
  		}
  		pw.println(ans.size());
  		while(!ans.isEmpty())pw.print(ans.pollFirst()+" ");
  		pw.println();
  	}
  	public static void main(String[] args) throws Exception{
  		sc=new MScanner(System.in);
  //		sc=new MScanner("altstadt.in");
  		pw = new PrintWriter(System.out);
  		int tc=1;
          tc=sc.nextInt();
  		for(curt=1;curt<=tc;curt++) {
  //			pw.printf("Case #%d: ", i);
  			main();
  		}
  		
  		pw.flush();
  	}
  	static int curt;
  	static PrintWriter pw;
  	static MScanner sc;
  	static class MScanner {
  		StringTokenizer st;
  		BufferedReader br;
  		public MScanner(InputStream system) {
  			br = new BufferedReader(new InputStreamReader(system));
  		}
  	 
  		public MScanner(String file) throws Exception {
  			br = new BufferedReader(new FileReader(file));
  		}
  	 
  		public String next() throws IOException {
  			while (st == null || !st.hasMoreTokens())
  				st = new StringTokenizer(br.readLine());
  			return st.nextToken();
  		}
  		public int[] intArr(int n) throws IOException {
  	        int[]in=new int[n];for(int i=0;i<n;i++)in[i]=nextInt();
  	        return in;
  		}
  		public long[] longArr(int n) throws IOException {
  	        long[]in=new long[n];for(int i=0;i<n;i++)in[i]=nextLong();
  	        return in;
  		}
  		public int[] intSortedArr(int n) throws IOException {
  	        int[]in=new int[n];for(int i=0;i<n;i++)in[i]=nextInt();
  	        shuffle(in);
  	        Arrays.sort(in);
  	        return in;
  		}
  		public long[] longSortedArr(int n) throws IOException {
  	        long[]in=new long[n];for(int i=0;i<n;i++)in[i]=nextLong();
  	        shuffle(in);
  	        Arrays.sort(in);
  	        return in;
  		}
  		public Integer[] IntegerArr(int n) throws IOException {
  	        Integer[]in=new Integer[n];for(int i=0;i<n;i++)in[i]=nextInt();
  	        return in;
  		}
  		public Long[] LongArr(int n) throws IOException {
  	        Long[]in=new Long[n];for(int i=0;i<n;i++)in[i]=nextLong();
  	        return in;
  		}
  		public String nextLine() throws IOException {
  			return br.readLine();
  		}
  	 
  		public int nextInt() throws IOException {
  			return Integer.parseInt(next());
  		}
  	 
  		public double nextDouble() throws IOException {
  			return Double.parseDouble(next());
  		}
  	 
  		public char nextChar() throws IOException {
  			return next().charAt(0);
  		}
  	 
  		public long nextLong() throws IOException {
  			return Long.parseLong(next());
  		}
  	 
  		public boolean ready() throws IOException {
  			return br.ready();
  		}
  	 
  		public void waitForInput() throws InterruptedException {
  			Thread.sleep(3000);
  		}
  		
  	}
  	static void dbg(int[]in) {
  		System.out.println(Arrays.toString(in));
  	}
  	static void dbg(long[]in) {
  		System.out.println(Arrays.toString(in));
  	}
  	static void sort(int[]in) {
  		shuffle(in);
  		Arrays.sort(in);
  	}
  	static void sort(long[]in) {
  		shuffle(in);
  		Arrays.sort(in);
  	}
  	static void shuffle(int[]in) {
  		for(int i=0;i<in.length;i++) {
  			int idx=(int)(Math.random()*in.length);
  			int tmp=in[i];
  			in[i]=in[idx];
  			in[idx]=tmp;
  		}
  	}
  	static void shuffle(long[]in) {
  		for(int i=0;i<in.length;i++) {
  			int idx=(int)(Math.random()*in.length);
  			long tmp=in[i];
  			in[i]=in[idx];
  			in[idx]=tmp;
  		}
  	}
  }