Problem: You are given an array a consisting of n elements. You may apply several operations (possibly zero) to it.

During each operation, you choose two indices i and j (1 ≤ i, j ≤ n; i ≠ j), increase a_j by a_i, and remove the i-th element from the array (so the indices of all elements to the right to it decrease by 1, and n also decreases by 1).

Your goal is to make the array a strictly ascending. That is, the condition a_1 < a_2 < ... < a_n should hold (where n is the resulting size of the array).

Calculate the minimum number of actions required to make the array strictly ascending.

Input

The first line contains one integer T (1 ≤ T ≤ 10000) — the number of test cases.

Each test case consists of two lines. The first line contains one integer n (1 ≤ n ≤ 15) — the number of elements in the initial array a.

The second line contains n integers a_1, a_2, ..., a_n (1 ≤ a_i ≤ 10^6).

It is guaranteed that: 

  * the number of test cases having n ≥ 5 is not greater than 5000; 
  * the number of test cases having n ≥ 8 is not greater than 500; 
  * the number of test cases having n ≥ 10 is not greater than 100; 
  * the number of test cases having n ≥ 11 is not greater than 50; 
  * the number of test cases having n ≥ 12 is not greater than 25; 
  * the number of test cases having n ≥ 13 is not greater than 10; 
  * the number of test cases having n ≥ 14 is not greater than 3; 
  * the number of test cases having n ≥ 15 is not greater than 1. 

Output

For each test case, print the answer as follows:

In the first line, print k — the minimum number of operations you have to perform. Then print k lines, each containing two indices i and j for the corresponding operation. Note that the numeration of elements in the array changes after removing elements from it. If there are multiple optimal sequences of operations, print any one of them.

Example

Input


4
8
2 1 3 5 1 2 4 5
15
16384 8192 4096 2048 1024 512 256 128 64 32 16 8 4 2 1
2
3 3
14
1 2 3 4 5 6 7 8 9 10 11 12 13 14


Output


3
6 8
1 6
4 1
7
1 15
1 13
1 11
1 9
1 7
1 5
1 3
1
2 1
0

Note

In the first test case, the sequence of operations changes a as follows:

[2, 1, 3, 5, 1, 2, 4, 5] → [2, 1, 3, 5, 1, 4, 7] → [1, 3, 5, 1, 6, 7] → [2, 3, 5, 6, 7].

Solution (in JAVA):

Solution:
//package ecr086;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.Random;

public class F4 {
	InputStream is;
	PrintWriter out;
	String INPUT = "";
	
	void solve()
	{
		for(int T = ni();T > 0;T--)go();
	}
	
	public static int[] shuffle(int[] a, Random gen){ for(int i = 0, n = a.length;i < n;i++){ int ind = gen.nextInt(n-i)+i; int d = a[i]; a[i] = a[ind]; a[ind] = d; } return a; }

	
	// core [pos][rem]
	void go()
	{
		int n = ni();
		int[] a = na(n);
		int maxlen = 0;
		int arg = 0;
		
		for(int core = (1<<n)-1;core >= 1;core--){
			if(Integer.bitCount(core) <= maxlen)continue;
			int[] o = new int[n];
			int[] b = new int[n];
			
			int p = 0, q = 0;
			for(int i = 0;i < n;i++){
				if(core<<~i>=0){
					b[p++] = i;
				}else{
					o[q++] = i;
				}
			}
			b = Arrays.copyOf(b, p);
			o = Arrays.copyOf(o, q);
			
			int[] sums = new int[1<<p];
			for(int i = 1;i < 1<<p;i++){
				sums[i] = sums[i&i-1] + a[b[Integer.numberOfTrailingZeros(i)]];
			}
			
			boolean[][] dp = new boolean[q+1][1<<p];
			int[][] argmins = new int[q+1][1<<p];
			for(int i = 0;i <= q;i++){
				Arrays.fill(argmins[i], -1);
			}
			dp[0][0] = true;
			argmins[0][0] = 0;
			for(int i = 0;i < q;i++){
				for(int j = (1<<p)-1;j >= 0;j--){
					if(!dp[i][j])continue;
					int minpw = sums[argmins[i][j]] + (i == 0 ? 0 : a[o[i-1]]);
					int mask = ~j&(1<<p)-1;
					for(int l = mask;;l = l-1&mask){
						int npw = a[o[i]] + sums[l];
						if(minpw < npw){
							dp[i+1][j|l] = true;
							if(argmins[i+1][j|l] == -1 ||
									sums[l] < sums[argmins[i+1][j|l]]){
								argmins[i+1][j|l] = l;
							}
						}
						if(l == 0)break;
					}
				}
			}
			if(dp[q][(1<<p)-1]){
				maxlen = Integer.bitCount(core);
				arg = core;
			}
		}
		
		{
			int core = arg;
			int[] o = new int[n];
			int[] b = new int[n];
			
			int p = 0, q = 0;
			for(int i = 0;i < n;i++){
				if(core<<~i>=0){
					b[p++] = i;
				}else{
					o[q++] = i;
				}
			}
			b = Arrays.copyOf(b, p);
			o = Arrays.copyOf(o, q);
			int[] sums = new int[1<<p];
			for(int i = 1;i < 1<<p;i++){
				sums[i] = sums[i&i-1] + a[b[Integer.numberOfTrailingZeros(i)]];
			}
			
			boolean[][] dp = new boolean[q+1][1<<p];
			int[][] argmins = new int[q+1][1<<p];
			for(int i = 0;i <= q;i++){
				Arrays.fill(argmins[i], -1);
			}
			dp[0][0] = true;
			argmins[0][0] = 0;
			for(int i = 0;i < q;i++){
				for(int j = (1<<p)-1;j >= 0;j--){
					if(!dp[i][j])continue;
					int minpw = sums[argmins[i][j]] + (i == 0 ? 0 : a[o[i-1]]);
					int mask = ~j&(1<<p)-1;
					for(int l = mask;;l = l-1&mask){
						int npw = a[o[i]] + sums[l];
						if(minpw < npw){
							dp[i+1][j|l] = true;
							if(argmins[i+1][j|l] == -1 ||
									sums[l] < sums[argmins[i+1][j|l]]){
								argmins[i+1][j|l] = l;
							}
						}
						if(l == 0)break;
					}
				}
			}
			
			if(dp[q][(1<<p)-1]){
				int ptn = (1<<p)-1;
				int[] lasts = new int[q];
				for(int j = q;j >= 1;j--){
					int pl = argmins[j][ptn];
					lasts[j-1] = pl;
					ptn ^= pl;
				}
				
				out.println(n-lasts.length);
				boolean[] alive = new boolean[n];
				Arrays.fill(alive, true);
				
				int h = 0;
				for(int j = 0;j < n;j++){
					if(core<<~j>=0){
						for(int k = 0;k < lasts.length;k++){
							if(lasts[k]<<~h<0){
								int na = 0;
								for(int u = 0;u <= j;u++){
									if(alive[u])na++;
								}
								out.print(na + " ");
								na = 0;
								for(int u = 0;u <= o[k];u++){
									if(alive[u])na++;
								}
								out.println(na);
								alive[j] = false;
							}
						}
						h++;
					}
				}
				return;
			}
		}
	}
	
	
	
	void run() throws Exception
	{
//		int n = 15, m = 1;
//		Random gen = new Random();
//		StringBuilder sb = new StringBuilder();
//		sb.append(m + " ");
//		for(int rep = 0;rep < m;rep++){
//			sb.append(n + " ");
//			for (int i = 0; i < n; i++) {
//				sb.append(gen.nextInt(100)+1 + " ");
//			}
//		}
//		INPUT = sb.toString();

		
		is = oj ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);
		
		long s = System.currentTimeMillis();
		solve();
		out.flush();
		tr(System.currentTimeMillis()-s+"ms");
	}
	
	public static void main(String[] args) throws Exception { new F4().run(); }
	
	private byte[] inbuf = new byte[1024];
	public int lenbuf = 0, ptrbuf = 0;
	
	private int readByte()
	{
		if(lenbuf == -1)throw new InputMismatchException();
		if(ptrbuf >= lenbuf){
			ptrbuf = 0;
			try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }
			if(lenbuf <= 0)return -1;
		}
		return inbuf[ptrbuf++];
	}
	
	private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }
	private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }
	
	private double nd() { return Double.parseDouble(ns()); }
	private char nc() { return (char)skip(); }
	
	private String ns()
	{
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while(!(isSpaceChar(b))){ // when nextLine, (isSpaceChar(b) && b != ' ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}
	
	private char[] ns(int n)
	{
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while(p < n && !(isSpaceChar(b))){
			buf[p++] = (char)b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}
	
	private char[][] nm(int n, int m)
	{
		char[][] map = new char[n][];
		for(int i = 0;i < n;i++)map[i] = ns(m);
		return map;
	}
	
	private int[] na(int n)
	{
		int[] a = new int[n];
		for(int i = 0;i < n;i++)a[i] = ni();
		return a;
	}
	
	private int ni()
	{
		int num = 0, b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}
		
		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}
	
	private long nl()
	{
		long num = 0;
		int b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}
		
		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}
	
	private boolean oj = System.getProperty("ONLINE_JUDGE") != null;
	private void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); }
}