description: The new generation external memory contains an array of integers a[1 … n] = [a_1, a_2, …, a_n].
  
  This type of memory does not support changing the value of an arbitrary element. Instead, it allows you to cut out any segment of the given array, cyclically shift (rotate) it by any offset and insert it back into the same place.
  
  Technically, each cyclic shift consists of two consecutive actions: 
  
    1. You may select arbitrary indices l and r (1 ≤ l < r ≤ n) as the boundaries of the segment. 
    2. Then you replace the segment a[l … r] with it's cyclic shift to the left by an arbitrary offset d. The concept of a cyclic shift can be also explained by following relations: the sequence [1, 4, 1, 3] is a cyclic shift of the sequence [3, 1, 4, 1] to the left by the offset 1 and the sequence [4, 1, 3, 1] is a cyclic shift of the sequence [3, 1, 4, 1] to the left by the offset 2. 
  
  
  
  For example, if a = [1, \color{blue}{3, 2, 8}, 5], then choosing l = 2, r = 4 and d = 2 yields a segment a[2 … 4] = [3, 2, 8]. This segment is then shifted by the offset d = 2 to the left, and you get a segment [8, 3, 2] which then takes the place of of the original elements of the segment. In the end you get a = [1, \color{blue}{8, 3, 2}, 5].
  
  Sort the given array a using no more than n cyclic shifts of any of its segments. Note that you don't need to minimize the number of cyclic shifts. Any method that requires n or less cyclic shifts will be accepted.
  
  Input
  
  The first line contains an integer t (1 ≤ t ≤ 1000) — the number of test cases.
  
  The next 2t lines contain the descriptions of the test cases. 
  
  The first line of each test case description contains an integer n (2 ≤ n ≤ 50) — the length of the array. The second line consists of space-separated elements of the array a_i (-10^9 ≤ a_i ≤ 10^9). Elements of array a may repeat and don't have to be unique.
  
  Output
  
  Print t answers to all input test cases. 
  
  The first line of the answer of each test case should contain an integer k (0 ≤ k ≤ n) — the number of actions to sort the array. The next k lines should contain descriptions of the actions formatted as "l r d" (without quotes) where l and r (1 ≤ l < r ≤ n) are the boundaries of the segment being shifted, while d (1 ≤ d ≤ r - l) is the offset value. Please remember that only the cyclic shifts to the left are considered so the chosen segment will be shifted by the offset d to the to the left.
  
  Note that you are not required to find the minimum number of cyclic shifts needed for sorting. Any sorting method where the number of shifts does not exceed n will be accepted.
  
  If the given array a is already sorted, one of the possible answers is k = 0 and an empty sequence of cyclic shifts.
  
  If there are several possible answers, you may print any of them.
  
  Example
  
  Input
  
  
  4
  2
  2 1
  3
  1 2 1
  4
  2 4 1 3
  5
  2 5 1 4 3
  
  
  Output
  
  
  1
  1 2 1
  1
  1 3 2
  3
  2 4 1
  2 3 1
  1 3 2
  4
  2 4 2
  1 5 3
  1 2 1
  1 3 1
  
  Note
  
  Explanation of the fourth data set in the example: 
  
    1. The segment a[2 … 4] is selected and is shifted to the left by 2: [2, \color{blue}{5, 1, 4}, 3] \longrightarrow [2, \color{blue}{4, 5, 1}, 3] 
    2. The segment a[1 … 5] is then selected and is shifted to the left by 3: [\color{blue}{2, 4, 5, 1, 3}] \longrightarrow [\color{blue}{1, 3, 2, 4, 5}] 
    3. After that the segment a[1 … 2] is selected and is shifted to the left by 1: [\color{blue}{1, 3}, 2, 4, 5] \longrightarrow [\color{blue}{3, 1}, 2, 4, 5] 
    4. And in the end the segment a[1 … 3] is selected and is shifted to the left by 1: [\color{blue}{3, 1, 2}, 4, 5] \longrightarrow [\color{blue}{1, 2, 3}, 4, 5] 
solution: import java.util.*;
  import java.io.*;
  import java.lang.reflect.Array;
  import java.awt.Point;
  
  public class Main{
  
      static int mod = (int) (Math.pow(10, 9)+7);
  	static final int dx[] = { -1, 0, 1, 0 }, dy[] = { 0, -1, 0, 1 };
  	static final int[] dx8 = { -1, -1, -1, 0, 0, 1, 1, 1 }, dy8 = { -1, 0, 1, -1, 1, -1, 0, 1 };
  	static final int[] dx9 = { -1, -1, -1, 0, 0, 0, 1, 1, 1 }, dy9 = { -1, 0, 1, -1, 0, 1, -1, 0, 1 };
  	static final int inf = Integer.MAX_VALUE / 2;
  	static final long infL = Long.MAX_VALUE / 3;
  	static final double infD = Double.MAX_VALUE / 3;
  	static final double eps = 1e-10;
  	static final double pi = Math.PI;
      static List<Integer> primeNumbers = new ArrayList<>();
  
      public static void shiftLeft(int[] arr, int left, int right){
          int curr = arr[left];
          for(int i= left ; i < right; i++){
              arr[i] = arr[i+1];
          }
          arr[right]= curr;
      }
      public static void main(String[] args) {
          MyScanner sc = new MyScanner();
          out = new PrintWriter(new BufferedOutputStream(System.out));
  
          int test = sc.nextInt();
          while(test -- > 0){
              int n = sc.nextInt();
              int[] arr = new int[n];
  
              for(int i=  0; i < n; i++) arr[i] = sc.nextInt();
  
              List<String> answer = new ArrayList<>();
          
              //now we all the arrays 
              //find the index of the biggest element
              for(int i = 0 ; i < n ; i++){
                  int index = 0;
                  int max = arr[0];
                  for(int j= 0; j < n-i; j++){
                      if(arr[j] >= max){
                          index = j;
                          max = arr[j];
                      }
                  }
  
                  //then at the 
                  if(index == n-i-1) continue;
  
                  //else
                  answer.add(index+1 + " " + (n-i) + " " + 1);
                  shiftLeft(arr, index , n-i-1);
                  // System.out.println(Arrays.toString(arr));
              }
  
              System.out.println(answer.size());
              for(int i = 0; i < answer.size(); i++){
                  System.out.println(answer.get(i));
              }
  
              // System.out.println(Arrays.toString(arr));
          }
  
          out.close();
      }
  
      //-------------------------------------------------------------------
      //-------------------------------------------------------------------
      //-------------------------------------------------------------------
      //-------------------------------------------------------------------
      //-------------------------------------------------------------------
  
      public static class segmentTree{
  
          public long[] arr;
          public long[] tree;
          public long[] lazy;
  
          segmentTree(long[] array){
              int n = array.length;
              arr = new long[n];
              for(int i= 0; i < n; i++) arr[i] = array[i];
              tree = new long[4*n + 1];
              lazy = new long[4*n + 1];
          }
  
          public void build(int s, int e, int index){
              if(s == e){
                  tree[index] = arr[s];
                  return;
              }
              int mid = (s + e)/2;
              build(s, mid, 2*index);
              build(mid+1, e, 2*index + 1);
              tree[index] = Math.max(tree[2*index], tree[2*index+1]);
          }
  
          //now we have to build query function
          //there are different overlap in it, not very complicated, but definitely a lot useful
          //you should learn them for sure
          public long query(int s, int e, int sr, int er, int index){
              if(lazy[index] != 0){
                  tree[index] = lazy[index];
                  if(s != e){
                      lazy[2*index+1] = lazy[index];
                      lazy[2*index] = lazy[index];
                  }
                  lazy[index] = 0;
              }
              if(er < s || sr > e) return Integer.MIN_VALUE;
              if(sr <= s && e <= er) return tree[index];
              int mid = (s + e)/2;
              long left = query(s, mid, sr, er, 2*index);
              long right = query(mid+1, e, sr, er, 2*index+1);
              return Math.max(left, right);
          }
  
          public void update(int s, int e, int indexr, int increment, int index){
              if(lazy[index] != 0){
                  tree[index] = lazy[index];
                  if(s != e){
                      lazy[2*index+1] = lazy[index];
                      lazy[2*index] = lazy[index];
                  }
                  lazy[index] = 0;
              }
              if(indexr < s || indexr > e) return;
              if(s == e) tree[indexr] = increment;
              int mid = (s + e)/2;
              update(s, mid, indexr, increment, 2*index);
              update(mid+1, e, indexr, increment, 2*index + 1);
              tree[index] = Math.max(tree[2*index+1], tree[2*index]);
          }
  
          public void updateRangeLazy(int s, int e, int sr, int er, long increment, int index){
              if(lazy[index] != 0){
                  tree[index] = lazy[index];
  
                  if(s != e){
                      lazy[2*index + 1] = lazy[index];
                      lazy[2*index] = lazy[index];
                  }
                  lazy[index] = 0;
              }
              if(sr > e || er < s) return;
              if(sr <= s && e <= er){
                  tree[index] = increment;
                  if(s != e){
                      lazy[2*index + 1] = increment;
                      lazy[2*index] = increment;
                  }
                  return;
              }
              int mid = (s + e)/2;
              updateRangeLazy(s, mid, sr, er, increment, 2*index);
              updateRangeLazy(mid+1, e, sr, er, increment, 2*index + 1);
              tree[index] = Math.max(tree[2*index], tree[2*index+1]);
          }
  
      }
  
      //prime sieve
      public static void primeSieve(int n){
          BitSet bitset = new BitSet(n+1);
          for(long i = 0; i < n ; i++){
              if (i == 0 || i == 1) {
                  bitset.set((int) i);
                  continue;
              }
              if(bitset.get((int) i)) continue;
              primeNumbers.add((int)i);
              for(long j = i; j <= n ; j+= i)
                  bitset.set((int)j);
          }
      }
  
      //number of divisors
      public static int countDivisors(long number){
          if(number == 1) return 1;
          List<Integer> primeFactors = new ArrayList<>();
          int index = 0;
          long curr = primeNumbers.get(index);
          while(curr * curr <= number){
              while(number % curr == 0){
                  number = number/curr;
                  primeFactors.add((int) curr);
              }    
              index++;
              curr = primeNumbers.get(index);
          }
  
          if(number != 1) primeFactors.add((int) number);
          int current = primeFactors.get(0);
          int totalDivisors = 1;
          int currentCount = 2;
          for (int i = 1; i < primeFactors.size(); i++) {
              if (primeFactors.get(i) == current) {
                  currentCount++;
              } else {
                  totalDivisors *= currentCount;
                  currentCount = 2;
                  current = primeFactors.get(i);
              }
          }
          totalDivisors *= currentCount;
          return totalDivisors;
      }
  
      //now adding next permutation function to java hehe
      public static boolean next_permutation(int[] p) {
          for (int a = p.length - 2; a >= 0; --a)
            if (p[a] < p[a + 1])
              for (int b = p.length - 1;; --b)
                if (p[b] > p[a]) {
                  int t = p[a];
                  p[a] = p[b];
                  p[b] = t;
                  for (++a, b = p.length - 1; a < b; ++a, --b) {
                    t = p[a];
                    p[a] = p[b];
                    p[b] = t;
                  }
                  return true;
                }
          return false;
      }
  
      //finding the value of NCR in O(RlogN) time and O(1) space
      public static long getNcR(int n, int r)
      {
          long p = 1, k = 1;
          if (n - r < r) r = n - r;
  
          if (r != 0) {
              while (r > 0) {
                  p *= n;
                  k *= r;
                  long m = __gcd(p, k);
                  p /= m;
                  k /= m;
                  n--;
                  r--;
              }
          }
          else {
              p = 1;
          }
          return p;
      }
   
      //for ncr calculator
      public static long __gcd(long n1, long n2)
      {
          long gcd = 1;
          for (int i = 1; i <= n1 && i <= n2; ++i) {
              // Checks if i is factor of both integers
              if (n1 % i == 0 && n2 % i == 0) {
                  gcd = i;
              }
          }
          return gcd;
      }
  
  
  
      //is vowel function 
      public static boolean isVowel(char c)
      {
          return (c=='a' || c=='A' || c=='e' || c=='E' || c=='i' || c=='I' || c=='o' || c=='O' ||     c=='u' || c=='U');
      }   
  
      //two add two big numbers with some mod 
      public static int add(int a, int b) {
  		a+=b;
  		if (a>=mod) return a-mod;
  		return a;
  	}
  	
      //two sub two numbers
  	public static int sub(int a, int b) {
  		a-=b;
  		if (a<0) a+=mod;
  		else if (a>=mod) a-=mod;
  		return a;
  	}
   
      //to sort the array with better method
  	public static void sort(int[] a) {
  		ArrayList<Integer> l=new ArrayList<>();
  		for (int i:a) l.add(i);
  		Collections.sort(l);
  		for (int i=0; i<a.length; i++) a[i]=l.get(i);
  	}
  	
      //for calculating binomialCoeff
      public static int binomialCoeff(int n, int k)
      {
          int C[] = new int[k + 1];
          // nC0 is 1
          C[0] = 1;
          for (int i = 1; i <= n; i++) {
              // Compute next row of pascal
              // triangle using the previous row
              for (int j = Math.min(i, k); j > 0; j--)
                  C[j] = C[j] + C[j - 1];
          }
          return C[k];
      }
  
      //Pair with int int 
      public static class Pair{
  
          public int a;
          public int b;
  
          Pair(int a , int b){
              this.a = a;
              this.b = b;
          }
  
          @Override
          public String toString(){
              return a + " -> " + b; 
          }
      }
  
      //Triplet with int int int
      public static class Triplet{
  
          public int a;
          public int b;
          public int c;
  
          Triplet(int a , int b, int c){
              this.a = a;
              this.b = b;
              this.c = c;
          }
  
          @Override
          public String toString(){
              return a + " -> " + b; 
          }
      }
  
      //Shortcut function
      public static long lcm(long a , long b){
          return a * (b/gcd(a,b));
      }
  
      //let's make one for calculating lcm basically
      public static int lcm(int a , int b){
          return (a * b)/gcd(a,b);
      }
  
      //int version for gcd
      public static int gcd(int a, int b){
          if(b == 0)
              return a;
              
          return gcd(b , a%b);
      }
  
      //long version for gcd
      public static long gcd(long a, long b){
          if(b == 0)
              return a;
  
          return gcd(b , a%b);
      }
  
      //swapping two elements in an array
      public static void swap(int[] arr, int left , int right){
          int temp = arr[left];
          arr[left] = arr[right];
          arr[right] = temp;
      }
  
      //
       //for char array
       public static void swap(char[] arr, int left , int right){
          char temp = arr[left];
          arr[left] = arr[right];
          arr[right] = temp;
      }
  
      //reversing an array
      public static void reverse(int[] arr){
          int left = 0;
          int right = arr.length-1;
  
          while(left <= right){
              swap(arr, left,right);
              left++;
              right--;
          }
      }
  
       
      //-----------PrintWriter for faster output---------------------------------
      public static PrintWriter out;
        
      //-----------MyScanner class for faster input----------
      public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;
   
          public MyScanner() {
              br = new BufferedReader(new InputStreamReader(System.in));
          }
      
          String next() {
              while (st == null || !st.hasMoreElements()) {
                  try {
                      st = new StringTokenizer(br.readLine());
                  } catch (IOException e) {
                      e.printStackTrace();
                  }
              }
              return st.nextToken();
          }
      
          int nextInt() {
              return Integer.parseInt(next());
          }
      
          long nextLong() {
              return Long.parseLong(next());
          }
      
          double nextDouble() {
              return Double.parseDouble(next());
          }
      
          String nextLine(){
              String str = "";
              try {
                  str = br.readLine();
              } catch (IOException e) {
                  e.printStackTrace();
              }
              return str;
          }
  
      }
     //--------------------------------------------------------
  }