← Home
package main

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

func main() {
	data, _ := io.ReadAll(os.Stdin)
	idx := 0
	nextInt := func() int {
		for idx < len(data) && (data[idx] == ' ' || data[idx] == '\n' || data[idx] == '\r' || data[idx] == '\t') {
			idx++
		}
		sign := 1
		if data[idx] == '-' {
			sign = -1
			idx++
		}
		val := 0
		for idx < len(data) && data[idx] >= '0' && data[idx] <= '9' {
			val = val*10 + int(data[idx]-'0')
			idx++
		}
		return val * sign
	}

	out := bufio.NewWriterSize(os.Stdout, 1<<20)
	defer out.Flush()

	t := nextInt()
	for ; t > 0; t-- {
		n := nextInt()
		a := make([]int, n)
		ones := 0
		for i := 0; i < n; i++ {
			a[i] = nextInt()
			ones += a[i]
		}

		if ones%2 == 1 {
			fmt.Fprintln(out, "NO")
			continue
		}

		ops := make([]int, 0, n)

		apply := func(i int) {
			x := a[i] ^ a[i+1] ^ a[i+2]
			a[i], a[i+1], a[i+2] = x, x, x
			ops = append(ops, i+1)
		}

		if ones == 0 {
			fmt.Fprintln(out, "YES")
			fmt.Fprintln(out, 0)
			fmt.Fprintln(out)
			continue
		}

		pivot := -1
		oddL, oddR := -1, -1
		leftOnes := 0
		for i := 0; i < n; {
			if a[i] == 1 {
				leftOnes++
				i++
				continue
			}
			j := i
			for j < n && a[j] == 0 {
				j++
			}
			if pivot == -1 && leftOnes%2 == 0 {
				pivot = i
			}
			if oddL == -1 && i > 0 && j < n && (j-i)%2 == 1 {
				oddL, oddR = i, j-1
			}
			i = j
		}

		if pivot == -1 {
			if oddL == -1 {
				fmt.Fprintln(out, "NO")
				continue
			}
			for i := oddL - 1; i <= oddR-2; i += 2 {
				apply(i)
			}
			apply(oddR - 1)
			pivot = oddR
		}

		clearPrefix := func(z int) {
			pos := make([]int, 0)
			for i := 0; i < z; i++ {
				if a[i] == 1 {
					pos = append(pos, i)
				}
			}
			for k := len(pos) - 2; k >= 0; k -= 2 {
				x, y := pos[k], pos[k+1]
				for {
					gap := y - x - 1
					if gap <= 1 {
						apply(x)
						break
					}
					apply(y - 2)
					apply(y - 1)
					y -= 2
				}
			}
		}

		clearSuffix := func(z int) {
			pos := make([]int, 0)
			for i := z + 1; i < n; i++ {
				if a[i] == 1 {
					pos = append(pos, i)
				}
			}
			for k := 0; k < len(pos); k += 2 {
				x, y := pos[k], pos[k+1]
				for {
					gap := y - x - 1
					if gap == 0 {
						apply(x - 1)
						break
					}
					if gap == 1 {
						apply(x)
						break
					}
					apply(x)
					apply(x - 1)
					x += 2
				}
			}
		}

		clearPrefix(pivot)
		clearSuffix(pivot)

		fmt.Fprintln(out, "YES")
		fmt.Fprintln(out, len(ops))
		for i, v := range ops {
			if i > 0 {
				fmt.Fprint(out, " ")
			}
			fmt.Fprint(out, v)
		}
		fmt.Fprintln(out)
	}
}