← Home
```go
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()

	var t int
	if _, err := fmt.Fscan(in, &t); err != nil {
		return
	}

	for i := 0; i < t; i++ {
		var n int
		fmt.Fscan(in, &n)
		
		// We do not need the actual values of the array to solve the problem
		// with this strategy, but we must consume them from the input.
		for j := 0; j < n; j++ {
			var temp int
			fmt.Fscan(in, &temp)
		}

		if n%2 == 0 {
			// If n is even:
			// 1. Apply XOR sum on [1, n]. All elements become S.
			// 2. Apply XOR sum on [1, n]. The sum of n (even) S's is 0. All elements become 0.
			fmt.Fprintln(out, 2)
			fmt.Fprintf(out, "%d %d\n", 1, n)
			fmt.Fprintf(out, "%d %d\n", 1, n)
		} else {
			// If n is odd:
			// 1. [1, n]: All elements become S.
			// 2. [1, n-1]: Range length is n-1 (even). Sum of n-1 S's is 0. Elements 1 to n-1 become 0.
			//    Array state: 0, ..., 0, S.
			// 3. [n-1, n]: Elements are 0, S. XOR sum is S. Both become S.
			//    Array state: 0, ..., 0, S, S.
			// 4. [n-1, n]: Elements are S, S. XOR sum is 0. Both become 0.
			//    Array state: 0, ..., 0, 0, 0.
			fmt.Fprintln(out, 4)
			fmt.Fprintf(out, "%d %d\n", 1, n)
			fmt.Fprintf(out, "%d %d\n", 1, n-1)
			fmt.Fprintf(out, "%d %d\n", n-1, n)
			fmt.Fprintf(out, "%d %d\n", n-1, n)
		}
	}
}
```