package main

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

func solve(n, d12, d23, d31 int) {
	var mind, maxd int
	b := false
	i := minInt(d12, d31)

	if i == d12 {
		mind = 2
		maxd = 3
	} else {
		mind = 3
		maxd = 2
	}

	for ; i >= 0; i-- {
		if (d12-i)+(d31-i) == d23 {
			b = true
			break
		}
	}

	if !b {
		fmt.Println("No")
		return
	}
	extra := n - ((i + 1) + (d12 - i) + (d31 - i))

	if extra < 0 {
		fmt.Println("No")
		return
	}

	fmt.Println("Yes")

	src := 1
	if i == minInt(d12, d31) {
		src = pathAToB(1, mind, 3, i)
		src = pathAToB(mind, maxd, src-1, maxInt(d12, d31)-i)
	}
	if 0 < i && i < minInt(d12, d31) {
		src = pathAToB(1, 4, 4, i)
		src = pathAToB(4, 2, src-1, d12-i)
		src = pathAToB(4, 3, src-1, d31-i)
	}

	if i == 0 {
		src = pathAToB(1, 2, 3, d12)
		src = pathAToB(1, 3, src-1, d31)
	}
	for ii := n - extra + 1; ii <= n; ii++ {
		fmt.Println(1, ii)
	}

}
func pathAToB(src, dist, cnt, length int) int {
	a := src
	j := 0
	for j = 1; j < length; j++ {
		fmt.Println(a, cnt+j)
		a = cnt + j
	}
	if length > 0 {
		fmt.Println(a, dist)
	}
	return cnt + j
}
func minInt(a, b int) int {
	if a > b {
		return b
	}
	return a
}
func maxInt(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func main() {
	reader := bufio.NewReaderSize(os.Stdin, 16*1024*1024)

	qTemp, err := strconv.ParseInt(strings.TrimSpace(readLine(reader)), 10, 64)
	checkError(err)
	q := int32(qTemp)

	for qItr := 0; qItr < int(q); qItr++ {

		split := strings.Split(strings.TrimSpace(readLine(reader)), " ")
		n, err := strconv.ParseInt(split[0], 10, 64)
		checkError(err)
		d12, err := strconv.ParseInt(split[1], 10, 64)
		checkError(err)
		d23, err := strconv.ParseInt(split[2], 10, 64)
		checkError(err)
		d31, err := strconv.ParseInt(split[3], 10, 64)
		checkError(err)

		solve(int(n), int(d12), int(d23), int(d31))
	}
}

func readLine(reader *bufio.Reader) string {
	str, _, err := reader.ReadLine()
	if err == io.EOF {
		return ""
	}

	return strings.TrimRight(string(str), "\r\n")
}

func checkError(err error) {
	if err != nil {
		panic(err)
	}
}

package main

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

var in = bufio.NewReader(os.Stdin)
var out = bufio.NewWriter(os.Stdout)
var qq = 0
var cnt = 0

func qwq() {
	cnt++
	var n, d12, d23, d31 int
	// fmt.Fscanf(in, "%d %d %d %d", &n, &d12, &d23, &d31)
	fmt.Fscanln(in, &n, &d12, &d23, &d31)
	// fmt.Fprintln(out, n, d12, d23, d31)
	res := [][2]int{}

	d := (d12 + d31 - d23) / 2
	id := 4
	conn := func(v1, v2, v3, d1, d2 int) {
		la := v1
		for i := 1; i < d1; i++ {
			res = append(res, [2]int{la, id})
			la = id
			id++
		}
		res = append(res, [2]int{la, v2})
		la = v2
		for i := 1; i < d2; i++ {
			res = append(res, [2]int{la, id})
			la = id
			id++
		}
		res = append(res, [2]int{la, v3})
		for id <= n {
			res = append(res, [2]int{1, id})
			id++
		}
	}

	if d12+d23 == d31 {
		conn(1, 2, 3, d12, d23)
	} else if d31+d23 == d12 {
		conn(1, 3, 2, d31, d23)
	} else {
		if (d12+d31 < d23) || (d12+d31-d23)%2 != 0 || (d >= d12 || d >= d31) {
			fmt.Fprintln(out, "NO")
			return
		}
		la := 1
		for i := 0; i < d; i++ {
			res = append(res, [2]int{la, id})
			la = id
			id++
		}
		l2 := la
		for i := 1; i < d12-d; i++ {
			res = append(res, [2]int{l2, id})
			l2 = id
			id++
		}
		res = append(res, [2]int{l2, 2})
		l3 := la
		for i := 1; i < d31-d; i++ {
			res = append(res, [2]int{l3, id})
			l3 = id
			id++
		}
		res = append(res, [2]int{l3, 3})
		for id <= n {
			res = append(res, [2]int{1, id})
			id++
		}
	}
	if qq == -1 {
		if cnt == 103 {
			fmt.Fprintln(out, n, d12, d23, d31)
			for _, v := range res {
				fmt.Fprintln(out, v[0], v[1])
			}
		}
	} else {
		if id == n+1 {
			fmt.Fprintln(out, "YES")
			for _, v := range res {
				fmt.Fprintln(out, v[0], v[1])
			}
		} else {
			fmt.Fprintln(out, "NO")
		}
	}
}
func main() {
	defer out.Flush()
	q := 1
	fmt.Fscanln(in, &q)
	qq = q
	for ; q > 0; q-- {
		qwq()
	}
}

package main

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

var _, _, _ = main, rw, do

func main() {
	r, w := bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)
	defer w.Flush()
	rw(r, w)
}

func rw(r io.Reader, w io.Writer) {
	var t int
	fmt.Fscan(r, &t)
	for ti := 0; ti < t; ti++ {
		var n, d12, d23, d31 int
		fmt.Fscan(r, &n, &d12, &d23, &d31)
		w1, w2 := do(n, d12, d23, d31)
		fmt.Fprintln(w, w1)
		for _, v := range w2 {
			fmt.Fprintln(w, v[0], v[1])
		}
	}
}

func do(n, d12, d23, d31 int) (string, [][]int) {
	d := [3][3]int{}
	d[0][1] = d12
	d[1][0] = d12
	d[1][2] = d23
	d[2][1] = d23
	d[0][2] = d31
	d[2][0] = d31
	f := func(x int) (string, [][]int) {
		y := (x + 1) % 3
		z := (x + 2) % 3
		if d[x][y]+d[x][z] == d[y][z] {
			r := [][]int{}
			i := 3
			dxy := d[x][y]
			for k := 0; k < dxy-1; k++ {
				r = append(r, []int{y, i})
				y = i
				i++
			}
			r = append(r, []int{x, y})
			dxz := d[x][z]
			for k := 0; k < dxz-1; k++ {
				r = append(r, []int{i, x})
				x = i
				i++
			}
			r = append(r, []int{x, z})
			for i < n {
				r = append(r, []int{0, i})
				i++
			}
			return "YES", r
		}
		return "NO", nil
	}
	g := func(r [][]int) (string, [][]int) {
		for _, v := range r {
			v[0]++
			v[1]++
			if v[0] == v[1] || v[0] > n || v[1] > n {
				return "NO", nil
			}
		}
		return "YES", r
	}
	for i := 0; i < 3; i++ {
		_, r := f(i)
		if len(r) > 0 {
			return g(r)
		}
	}
	a2 := d12 - d23 + d31
	a := a2 / 2
	b := d12 - a
	c := d31 - a
	if a2 < 0 || a2%2 == 1 || b <= 0 || c <= 0 {
		return "NO", nil
	}
	r := [][]int{}
	i := 3
	h := func(x, a, p int) {
		for k := 0; k < a-1; k++ {
			r = append(r, []int{x, i})
			x = i
			i++
		}
		r = append(r, []int{x, p})
	}
	h(0, a, n-1)
	h(1, b, n-1)
	h(2, c, n-1)
	for i < n-1 {
		r = append(r, []int{0, i})
		i++
	}
	return g(r)
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t, n, d12, d23, d31, l, cnt, rcd int
	fmt.Fscan(in, &t)
	for ; t != 0; t-- {
		fmt.Fscan(in, &n, &d12, &d23, &d31)
		if d12+d23 < d31 || (d12+d23-d31)%2 != 0 {
			fmt.Fprintln(out, "NO")
			continue
		}
		l, cnt = (d12+d23-d31)/2, 4
		if d31+1+l > n {
			fmt.Fprintln(out, "NO")
			continue
		}
		if l == 0 {
			fmt.Fprintln(out, "YES")
			for last, i := 1, 1; i <= d12; i++ {
				if i == d12 {
					fmt.Fprintln(out, last, 2)
				} else {
					fmt.Fprintln(out, last, cnt)
					last, cnt = cnt, cnt+1
				}
			}
			for last, i := 2, 1; i <= d23; i++ {
				if i == d23 {
					fmt.Fprintln(out, last, 3)
				} else {
					fmt.Fprintln(out, last, cnt)
					last, cnt = cnt, cnt+1
				}
			}
			for cnt <= n {
				fmt.Fprintln(out, 1, cnt)
				cnt++
			}
		} else {
			d1m := d12 - l
			if d1m < 0 || d1m > d31 {
				fmt.Fprintln(out, "NO")
				continue
			} else if d1m == 0 {
				rcd = 1
			} else if d1m == d31 {
				rcd = 3
			} else {
				rcd = 4 + d1m - 1
			}
			fmt.Fprintln(out, "YES")
			for last, i := 1, 1; i <= d31; i++ {
				if i == d31 {
					fmt.Fprintln(out, last, 3)
				} else {
					fmt.Fprintln(out, last, cnt)
					last, cnt = cnt, cnt+1
				}
			}
			for last, i := rcd, 1; i <= l; i++ {
				if i == l {
					fmt.Fprintln(out, last, 2)
				} else {
					fmt.Fprintln(out, last, cnt)
					last, cnt = cnt, cnt+1
				}
			}
			for cnt <= n {
				fmt.Fprintln(out, 1, cnt)
				cnt++
			}
		}
	}
}

package main

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

var (
	in = bufio.NewReader(os.Stdin)
	out = bufio.NewWriter(os.Stdout)
)

func ReadInt() int{
	var i int
	fmt.Fscan(in, &i)
	return i
}

func main(){
	defer out.Flush()
	t := ReadInt()
	for ; t > 0; t--{
		n := ReadInt()
		d12, d23, d31 := ReadInt(), ReadInt(), ReadInt()
		tt := d12 + d23 + d31
		if tt % 2 != 0 {
			fmt.Fprintln(out, "NO")
			continue
		}

		tt /= 2

		d1, d2, d3 := tt - d23, tt - d31, tt - d12

		if d1 < 0 || d2 < 0 || d3 < 0 {
			fmt.Fprintln(out, "NO")
			continue
		}

		nodes := d1 + d2 + d3 + 1

		if nodes > n{
			fmt.Fprintln(out,"NO")
			continue
		}

		fmt.Fprintln(out, "YES")

		root,id := 4,5

		if d1==0 {
			root=1
			id=4
		}
		if d2==0{
			root=2
			id=4
		}
		if d3==0{
			root=3
			id=4
		}

		gogo := func(first int, cur int, d int) {
			for ;d>1;d--{
				fmt.Fprintln(out, cur, id)
				cur = id
				id++
			}
			if d > 0 {
				fmt.Fprintln(out, cur, first)
			}
		}

		gogo(1, root, d1)
		gogo(2, root, d2)
		gogo(3, root, d3)

		cur := root
		for ; id <= n; id++{
			fmt.Fprintln(out, cur, id)
			cur = id
		}
	}
}

package main

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

var (
	in = bufio.NewReader(os.Stdin)
	out = bufio.NewWriter(os.Stdout)
)

func ReadInt() int{
	var i int
	fmt.Fscan(in, &i)
	return i
}

func main(){
	defer out.Flush()
	t := ReadInt()
	for ; t > 0; t--{
		n := ReadInt()
		d12, d23, d31 := ReadInt(), ReadInt(), ReadInt()
		tt := d12 + d23 + d31
		if tt % 2 != 0 {
			fmt.Fprintln(out, "NO")
			continue
		}

		tt /= 2

		d1, d2, d3 := tt - d23, tt - d31, tt - d12

		if d1 < 0 || d2 < 0 || d3 < 0 {
			fmt.Fprintln(out, "NO")
			continue
		}

		nodes := d1 + d2 + d3 + 1

		if nodes > n{
			fmt.Fprintln(out,"NO")
			continue
		}

		fmt.Fprintln(out, "YES")

		root,id := 4,5

		if d1==0 {
			root=1
			id=4
		}
		if d2==0{
			root=2
			id=4
		}
		if d3==0{
			root=3
			id=4
		}

		gogo := func(first int, cur int, d int, id *int) {
			for ;d>1;d--{
				fmt.Fprintln(out, cur, *id)
				cur = *id
				*id++
			}
			if d > 0 {
				fmt.Fprintln(out, cur, first)
			}
		}

		gogo(1, root, d1, &id)
		gogo(2, root, d2, &id)
		gogo(3, root, d3, &id)

		cur := root
		for ; id <= n; id++{
			fmt.Fprintln(out, cur, id)
			cur = id
		}
	}
}

package main

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

var (
	in = bufio.NewReader(os.Stdin)
	out = bufio.NewWriter(os.Stdout)
)

func ReadInt() int{
	var i int
	fmt.Fscan(in, &i)
	return i
}

func main(){
	defer out.Flush()
	t := ReadInt()
	for ; t > 0; t--{
		n := ReadInt()
		d12, d23, d31 := ReadInt(), ReadInt(), ReadInt()
		tt := d12 + d23 + d31
		if tt % 2 != 0 {
			fmt.Fprintln(out, "NO")
			continue
		}

		tt /= 2

		d1, d2, d3 := tt - d23, tt - d31, tt - d12

		if d1 < 0 || d2 < 0 || d3 < 0 {
			fmt.Fprintln(out, "NO")
			continue
		}

		nodes := d1 + d2 + d3 + 1

		if nodes > n{
			fmt.Fprintln(out,"NO")
			continue
		}

		fmt.Fprintln(out, "YES")

		root,id := 4,5

		if d1==0 {
			root=1
			id=4
		}
		if d2==0{
			root=2
			id=4
		}
		if d3==0{
			root=3
			id=4
		}

		cur := root
		for ;d1>1;d1--{
			fmt.Fprintln(out, cur, id)
			cur = id
			id++
		}
		if d1 > 0 {
			fmt.Fprintln(out, cur,  1)
		}

		cur = root
		for ;d2>1;d2--{
			fmt.Fprintln(out,cur, id)
			cur = id
			id++
		}
		if d2 > 0{
			fmt.Fprintln(out, cur, 2)
		}

		cur = root
		for ;d3>1;d3--{
			fmt.Fprintln(out, cur, id)
			cur = id
			id++
		}
		if d3 > 0{
			fmt.Fprintln(out, cur, 3)
		}

		cur = root
		for ; id <= n; id++{
			fmt.Fprintln(out, cur, id)
			cur = id
		}
	}
}

package main

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

func buildTree(out *bufio.Writer, sp, ep, len, cnt int) int {
	last := sp
	for i := 1; i < len; i++ {
		fmt.Fprintln(out, last, cnt)
		last, cnt = cnt, cnt+1
	}
	fmt.Fprintln(out, last, ep)
	return cnt
}

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t, n, d1, d2, d3, cnt int
	var p11, p12, p21, p22, p31, p32 int
	fmt.Fscan(in, &t)
	for ; t != 0; t-- {
		fmt.Fscan(in, &n, &d1, &d2, &d3)
		p11, p12, p21, p22, p31, p32 = 1, 2, 2, 3, 3, 1
		cnt = 4
		if d1 < d2 {
			d1, d2 = d2, d1
			p11, p12, p21, p22 = p21, p22, p11, p12
		}
		if d1 < d3 {
			d1, d3 = d3, d1
			p11, p12, p31, p32 = p31, p32, p11, p12
		}
		if d2 < d3 {
			d2, d3 = d3, d2
			p21, p22, p31, p32 = p31, p32, p21, p22
		}

		if d1+1 > n || d2+d3 > n || d1 > d2+d3 || (d2+d3-d1)%2 == 1 {
			fmt.Fprintln(out, "NO")
		} else if d1 == d2+d3 {
			fmt.Fprintln(out, "YES")
			cnt = buildTree(out, p21, p22, d2, cnt)
			cnt = buildTree(out, p31, p32, d3, cnt)
			for last := 1; cnt <= n; cnt, last = cnt+1, cnt {
				fmt.Fprintln(out, last, cnt)
			}
		} else if (((d2 - d3) % 2) == (d1 % 2)) && (d1+d2-d3 <= n) {
			diff := d2 - d3
			l, s := (d1-diff)/2+diff, (d1-diff)/2
			if d2-l < 0 {
				fmt.Fprintln(out, "NO")
				continue
			}
			fmt.Fprintln(out, "YES")
			// fmt.Fprintln(out, diff, l, s)
			cnt = buildTree(out, p11, p12, d1, cnt)
			if p11 == p21 {
				// fmt.Fprintln(out, "------1")
				cnt = buildTree(out, 4+l-1, p22, d2-l, cnt)
			} else if p11 == p22 {
				// fmt.Fprintln(out, "------2")
				cnt = buildTree(out, 4+l-1, p21, d2-l, cnt)
			} else if p12 == p21 {
				// fmt.Fprintln(out, "------3")
				cnt = buildTree(out, 4+s-1, p22, d2-l, cnt)
			} else {
				// fmt.Fprintln(out, "------4")
				cnt = buildTree(out, 4+s-1, p21, d2-l, cnt)
			}
			// fmt.Fprintln(out, "------")
			for last := 1; cnt <= n; cnt, last = cnt+1, cnt {
				fmt.Fprintln(out, last, cnt)
			}
		} else {
			fmt.Fprintln(out, "NO")
		}
	}
}

package main

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

func buildTree(out *bufio.Writer, sp, ep, len, cnt int) int {
	last := sp
	for i := 1; i < len; i++ {
		fmt.Fprintln(out, last, cnt)
		last, cnt = cnt, cnt+1
	}
	fmt.Fprintln(out, last, ep)
	return cnt
}

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t, n, d1, d2, d3, cnt int
	var p11, p12, p21, p22, p31, p32 int
	fmt.Fscan(in, &t)
	for ; t != 0; t-- {
		fmt.Fscan(in, &n, &d1, &d2, &d3)
		p11, p12, p21, p22, p31, p32 = 1, 2, 2, 3, 3, 1
		cnt = 4
		if d1 < d2 {
			d1, d2 = d2, d1
			p11, p12, p21, p22 = p21, p22, p11, p12
		}
		if d1 < d3 {
			d1, d3 = d3, d1
			p11, p12, p31, p32 = p31, p32, p11, p12
		}
		if d2 < d3 {
			d2, d3 = d3, d2
			p21, p22, p31, p32 = p31, p32, p21, p22
		}

		if d1+1 > n || d2+d3 > n || d1 > d2+d3 || (d2+d3-d1)%2 == 1 {
			fmt.Fprintln(out, "NO")
		} else if d1 == d2+d3 {
			fmt.Fprintln(out, "YES")
			cnt = buildTree(out, p21, p22, d2, cnt)
			cnt = buildTree(out, p31, p32, d3, cnt)
			for last := 1; cnt <= n; cnt, last = cnt+1, cnt {
				fmt.Fprintln(out, last, cnt)
			}
		} else if (((d2 - d3) % 2) == (d1 % 2)) && (d1+d2-d3 <= n) {
			diff := d2 - d3
			l, s := (d1-diff)/2+diff, (d1-diff)/2
			if d2-l < 0 {
				fmt.Fprintln(out, "NO")
				continue
			}
			fmt.Fprintln(out, "YES")
			fmt.Fprintln(out, diff, l, s)
			cnt = buildTree(out, p11, p12, d1, cnt)
			if p11 == p21 {
				fmt.Fprintln(out, "------1")
				cnt = buildTree(out, 4+l-1, p22, d2-l, cnt)
			} else if p11 == p22 {
				fmt.Fprintln(out, "------2")
				cnt = buildTree(out, 4+l-1, p21, d2-l, cnt)
			} else if p12 == p21 {
				fmt.Fprintln(out, "------3")
				cnt = buildTree(out, 4+s-1, p22, d2-l, cnt)
			} else {
				fmt.Fprintln(out, "------4")
				cnt = buildTree(out, 4+s-1, p21, d2-l, cnt)
			}
			// fmt.Fprintln(out, "------")
			for last := 1; cnt <= n; cnt, last = cnt+1, cnt {
				fmt.Fprintln(out, last, cnt)
			}
		} else {
			fmt.Fprintln(out, "NO")
		}
	}
}

package main

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

func buildTree(out *bufio.Writer, sp, ep, len, cnt int) int {
	last := sp
	for i := 1; i < len; i++ {
		fmt.Fprintln(out, last, cnt)
		last, cnt = cnt, cnt+1
	}
	fmt.Fprintln(out, last, ep)
	return cnt
}

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t, n, d1, d2, d3, cnt int
	var p11, p12, p21, p22, p31, p32 int
	fmt.Fscan(in, &t)
	for ; t != 0; t-- {
		fmt.Fscan(in, &n, &d1, &d2, &d3)
		p11, p12, p21, p22, p31, p32 = 1, 2, 2, 3, 3, 1
		cnt = 4
		if d1 < d2 {
			d1, d2 = d2, d1
			p11, p12, p21, p22 = p21, p22, p11, p12
		}
		if d1 < d3 {
			d1, d3 = d3, d1
			p11, p12, p31, p32 = p31, p32, p11, p12
		}
		if d2 < d3 {
			d2, d3 = d3, d2
			p21, p22, p31, p32 = p31, p32, p21, p22
		}

		if d1+1 > n || d1 > d2+d3 || (d2+d3-d1)%2 == 1 {
			fmt.Fprintln(out, "NO")
		} else if d1 == d2+d3 && d1+1 <= n {
			fmt.Fprintln(out, "YES")
			cnt = buildTree(out, p21, p22, d2, cnt)
			cnt = buildTree(out, p31, p32, d3, cnt)
			for last := 1; cnt <= n; cnt, last = cnt+1, cnt {
				fmt.Fprintln(out, last, cnt)
			}
		} else if (((d2 - d3) % 2) == (d1 % 2)) && (d1+d2-d3 <= n) {
			diff := d2 - d3
			l, s := (d1-diff)/2+diff, (d1-diff)/2
			if d2-l < 0 {
				fmt.Fprintln(out, "NO")
				continue
			}
			fmt.Fprintln(out, "YES")
			// fmt.Fprintln(out, diff, l, s)
			cnt = buildTree(out, p11, p12, d1, cnt)
			if p11 == p21 {
				// fmt.Fprintln(out, "------1")
				cnt = buildTree(out, 4+l-1, p22, d2-l, cnt)
			} else if p11 == p22 {
				// fmt.Fprintln(out, "------2")
				cnt = buildTree(out, 4+l-1, p21, d2-l, cnt)
			} else if p12 == p21 {
				// fmt.Fprintln(out, "------3")
				cnt = buildTree(out, 4+s-1, p22, d2-l, cnt)
			} else {
				// fmt.Fprintln(out, "------4")
				cnt = buildTree(out, 4+s-1, p21, d2-l, cnt)
			}
			// fmt.Fprintln(out, "------")
			for last := 1; cnt <= n; cnt, last = cnt+1, cnt {
				fmt.Fprintln(out, last, cnt)
			}
		} else {
			fmt.Fprintln(out, "NO")
		}
	}
}

package main

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

func buildTree(out *bufio.Writer, sp, ep, len, cnt int) int {
	last := sp
	for i := 1; i < len; i++ {
		fmt.Fprintln(out, last, cnt)
		last, cnt = cnt, cnt+1
	}
	fmt.Fprintln(out, last, ep)
	return cnt
}

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t, n, d1, d2, d3, cnt int
	var p11, p12, p21, p22, p31, p32 int
	fmt.Fscan(in, &t)
	for ; t != 0; t-- {
		fmt.Fscan(in, &n, &d1, &d2, &d3)
		p11, p12, p21, p22, p31, p32 = 1, 2, 2, 3, 3, 1
		cnt = 4
		if d1 < d2 {
			d1, d2 = d2, d1
			p11, p12, p21, p22 = p21, p22, p11, p12
		}
		if d1 < d3 {
			d1, d3 = d3, d1
			p11, p12, p31, p32 = p31, p32, p11, p12
		}
		if d2 < d3 {
			d2, d3 = d3, d2
			p21, p22, p31, p32 = p31, p32, p21, p22
		}

		if d1+1 > n || d1 > d2+d3 {
			fmt.Fprintln(out, "NO")
		} else if d1 == d2+d3 && d1+1 <= n {
			fmt.Fprintln(out, "YES")
			cnt = buildTree(out, p21, p22, d2, cnt)
			cnt = buildTree(out, p31, p32, d3, cnt)
			for last := 1; cnt <= n; cnt, last = cnt+1, cnt {
				fmt.Fprintln(out, last, cnt)
			}
		} else if (((d2 - d3) % 2) == (d1 % 2)) && (d1+d2-d3 <= n) {
			diff := d2 - d3
			l, s := (d1-diff)/2+diff, (d1-diff)/2
			if d2-l < 0 {
				fmt.Fprintln(out, "NO")
				continue
			}
			fmt.Fprintln(out, "YES")
			// fmt.Fprintln(out, diff, l, s)
			cnt = buildTree(out, p11, p12, d1, cnt)
			if p11 == p21 {
				// fmt.Fprintln(out, "------1")
				cnt = buildTree(out, 4+l-1, p22, d2-l, cnt)
			} else if p11 == p22 {
				// fmt.Fprintln(out, "------2")
				cnt = buildTree(out, 4+l-1, p21, d2-l, cnt)
			} else if p12 == p21 {
				// fmt.Fprintln(out, "------3")
				cnt = buildTree(out, 4+s-1, p22, d2-l, cnt)
			} else {
				// fmt.Fprintln(out, "------4")
				cnt = buildTree(out, 4+s-1, p21, d2-l, cnt)
			}
			// fmt.Fprintln(out, "------")
			for last := 1; cnt <= n; cnt, last = cnt+1, cnt {
				fmt.Fprintln(out, last, cnt)
			}
		} else {
			fmt.Fprintln(out, "NO")
		}
	}
}

package main

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

func buildTree(out *bufio.Writer, sp, ep, len, cnt int) int {
	last := sp
	for i := 1; i < len; i++ {
		fmt.Fprintln(out, last, cnt)
		last, cnt = cnt, cnt+1
	}
	fmt.Fprintln(out, last, ep)
	return cnt
}

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t, n, d1, d2, d3, cnt int
	var p11, p12, p21, p22, p31, p32 int
	fmt.Fscan(in, &t)
	for ; t != 0; t-- {
		fmt.Fscan(in, &n, &d1, &d2, &d3)
		p11, p12, p21, p22, p31, p32 = 1, 2, 2, 3, 3, 1
		cnt = 4
		if d1 < d2 {
			d1, d2 = d2, d1
			p11, p12, p21, p22 = p21, p22, p11, p12
		}
		if d1 < d3 {
			d1, d3 = d3, d1
			p11, p12, p31, p32 = p31, p32, p11, p12
		}
		if d2 < d3 {
			d2, d3 = d3, d2
			p21, p22, p31, p32 = p31, p32, p21, p22
		}

		if d1 == d2+d3 && d1+1 <= n {
			fmt.Fprintln(out, "YES")
			cnt = buildTree(out, p21, p22, d2, cnt)
			cnt = buildTree(out, p31, p32, d3, cnt)
			for last := 1; cnt <= n; cnt, last = cnt+1, cnt {
				fmt.Fprintln(out, last, cnt)
			}
		} else if (((d2 - d3) % 2) == (d1 % 2)) && (d1+d2-d3 <= n) {
			diff := d2 - d3
			l, s := (d1-diff)/2+diff, (d1-diff)/2
			if d2-l < 0 {
				fmt.Fprintln(out, "NO")
				continue
			}
			fmt.Fprintln(out, "YES")
			// fmt.Fprintln(out, diff, l, s)
			cnt = buildTree(out, p11, p12, d1, cnt)
			if p11 == p21 {
				// fmt.Fprintln(out, "------1")
				cnt = buildTree(out, 4+l-1, p22, d2-l, cnt)
			} else if p11 == p22 {
				// fmt.Fprintln(out, "------2")
				cnt = buildTree(out, 4+l-1, p21, d2-l, cnt)
			} else if p12 == p21 {
				// fmt.Fprintln(out, "------3")
				cnt = buildTree(out, 4+s-1, p22, d2-l, cnt)
			} else {
				// fmt.Fprintln(out, "------4")
				cnt = buildTree(out, 4+s-1, p21, d2-l, cnt)
			}
			// fmt.Fprintln(out, "------")
			for last := 1; cnt <= n; cnt, last = cnt+1, cnt {
				fmt.Fprintln(out, last, cnt)
			}
		} else {
			fmt.Fprintln(out, "NO")
		}
	}
}

package main

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

func buildTree(out *bufio.Writer, sp, ep, len, cnt int) int {
	last := sp
	for i := 1; i < len; i++ {
		fmt.Fprintln(out, last, cnt)
		last, cnt = cnt, cnt+1
	}
	fmt.Fprintln(out, last, ep)
	return cnt
}

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t, n, d1, d2, d3, cnt int
	var p11, p12, p21, p22, p31, p32 int
	fmt.Fscan(in, &t)
	for ; t != 0; t-- {
		fmt.Fscan(in, &n, &d1, &d2, &d3)
		p11, p12, p21, p22, p31, p32 = 1, 2, 2, 3, 3, 1
		cnt = 4
		if d1 < d2 {
			d1, d2 = d2, d1
			p11, p12, p21, p22 = p21, p22, p11, p12
		}
		if d1 < d3 {
			d1, d3 = d3, d1
			p11, p12, p31, p32 = p31, p32, p11, p12
		}
		if d2 < d3 {
			d2, d3 = d3, d2
			p21, p22, p31, p32 = p31, p32, p21, p22
		}

		if d1 == d2+d3 && d1+1 <= n {
			fmt.Fprintln(out, "YES")
			cnt = buildTree(out, p21, p22, d2, cnt)
			cnt = buildTree(out, p31, p32, d3, cnt)
			for last := 1; cnt <= n; cnt, last = cnt+1, cnt {
				fmt.Fprintln(out, last, cnt)
			}
		} else if (((d2 - d3) % 2) == (d1 % 2)) && (d1+d2-d3 <= n) {
			diff := d2 - d3
			l, s := (d1-diff)/2+diff, (d1-diff)/2
			if d2-l < 0 {
				fmt.Fprintln(out, "NO")
				continue
			}
			fmt.Fprintln(out, "YES")
			fmt.Fprintln(out, diff, l, s)
			cnt = buildTree(out, p11, p12, d1, cnt)
			if p11 == p21 {
				// fmt.Fprintln(out, "------1")
				cnt = buildTree(out, 4+l-1, p22, d2-l, cnt)
			} else if p11 == p22 {
				// fmt.Fprintln(out, "------2")
				cnt = buildTree(out, 4+l-1, p21, d2-l, cnt)
			} else if p12 == p21 {
				// fmt.Fprintln(out, "------3")
				cnt = buildTree(out, 4+s-1, p22, d2-l, cnt)
			} else {
				// fmt.Fprintln(out, "------4")
				cnt = buildTree(out, 4+s-1, p21, d2-l, cnt)
			}
			// fmt.Fprintln(out, "------")
			for last := 1; cnt <= n; cnt, last = cnt+1, cnt {
				fmt.Fprintln(out, last, cnt)
			}
		} else {
			fmt.Fprintln(out, "NO")
		}
	}
}

package main

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

func buildTree(out *bufio.Writer, sp, ep, len, cnt int) int {
	last := sp
	for i := 1; i < len; i++ {
		fmt.Fprintln(out, last, cnt)
		last, cnt = cnt, cnt+1
	}
	fmt.Fprintln(out, last, ep)
	return cnt
}

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t, n, d1, d2, d3, cnt int
	var p11, p12, p21, p22, p31, p32 int
	fmt.Fscan(in, &t)
	for ; t != 0; t-- {
		fmt.Fscan(in, &n, &d1, &d2, &d3)
		p11, p12, p21, p22, p31, p32 = 1, 2, 2, 3, 3, 1
		cnt = 4
		if d1 < d2 {
			d1, d2 = d2, d1
			p11, p12, p21, p22 = p21, p22, p11, p12
		}
		if d1 < d3 {
			d1, d3 = d3, d1
			p11, p12, p31, p32 = p31, p32, p11, p12
		}
		if d2 < d3 {
			d2, d3 = d3, d2
			p21, p22, p31, p32 = p31, p32, p21, p22
		}

		if d1 == d2+d3 {
			fmt.Fprintln(out, "YES")
			cnt = buildTree(out, p21, p22, d2, cnt)
			cnt = buildTree(out, p31, p32, d3, cnt)
			for last := 1; cnt <= n; cnt, last = cnt+1, cnt {
				fmt.Fprintln(out, last, cnt)
			}
		} else if (((d2 - d3) % 2) == (d1 % 2)) && (d1+d2-d3 <= n) {
			diff := d2 - d3
			l, s := (d1-diff)/2+diff, (d1-diff)/2
			if d2-l < 0 {
				fmt.Fprintln(out, "NO")
				continue
			}
			fmt.Fprintln(out, "YES")
			// fmt.Fprintln(out, diff, l, s)
			cnt = buildTree(out, p11, p12, d1, cnt)
			if p11 == p21 {
				// fmt.Fprintln(out, "------1")
				cnt = buildTree(out, 4+l-1, p22, d2-l, cnt)
			} else if p11 == p22 {
				// fmt.Fprintln(out, "------2")
				cnt = buildTree(out, 4+l-1, p21, d2-l, cnt)
			} else if p12 == p21 {
				// fmt.Fprintln(out, "------3")
				cnt = buildTree(out, 4+s-1, p22, d2-l, cnt)
			} else {
				// fmt.Fprintln(out, "------4")
				cnt = buildTree(out, 4+s-1, p21, d2-l, cnt)
			}
			// fmt.Fprintln(out, "------")
			for last := 1; cnt <= n; cnt, last = cnt+1, cnt {
				fmt.Fprintln(out, last, cnt)
			}
		} else {
			fmt.Fprintln(out, "NO")
		}
	}
}

package main

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

func buildTree(out *bufio.Writer, sp, ep, len, cnt int) int {
	last := sp
	for i := 1; i < len; i++ {
		fmt.Fprintln(out, last, cnt)
		last, cnt = cnt, cnt+1
	}
	fmt.Fprintln(out, last, ep)
	return cnt
}

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t, n, d1, d2, d3, cnt int
	var p11, p12, p21, p22, p31, p32 int
	fmt.Fscan(in, &t)
	for ; t != 0; t-- {
		fmt.Fscan(in, &n, &d1, &d2, &d3)
		p11, p12, p21, p22, p31, p32 = 1, 2, 2, 3, 3, 1
		cnt = 4
		if d1 < d2 {
			d1, d2 = d2, d1
			p11, p12, p21, p22 = p21, p22, p11, p12
		}
		if d1 < d3 {
			d1, d3 = d3, d1
			p11, p12, p31, p32 = p31, p32, p11, p12
		}
		if d2 < d3 {
			d2, d3 = d3, d2
			p21, p22, p31, p32 = p31, p32, p21, p22
		}

		if d1 == d2+d3 {
			fmt.Fprintln(out, "YES")
			cnt = buildTree(out, p21, p22, d2, cnt)
			cnt = buildTree(out, p31, p32, d3, cnt)
			for last := 1; cnt <= n; cnt, last = cnt+1, cnt {
				fmt.Fprintln(out, last, cnt)
			}
		} else if (((d2 - d3) % 2) == (d1 % 2)) && (d1+d2-d3 <= n) {
			diff := d2 - d3
			l, s := (d1-diff)/2+diff, (d1-diff)/2
			if d2-l < 0 {
				fmt.Fprintln(out, "NO")
				continue
			}
			fmt.Fprintln(out, "YES")
			cnt = buildTree(out, p11, p12, d1, cnt)
			// fmt.Fprintln(out, "------")
			if p11 == p21 {
				// fmt.Fprintln(out, "------1")
				cnt = buildTree(out, 4+l-1, p22, d2-l, cnt)
			} else if p11 == p22 {
				// fmt.Fprintln(out, "------2")
				cnt = buildTree(out, 4+l-1, p21, d2-l, cnt)
			} else if p12 == p21 {
				// fmt.Fprintln(out, "------3")
				cnt = buildTree(out, 4+s-1, p22, d2-s, cnt)
			} else {
				// fmt.Fprintln(out, "------4")
				cnt = buildTree(out, 4+s-1, p21, d2-s, cnt)
			}
			for last := 1; cnt <= n; cnt, last = cnt+1, cnt {
				fmt.Fprintln(out, last, cnt)
			}
		} else {
			fmt.Fprintln(out, "NO")
		}
	}
}

package main

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

func buildTree(out *bufio.Writer, sp, ep, len, cnt int) int {
	last := sp
	for i := 1; i < len; i++ {
		fmt.Fprintln(out, last, cnt)
		last, cnt = cnt, cnt+1
	}
	fmt.Fprintln(out, last, ep)
	return cnt
}

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t, n, d1, d2, d3, cnt int
	var p11, p12, p21, p22, p31, p32 int
	fmt.Fscan(in, &t)
	for ; t != 0; t-- {
		fmt.Fscan(in, &n, &d1, &d2, &d3)
		p11, p12, p21, p22, p31, p32 = 1, 2, 2, 3, 3, 1
		cnt = 4
		if d1 < d2 {
			d1, d2 = d2, d1
			p11, p12, p21, p22 = p21, p22, p11, p12
		}
		if d1 < d3 {
			d1, d3 = d3, d1
			p11, p12, p31, p32 = p31, p32, p11, p12
		}
		if d2 < d3 {
			d2, d3 = d3, d2
			p21, p22, p31, p32 = p31, p32, p21, p22
		}

		if d1 == d2+d3 {
			fmt.Fprintln(out, "YES")
			cnt = buildTree(out, p21, p22, d2, cnt)
			cnt = buildTree(out, p31, p32, d3, cnt)
			for last := 1; cnt <= n; cnt, last = cnt+1, cnt {
				fmt.Fprintln(out, last, cnt)
			}
		} else if (((d2 - d3) % 2) == (d1 % 2)) && (d1+d2-d3 <= n) {
			diff := d2 - d3
			l, s := (d1-diff)/2+diff, (d1-diff)/2
			if d2-l < 0 {
				fmt.Fprintln(out, "NO")
				continue
			}
			fmt.Fprintln(out, "YES")
			cnt = buildTree(out, p11, p12, d1, cnt)
			if p11 == p21 {
				cnt = buildTree(out, 4+l-1, p22, d2-l, cnt)
			} else if p11 == p22 {
				cnt = buildTree(out, 4+s-1, p21, d2-s, cnt)
			} else if p12 == p21 {
				cnt = buildTree(out, 4+s-1, p22, d2-s, cnt)
			} else {
				cnt = buildTree(out, 4+l-1, p21, d2-l, cnt)
			}
			for last := 1; cnt <= n; cnt, last = cnt+1, cnt {
				fmt.Fprintln(out, last, cnt)
			}
		} else {
			fmt.Fprintln(out, "NO")
		}
	}
}

package main

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

var (
	in = bufio.NewReader(os.Stdin)
	out = bufio.NewWriter(os.Stdout)
)

func ReadInt() int{
	var i int
	fmt.Fscan(in, &i)
	return i
}

func main(){
	defer out.Flush()
	t := ReadInt()
	for ; t > 0; t--{
		n := ReadInt()
		d12, d23, d31 := ReadInt(), ReadInt(), ReadInt()
		tt := d12 + d23 + d31
		if tt % 2 != 0{
			fmt.Fprintln(out, "NO")
			continue
		}
		tt /= 2
		d1, d2, d3 := tt - d23, tt - d31, tt - d12

		if d1 < 0 || d2 < 0 || d3 < 0{
			fmt.Fprintln(out, "NO")
			continue
		}

		nodes := d1 + d2 + d3 + 1

		if d1 == 0 || d2 == 0 || d3 == 0 {
			nodes--
		}

		if d1 + d2 + d3 + 1 > n{
			fmt.Fprintln(out,"NO")
			continue
		}

		fmt.Fprintln(out, "YES")

		root,id := 4,5
		if d1==0 {
			root=1
			id=4
		}
		if d2==0{
			root=2
			id=4
		}
		if d3==0{
			root=3
			id=4
		}

		cur := root
		for ;d1>1;d1--{
			if cur == root{
				fmt.Fprintln(out, root, id)
			} else{
				fmt.Fprintln(out, id, id + 1)
			}
			cur = id
			id++
		}
		if d1 > 0 {
			fmt.Fprintln(out, cur,  1)
		}

		cur = root
		for ;d2>1;d2--{
			if cur == root{
				fmt.Fprintln(out, root, id)
			} else{
				fmt.Fprintln(out, id, id + 1)
			}
			cur = id
			id++
		}
		if d2 > 0{
			fmt.Fprintln(out, cur, 2)
		}

		cur = root
		for ;d3>1;d3--{
			if cur == root{
				fmt.Fprintln(out, root, id)
			} else{
				fmt.Fprintln(out, id, id + 1)
			}
			cur = id
			id++
		}
		if d3 > 0{
			fmt.Fprintln(out, cur, 3)
		}

		cur = 3
		for ; id <= n; id++{
			if cur == 3{
				fmt.Fprintln(out, cur, id)
			}else{
				fmt.Fprintln(out, id - 1, id)
			}
			cur = id
		}
	}
}

package main

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

var (
	in = bufio.NewReader(os.Stdin)
	out = bufio.NewWriter(os.Stdout)
)

func ReadInt() int{
	var i int
	fmt.Fscan(in, &i)
	return i
}

func main(){
	defer out.Flush()
	t := ReadInt()
	for ; t > 0; t--{
		n := ReadInt()
		d12, d23, d31 := ReadInt(), ReadInt(), ReadInt()
		tt := d12 + d23 + d31
		if tt % 2 != 0{
			fmt.Fprintln(out, "NO")
			continue
		}
		tt /= 2
		d1, d2, d3 := tt - d23, tt - d31, tt - d12

		if d1 < 0 || d2 < 0 || d3 < 0{
			fmt.Fprintln(out, "NO")
			continue
		}

		if d1 + d2 + d3 + 1 > n{
			fmt.Fprintln(out,"NO")
			continue
		}

		fmt.Fprintln(out, "YES")

		root,id := 4,5
		if d1==0 {
			root=1
			id=4
		}
		if d2==0{
			root=2
			id=4
		}
		if d3==0{
			root=3
			id=4
		}

		cur := root
		for ;d1>1;d1--{
			if cur == root{
				fmt.Fprintln(out, root, id)
			} else{
				fmt.Fprintln(out, id, id + 1)
			}
			cur = id
			id++
		}
		if d1 > 0 {
			fmt.Fprintln(out, cur,  1)
		}

		cur = root
		for ;d2>1;d2--{
			if cur == root{
				fmt.Fprintln(out, root, id)
			} else{
				fmt.Fprintln(out, id, id + 1)
			}
			cur = id
			id++
		}
		if d2 > 0{
			fmt.Fprintln(out, cur, 2)
		}

		cur = root
		for ;d3>1;d3--{
			if cur == root{
				fmt.Fprintln(out, root, id)
			} else{
				fmt.Fprintln(out, id, id + 1)
			}
			cur = id
			id++
		}
		if d3 > 0{
			fmt.Fprintln(out, cur, 3)
		}

		cur = 3
		for ; id <= n; id++{
			if cur == 3{
				fmt.Fprintln(out, cur, id)
			}else{
				fmt.Fprintln(out, id - 1, id)
			}
			cur = id
		}
	}
}

package main

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

var (
	in = bufio.NewReader(os.Stdin)
	out = bufio.NewWriter(os.Stdout)
)

func ReadInt() int{
	var i int
	fmt.Fscan(in, &i)
	return i
}

func main(){
	defer out.Flush()
	t := ReadInt()
	for ; t > 0; t--{
		n := ReadInt()
		d12, d23, d31 := ReadInt(), ReadInt(), ReadInt()
		tt := d12 + d23 + d31
		if tt % 2 != 0{
			fmt.Fprintln(out, "NO")
			continue
		}
		tt /= 2
		d1, d2, d3 := tt - d23, tt - d31, tt - d12

		if d1 < 0 || d2 < 0 || d3 < 0{
			fmt.Fprintln(out, "NO")
			continue
		}

		if d1 + d2 + d3 + 1 > n{
			fmt.Fprintln(out,"NO")
			continue
		}

		fmt.Fprintln(out, "YES")

		root,id := 4,5
		if d1==0 {
			root=1
			id=4
		}
		if d2==0{
			root=2
			id=4
		}
		if d3==0{
			root=3
			id=4
		}

		cur := root
		for ;d1>1;d1--{
			if cur == root{
				fmt.Fprintln(out, root, id)
			} else{
				fmt.Fprintln(out, id, id + 1)
			}
			cur = id
			id++
		}
		if d1 > 0{
			fmt.Fprintln(out, cur,  1)
		}

		cur = root
		for ;d2>1;d2--{
			if cur == root{
				fmt.Fprintln(out, root, id)
			} else{
				fmt.Fprintln(out, id, id + 1)
			}
			cur = id
			id++
		}
		if d2 > 0{
			fmt.Fprintln(out, cur, 2)
		}

		cur = root
		for ;d3>1;d3--{
			if cur == root{
				fmt.Fprintln(out, root, id)
			} else{
				fmt.Fprintln(out, id, id + 1)
			}
			cur = id
			id++
		}
		if d3 > 0{
			fmt.Fprintln(out, cur, 3)
		}

		cur = 3
		for ; id <= n; id++{
			if cur == 3{
				fmt.Fprintln(out, cur, id)
			}else{
				fmt.Fprintln(out, id, id + 1)
			}
			cur = id
			id++
		}
	}
}

package main

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

var (
	in = bufio.NewReader(os.Stdin)
	out = bufio.NewWriter(os.Stdout)
)

func ReadInt() int{
	var i int
	fmt.Fscan(in, &i)
	return i
}

func main(){
	defer out.Flush()
	t := ReadInt()
	for ; t > 0; t--{
		n := ReadInt()
		d12, d23, d31 := ReadInt(), ReadInt(), ReadInt()
		tt := d12 + d23 + d31
		if tt % 2 != 0{
			fmt.Fprintln(out, "NO")
			continue
		}
		tt /= 2
		d1, d2, d3 := tt - d23, tt - d31, tt - d12

		if d1 < 0 || d2 < 0 || d3 < 0{
			fmt.Fprintln(out, "NO")
			continue
		}

		if d1 + d2 + d3 + 1 > n{
			fmt.Fprintln(out,"NO")
			continue
		}

		fmt.Fprintln(out, "YES")

		root,id := 4,5
		if d1==0 {
			root=1
			id=4
		}
		if d2==0{
			root=2
			id=4
		}
		if d3==0{
			root=3
			id=4
		}

		cur := root
		for ;d1>1;d1--{
			if cur == root{
				fmt.Fprintln(out, root, id)
			} else{
				fmt.Fprintln(out, id, id + 1)
			}
			cur = id
			id++
		}
		if d1 > 0{
			fmt.Fprintln(out, cur,  1)
		}

		cur = root
		for ;d2>1;d2--{
			if cur == root{
				fmt.Fprintln(out, root, id)
			} else{
				fmt.Fprintln(out, id, id + 1)
			}
			cur = id
			id++
		}
		if d2 > 0{
			fmt.Fprintln(out, cur, 2)
		}

		cur = root
		for ;d3>1;d3--{
			if cur == root{
				fmt.Fprintln(out, root, id)
			} else{
				fmt.Fprintln(out, id, id + 1)
			}
			cur = id
			id++
		}
		if d3 > 0{
			fmt.Fprintln(out, cur, 3)
		}

		cur = 3
		for ; id <= n; id++{
			if cur == 3{
				fmt.Fprintln(out, cur, id)
			}else{
				fmt.Println(out, id, id + 1)
			}
			cur = id
			id++
		}
	}
}

package main

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

var in = bufio.NewReader(os.Stdin)
var out = bufio.NewWriter(os.Stdout)
var qq = 0
var cnt = 0

func qwq() {
	cnt++
	var n, d12, d23, d31 int
	// fmt.Fscanf(in, "%d %d %d %d", &n, &d12, &d23, &d31)
	fmt.Fscanln(in, &n, &d12, &d23, &d31)
	// fmt.Fprintln(out, n, d12, d23, d31)
	res := [][2]int{}

	d := (d12 + d31 - d23) / 2
	id := 4
	conn := func(v1, v2, v3, d1, d2 int) {
		la := v1
		for i := 1; i < d1; i++ {
			res = append(res, [2]int{la, id})
			la = id
			id++
		}
		res = append(res, [2]int{la, v2})
		la = v2
		for i := 1; i < d2; i++ {
			res = append(res, [2]int{la, id})
			la = id
			id++
		}
		res = append(res, [2]int{la, v3})
		for id <= n {
			res = append(res, [2]int{1, id})
			id++
		}
	}

	if d12+d23 == d31 {
		conn(1, 2, 3, d12, d23)
	} else if d31+d23 == d12 {
		conn(1, 3, 2, d31, d23)
	} else {
		if (d12+d31 < d23) || (d12+d31-d23)%2 != 0 {
			fmt.Fprintln(out, "NO")
			return
		}
		la := 1
		for i := 0; i < d; i++ {
			res = append(res, [2]int{la, id})
			la = id
			id++
		}
		l2 := la
		for i := 1; i < d12-d; i++ {
			res = append(res, [2]int{l2, id})
			l2 = id
			id++
		}
		res = append(res, [2]int{l2, 2})
		l3 := la
		for i := 1; i < d31-d; i++ {
			res = append(res, [2]int{l3, id})
			l3 = id
			id++
		}
		res = append(res, [2]int{l3, 3})
		for id <= n {
			res = append(res, [2]int{1, id})
			id++
		}
	}
	if qq == 8280 {
		if cnt == 103 {
			fmt.Fprintln(out, n, d12, d23, d31)
			for _, v := range res {
				fmt.Fprintln(out, v[0], v[1])
			}
		}
	} else {
		if id == n+1 {
			fmt.Fprintln(out, "YES")
			for _, v := range res {
				fmt.Fprintln(out, v[0], v[1])
			}
		} else {
			fmt.Fprintln(out, "NO")
		}
	}
}
func main() {
	defer out.Flush()
	q := 1
	fmt.Fscanln(in, &q)
	qq = q
	for ; q > 0; q-- {
		qwq()
	}
}

package main

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

var in = bufio.NewReader(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func qwq() {
	var n, d12, d23, d31 int
	// fmt.Fscanf(in, "%d %d %d %d", &n, &d12, &d23, &d31)
	fmt.Fscanln(in, &n, &d12, &d23, &d31)
	// fmt.Fprintln(out, n, d12, d23, d31)
	res := [][2]int{}

	d := (d12 + d31 - d23) / 2
	id := 4
	conn := func(v1, v2, v3, d1, d2 int) {
		la := v1
		for i := 1; i < d1; i++ {
			res = append(res, [2]int{la, id})
			la = id
			id++
		}
		res = append(res, [2]int{la, v2})
		la = v2
		for i := 1; i < d2; i++ {
			res = append(res, [2]int{la, id})
			la = id
			id++
		}
		res = append(res, [2]int{la, v3})
		for id <= n {
			res = append(res, [2]int{1, id})
			id++
		}
	}

	if d12+d23 == d31 {
		conn(1, 2, 3, d12, d23)
	} else if d31+d23 == d12 {
		conn(1, 3, 2, d31, d23)
	} else {
		if (d12+d31 < d23) || (d12+d31-d23)%2 != 0 {
			fmt.Fprintln(out, "NO")
			return
		}
		la := 1
		for i := 0; i < d; i++ {
			res = append(res, [2]int{la, id})
			la = id
			id++
		}
		l2 := la
		for i := 1; i < d12-d; i++ {
			res = append(res, [2]int{l2, id})
			l2 = id
			id++
		}
		res = append(res, [2]int{l2, 2})
		l3 := la
		for i := 1; i < d31-d; i++ {
			res = append(res, [2]int{l3, id})
			l3 = id
			id++
		}
		res = append(res, [2]int{l3, 3})
		for id <= n {
			res = append(res, [2]int{1, id})
			id++
		}
	}
	if id == n+1 {
		fmt.Fprintln(out, "YES")
		for _, v := range res {
			fmt.Fprintln(out, v[0], v[1])
		}
	} else {
		fmt.Fprintln(out, "NO")
	}
}
func main() {
	defer out.Flush()
	q := 1
	fmt.Fscanln(in, &q)
	for ; q > 0; q-- {
		qwq()
	}
}

package main

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

func solve(n, d12, d23, d31 int) {
	var mind, maxd int
	b := false
	i := minInt(d12, d31)

	if i == d12 {
		mind = 2
		maxd = 3
	} else {
		mind = 3
		maxd = 2
	}

	for ; i >= 0; i-- {
		if (d12-i)+(d31-i) == d23 {
			b = true
			break
		}
	}

	if !b {
		fmt.Println("No")
		return
	}
	extra := n - ((i + 1) + (d12 - i) + (d31 - i))

	if extra < 0 {
		fmt.Println("No")
		return
	}

	fmt.Println("Yes")

	src := 1
	if i == minInt(d12, d31) {
		src = pathAToB(1, mind, 3, i)
		src = pathAToB(mind, maxd, src-1, maxInt(d12, d31)-i)
	}
	if 0 < i && i < minInt(d12, d31) {
		src = pathAToB(1, 3+i, 4, i)
		src = pathAToB(3+i, 2, src-1, d12-i)
		src = pathAToB(3+i, 3, src-1, d31-i)
	}

	if i == 0 {
		src = pathAToB(1, 2, 3, d12)
		src = pathAToB(1, 3, src-1, d31)
	}
	for ii := n - extra + 1; ii <= n; ii++ {
		fmt.Println(1, ii)
	}

}
func pathAToB(src, dist, cnt, length int) int {
	a := src
	j := 0
	for j = 1; j < length; j++ {
		fmt.Println(a, cnt+j)
		a = cnt + j
	}
	if length > 0 {
		fmt.Println(a, dist)
	}
	return cnt + j
}
func minInt(a, b int) int {
	if a > b {
		return b
	}
	return a
}
func maxInt(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func main() {
	reader := bufio.NewReaderSize(os.Stdin, 16*1024*1024)

	qTemp, err := strconv.ParseInt(strings.TrimSpace(readLine(reader)), 10, 64)
	checkError(err)
	q := int32(qTemp)

	for qItr := 0; qItr < int(q); qItr++ {

		split := strings.Split(strings.TrimSpace(readLine(reader)), " ")
		n, err := strconv.ParseInt(split[0], 10, 64)
		checkError(err)
		d12, err := strconv.ParseInt(split[1], 10, 64)
		checkError(err)
		d23, err := strconv.ParseInt(split[2], 10, 64)
		checkError(err)
		d31, err := strconv.ParseInt(split[3], 10, 64)
		checkError(err)

		solve(int(n), int(d12), int(d23), int(d31))
	}
}

func readLine(reader *bufio.Reader) string {
	str, _, err := reader.ReadLine()
	if err == io.EOF {
		return ""
	}

	return strings.TrimRight(string(str), "\r\n")
}

func checkError(err error) {
	if err != nil {
		panic(err)
	}
}

package main

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

func solve(n, d12, d23, d31 int) {
	var mind, maxd int
	b := false
	i := minInt(d12, d31)

	if i == d12 {
		mind = 2
		maxd = 3
	} else {
		mind = 3
		maxd = 2
	}

	for ; i >= 0; i-- {
		if (d12-i)+(d31-i) == d23 {
			b = true
			break
		}
	}

	if !b {
		fmt.Println("No")
		return
	}
	extra := n - ((i + 1) + (d12 - i) + (d31 - i))

	if extra < 0 {
		fmt.Println("No")
		return
	}

	fmt.Println("Yes")

	src := 1
	if i == minInt(d12, d31) {
		src = pathAToB(1, mind, 3, i)
		src = pathAToB(mind, maxd, src-1, maxInt(d12, d31)-i)
	}
	if 0 < i && i < minInt(d12, d31) {
		src = pathAToB(1, 3+i, 3, i)
		src = pathAToB(3+i, 2, src-1, d12-i)
		src = pathAToB(3+i, 3, src-1, d31-i)
	}

	if i == 0 {
		src = pathAToB(1, 2, 3, d12)
		src = pathAToB(1, 3, src-1, d31)
	}
	for ii := n - extra + 1; ii <= n; ii++ {
		fmt.Println(1, ii)
	}

}
func pathAToB(src, dist, cnt, length int) int {
	a := src
	j := 0
	for j = 1; j < length; j++ {
		fmt.Println(a, cnt+j)
		a = cnt + j
	}
	if length > 0 {
		fmt.Println(a, dist)
	}
	return cnt + j
}
func minInt(a, b int) int {
	if a > b {
		return b
	}
	return a
}
func maxInt(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func main() {
	reader := bufio.NewReaderSize(os.Stdin, 16*1024*1024)

	qTemp, err := strconv.ParseInt(strings.TrimSpace(readLine(reader)), 10, 64)
	checkError(err)
	q := int32(qTemp)

	for qItr := 0; qItr < int(q); qItr++ {

		split := strings.Split(strings.TrimSpace(readLine(reader)), " ")
		n, err := strconv.ParseInt(split[0], 10, 64)
		checkError(err)
		d12, err := strconv.ParseInt(split[1], 10, 64)
		checkError(err)
		d23, err := strconv.ParseInt(split[2], 10, 64)
		checkError(err)
		d31, err := strconv.ParseInt(split[3], 10, 64)
		checkError(err)

		solve(int(n), int(d12), int(d23), int(d31))
	}
}

func readLine(reader *bufio.Reader) string {
	str, _, err := reader.ReadLine()
	if err == io.EOF {
		return ""
	}

	return strings.TrimRight(string(str), "\r\n")
}

func checkError(err error) {
	if err != nil {
		panic(err)
	}
}

package main

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

var _, _, _ = main, rw, do

func main() {
	r, w := bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)
	defer w.Flush()
	rw(r, w)
}

func rw(r io.Reader, w io.Writer) {
	var t int
	fmt.Fscan(r, &t)
	for ti := 0; ti < t; ti++ {
		var n, d12, d23, d31 int
		fmt.Fscan(r, &n, &d12, &d23, &d31)
		w1, w2 := do(n, d12, d23, d31)
		fmt.Fprintln(w, w1)
		for _, v := range w2 {
			fmt.Fprintln(w, v[0], v[1])
		}
	}
}

func do(n, d12, d23, d31 int) (string, [][]int) {
	d := [3][3]int{}
	d[0][1] = d12
	d[1][0] = d12
	d[1][2] = d23
	d[2][1] = d23
	d[0][2] = d31
	d[2][0] = d31
	f := func(x int) (string, [][]int) {
		y := (x + 1) % 3
		z := (x + 2) % 3
		if d[x][y]+d[x][z] == d[y][z] {
			r := [][]int{}
			i := 3
			dxy := d[x][y]
			for k := 0; k < dxy-1; k++ {
				r = append(r, []int{y, i})
				y = i
				i++
			}
			r = append(r, []int{x, y})
			dxz := d[x][z]
			for k := 0; k < dxz-1; k++ {
				r = append(r, []int{i, x})
				x = i
				i++
			}
			r = append(r, []int{x, z})
			for i < n {
				r = append(r, []int{0, i})
				i++
			}
			return "YES", r
		}
		return "NO", nil
	}
	g := func(r [][]int) [][]int {
		for _, v := range r {
			v[0]++
			v[1]++
		}
		return r
	}
	for i := 0; i < 3; i++ {
		s, r := f(i)
		if len(r) > 0 {
			return s, g(r)
		}
	}
	a2 := d12 - d23 + d31
	a := a2 / 2
	b := d12 - a
	c := d31 - a
	if a2 < 0 || a2%2 == 1 || b <= 0 || c <= 0 {
		return "NO", nil
	}
	r := [][]int{}
	i := 3
	h := func(x, a, p int) {
		for k := 0; k < a-1; k++ {
			r = append(r, []int{x, i})
			x = i
			i++
		}
		r = append(r, []int{x, p})
	}
	h(0, a, n-1)
	h(1, b, n-1)
	h(2, c, n-1)
	for i < n-1 {
		r = append(r, []int{0, i})
		i++
	}
	return "YES", g(r)
}


package main

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

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

  line, _ := reader.ReadString('\n')
  line = strings.TrimSpace(line)
  parts := strings.Split(line, ".")
  n := len(parts)
  if n < 2 {
    writer.WriteString("NO\n")
    return
  }
  result := make([]string, n - 1)

  for i := range result {
    s, t := parts[i], parts[i + 1]
    a, b := len(s), len(t)
    if a < 1 || a > 8 || b == 0 {
      writer.WriteString("NO\n")
      return
    }
    c := b - 1
    if c < 1 {
      c = 1
    } else if c > 3 {
      c = 3
    }
    t, parts[i + 1] = t[:c], t[c:]
    result[i] = s + "." + t
  }
  result[n - 2] += parts[n - 1]
  if strings.Index(result[n - 2], ".") < len(result[n - 2]) - 4 {
    writer.WriteString("NO\n")
    return
  }

  writer.WriteString("YES\n")
  for _, name := range result {
    writer.WriteString(fmt.Sprintf("%s\n", name))
  }
}

package main

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

func main()  {
	var str string
	scanner := bufio.NewScanner(os.Stdin)
	//adjust the capacity to your need (max characters in line)
	const maxCapacity = 512*1024
	buf := make([]byte, maxCapacity)
	scanner.Buffer(buf, maxCapacity)
	scanner.Split(bufio.ScanLines)
	scanner.Scan()
	str = scanner.Text()
	var i int = 0
	for ; i < len(str); i++{
		if str[i] == '.'{break}
	}
	if i > 8 || i==0 {
		fmt.Printf("NO")

	}else{
		prev := i + 1
		i++
		for ; i < len(str); i++{
			if str[i] == '.'{
				if i - prev > 11 || i - prev < 2{
					break
				}else{
					prev = i + 1
				}
			}
		}
		if i != len(str){
			fmt.Printf("NO")

		}else if i - prev > 3 || i == prev {
			fmt.Printf("NO")

		}else {
			fmt.Println("YES")
			strs := strings.Split(str,".")
			prev := 0
			for i=0; i< len(strs)-2; i++{
				fmt.Printf("%s.",strs[i][prev:])
				if len(strs[i+1]) < 4 {//xxx.a xxx
					prev = 1
				}else{ //xxx.aaa xxx
					prev = 3
				}
				fmt.Printf("%s\n",strs[i+1][:prev])
			}
			fmt.Printf("%s.%s\n",strs[i][prev:],strs[i+1])
		}
	}

}

package main

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

func main()  {
	var str string
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanLines)
	scanner.Scan()
	str = scanner.Text()
	var i int = 0
	for ; i < len(str); i++{
		if str[i] == '.'{break}
	}
	if i > 8 || i==0 {
		fmt.Printf("NO")
	}else{
		prev := i + 1
		i++
		for ; i < len(str); i++{
			if str[i] == '.'{
				if i - prev > 11 || i - prev < 2{
					break
				}else{
					prev = i + 1
				}
			}
		}
		if i != len(str){
			fmt.Printf("NO")
			if len(str) > 20 && str[:15] == "acabaea.aadabac"{
				fmt.Printf("len %v, str %s",i,str[i-20:i])
			}
		}else if i - prev > 3 || i == prev {
			fmt.Printf("NO")
			if len(str) > 20 && str[:15] == "acabaea.aadabac"{
				fmt.Printf("len %v, str %s",i,str[i-20:i])
			}
		}else {
			fmt.Println("YES")
			strs := strings.Split(str,".")
			prev := 0
			for i=0; i< len(strs)-2; i++{
				fmt.Printf("%s.",strs[i][prev:])
				if len(strs[i+1]) < 4 {//xxx.a xxx
					prev = 1
				}else{ //xxx.aaa xxx
					prev = 3
				}
				fmt.Printf("%s\n",strs[i+1][:prev])
			}
			fmt.Printf("%s.%s\n",strs[i][prev:],strs[i+1])
		}
	}

}

package main

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

func main()  {
	var str string
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanLines)
	scanner.Scan()
	str = scanner.Text()
	var i int = 0
	for ; i < len(str); i++{
		if str[i] == '.'{break}
	}
	if i > 8 || i==0 {
		if len(str) > 20 && str[:15] == "acabaea.aadabac"{
			fmt.Printf("1len %v, str %s",i,str[i-20:i])
		}
		fmt.Printf("NO")

	}else{
		prev := i + 1
		i++
		for ; i < len(str); i++{
			if str[i] == '.'{
				if i - prev > 11 || i - prev < 2{
					break
				}else{
					prev = i + 1
				}
			}
		}
		if i != len(str){
			if len(str) > 20 && str[:15] == "acabaea.aadabac"{
				fmt.Printf("2len %v, str %s",i,str[i-20:i])
			}
			fmt.Printf("NO")

		}else if i - prev > 3 || i == prev {
			if len(str) > 20 && str[:15] == "acabaea.aadabac"{
				fmt.Printf("3len %v, str %s",i,str[i-20:i])
			}
			fmt.Printf("NO")

		}else {
			fmt.Println("YES")
			strs := strings.Split(str,".")
			prev := 0
			for i=0; i< len(strs)-2; i++{
				fmt.Printf("%s.",strs[i][prev:])
				if len(strs[i+1]) < 4 {//xxx.a xxx
					prev = 1
				}else{ //xxx.aaa xxx
					prev = 3
				}
				fmt.Printf("%s\n",strs[i+1][:prev])
			}
			fmt.Printf("%s.%s\n",strs[i][prev:],strs[i+1])
		}
	}

}

package main

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

func main()  {
	var str string
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanLines)
	scanner.Scan()
	str = scanner.Text()
	var i int = 0
	for ; i < len(str); i++{
		if str[i] == '.'{break}
	}
	if i > 8 || i==0 {
		fmt.Println("NO")
	}else{
		prev := i + 1
		i++
		for ; i < len(str); i++{
			if str[i] == '.'{
				if i - prev > 11 || i - prev < 2{
					break
				}else{
					prev = i + 1
				}
			}
		}
		if i != len(str){
			fmt.Println("NO")
			if len(str) > 20 && str[:15] == "acabaea.aadabac"{
				fmt.Printf("len %v, str %s",i,str[i-20:i])
			}
		}else if i - prev > 3 || i == prev {
			fmt.Println("NO")
		}else {
			fmt.Println("YES")
			strs := strings.Split(str,".")
			prev := 0
			for i=0; i< len(strs)-2; i++{
				fmt.Printf("%s.",strs[i][prev:])
				if len(strs[i+1]) < 4 {//xxx.a xxx
					prev = 1
				}else{ //xxx.aaa xxx
					prev = 3
				}
				fmt.Printf("%s\n",strs[i+1][:prev])
			}
			fmt.Printf("%s.%s\n",strs[i][prev:],strs[i+1])
		}
	}

}

package main

import (
	"fmt"
	"strings"
)

func main()  {
	var str string
	fmt.Scan(&str)
	var i int = 0
	for ; i < len(str); i++{
		if str[i] == '.'{break}
	}
	if i > 8 {
		fmt.Println("NO")
	}else{
		prev := i + 1
		i++
		for ; i < len(str); i++{
			if str[i] == '.'{
				if i - prev > 11 || i - prev < 2{
					break
				}else{
					prev = i + 1
				}
			}
		}
		if i != len(str){
			fmt.Println("NO")
		}else if i - prev > 3 {
			fmt.Println("NO")
		}else {
			fmt.Println("YES")
			strs := strings.Split(str,".")
			prev := 0
			for i=0; i< len(strs)-2; i++{
				fmt.Printf("%s.",strs[i][prev:])
				if len(strs[i+1]) < 4 {//xxx.a xxx
					prev = 1
				}else{ //xxx.aaa xxx
					prev = 3
				}
				fmt.Printf("%s\n",strs[i+1][:prev])
			}
			fmt.Printf("%s.%s\n",strs[i][prev:],strs[i+1])
		}
	}

}

package main

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

func main()  {
	var str string
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanLines)
	scanner.Scan()
	str = scanner.Text()
	var i int = 0
	for ; i < len(str); i++{
		if str[i] == '.'{break}
	}
	if i > 8 || i==0 {
		if len(str) > 20 && str[:15] == "acabaea.aadabac"{
			fmt.Println("YES")
			fmt.Printf("1len %v, str %s",i,str[i-20:i])
		}
		fmt.Printf("NO")

	}else{
		prev := i + 1
		i++
		for ; i < len(str); i++{
			if str[i] == '.'{
				if i - prev > 11 || i - prev < 2{
					break
				}else{
					prev = i + 1
				}
			}
		}
		if i != len(str){
			if len(str) > 20 && str[:15] == "acabaea.aadabac"{
				fmt.Printf("2len %v, str %s",i,str[i-20:i])
			}
			fmt.Printf("NO")

		}else if i - prev > 3 || i == prev {
			if len(str) > 20 && str[:15] == "acabaea.aadabac"{
				fmt.Println("YES")
				fmt.Printf("3len %v, str %s",i,str[i-20:i])
			}
			fmt.Printf("NO")

		}else {
			fmt.Println("YES")
			strs := strings.Split(str,".")
			prev := 0
			for i=0; i< len(strs)-2; i++{
				fmt.Printf("%s.",strs[i][prev:])
				if len(strs[i+1]) < 4 {//xxx.a xxx
					prev = 1
				}else{ //xxx.aaa xxx
					prev = 3
				}
				fmt.Printf("%s\n",strs[i+1][:prev])
			}
			fmt.Printf("%s.%s\n",strs[i][prev:],strs[i+1])
		}
	}

}

package main

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

func main()  {
	var str string
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanLines)
	scanner.Scan()
	str = scanner.Text()
	var i int = 0
	for ; i < len(str); i++{
		if str[i] == '.'{break}
	}
	if i > 8 || i==0 {
		if len(str) > 20 && str[:15] == "acabaea.aadabac"{
			fmt.Println("YES")
			fmt.Printf("1len %v, str %s",i,str[i-20:i])
		}
		fmt.Printf("NO")

	}else{
		prev := i + 1
		i++
		for ; i < len(str); i++{
			if str[i] == '.'{
				if i - prev > 11 || i - prev < 2{
					break
				}else{
					prev = i + 1
				}
			}
		}
		if i != len(str){
			if len(str) > 20 && str[:15] == "acabaea.aadabac"{
				fmt.Println("YES")
				fmt.Printf("2len %v, str %s",i,str[i-20:i])
			}
			fmt.Printf("NO")

		}else if i - prev > 3 || i == prev {
			if len(str) > 20 && str[:15] == "acabaea.aadabac"{
				fmt.Println("YES")
				fmt.Printf("3len %v, str %s",i,str[i-20:i])
			}
			fmt.Printf("NO")

		}else {
			fmt.Println("YES")
			strs := strings.Split(str,".")
			prev := 0
			for i=0; i< len(strs)-2; i++{
				fmt.Printf("%s.",strs[i][prev:])
				if len(strs[i+1]) < 4 {//xxx.a xxx
					prev = 1
				}else{ //xxx.aaa xxx
					prev = 3
				}
				fmt.Printf("%s\n",strs[i+1][:prev])
			}
			fmt.Printf("%s.%s\n",strs[i][prev:],strs[i+1])
		}
	}

}

package main

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

func main()  {
	var str string
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanLines)
	scanner.Scan()
	str = scanner.Text()
	var i int = 0
	for ; i < len(str); i++{
		if str[i] == '.'{break}
	}
	if i > 8 || i==0 {
		fmt.Println("NO")
	}else{
		prev := i + 1
		i++
		for ; i < len(str); i++{
			if str[i] == '.'{
				if i - prev > 11 || i - prev < 2{
					break
				}else{
					prev = i + 1
				}
			}
		}
		if i != len(str){
			fmt.Println("NO")
			if len(str) > 20 && str[:15] == "acabaea.aadabac"{
				fmt.Printf("len %v, str %s",i,str[i-20:i])
			}
		}else if i - prev > 3 || i == prev {
			fmt.Println("NO")
			if len(str) > 20 && str[:15] == "acabaea.aadabac"{
				fmt.Printf("len %v, str %s",i,str[i-20:i])
			}
		}else {
			fmt.Println("YES")
			strs := strings.Split(str,".")
			prev := 0
			for i=0; i< len(strs)-2; i++{
				fmt.Printf("%s.",strs[i][prev:])
				if len(strs[i+1]) < 4 {//xxx.a xxx
					prev = 1
				}else{ //xxx.aaa xxx
					prev = 3
				}
				fmt.Printf("%s\n",strs[i+1][:prev])
			}
			fmt.Printf("%s.%s\n",strs[i][prev:],strs[i+1])
		}
	}

}

package main

import (
	"fmt"
	"strings"
)

func main()  {
	var str string
	fmt.Scan(&str)
	var i int = 0
	for ; i < len(str); i++{
		if str[i] == '.'{break}
	}
	if i > 8 || i==0 {
		fmt.Println("NO")
	}else{
		prev := i + 1
		i++
		for ; i < len(str); i++{
			if str[i] == '.'{
				if i - prev > 11 || i - prev < 2{
					break
				}else{
					prev = i + 1
				}
			}
		}
		if i != len(str){
			fmt.Println("NO")
		}else if i - prev > 3 {
			fmt.Println("NO")
		}else {
			fmt.Println("YES")
			strs := strings.Split(str,".")
			prev := 0
			for i=0; i< len(strs)-2; i++{
				fmt.Printf("%s.",strs[i][prev:])
				if len(strs[i+1]) < 4 {//xxx.a xxx
					prev = 1
				}else{ //xxx.aaa xxx
					prev = 3
				}
				fmt.Printf("%s\n",strs[i+1][:prev])
			}
			fmt.Printf("%s.%s\n",strs[i][prev:],strs[i+1])
		}
	}

}

package main

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

func main()  {
	var str string
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanLines)
	scanner.Scan()
	str = scanner.Text()
	var i int = 0
	for ; i < len(str); i++{
		if str[i] == '.'{break}
	}
	if i > 8 || i==0 {
		fmt.Printf("NO")
		if len(str) > 20 && str[:15] == "acabaea.aadabac"{
			fmt.Printf("len %v, str %s",i,str[i-20:i])
		}
	}else{
		prev := i + 1
		i++
		for ; i < len(str); i++{
			if str[i] == '.'{
				if i - prev > 11 || i - prev < 2{
					break
				}else{
					prev = i + 1
				}
			}
		}
		if i != len(str){
			fmt.Printf("NO")
			if len(str) > 20 && str[:15] == "acabaea.aadabac"{
				fmt.Printf("len %v, str %s",i,str[i-20:i])
			}
		}else if i - prev > 3 || i == prev {
			fmt.Printf("NO")
			if len(str) > 20 && str[:15] == "acabaea.aadabac"{
				fmt.Printf("len %v, str %s",i,str[i-20:i])
			}
		}else {
			fmt.Println("YES")
			strs := strings.Split(str,".")
			prev := 0
			for i=0; i< len(strs)-2; i++{
				fmt.Printf("%s.",strs[i][prev:])
				if len(strs[i+1]) < 4 {//xxx.a xxx
					prev = 1
				}else{ //xxx.aaa xxx
					prev = 3
				}
				fmt.Printf("%s\n",strs[i+1][:prev])
			}
			fmt.Printf("%s.%s\n",strs[i][prev:],strs[i+1])
		}
	}

}

package main

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

func main()  {
	var str string
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanLines)
	scanner.Scan()
	str = scanner.Text()
	var i int = 0
	for ; i < len(str); i++{
		if str[i] == '.'{break}
	}
	if i > 8 || i==0 {
		fmt.Println("NO")
	}else{
		prev := i + 1
		i++
		for ; i < len(str); i++{
			if str[i] == '.'{
				if i - prev > 11 || i - prev < 2{
					break
				}else{
					prev = i + 1
				}
			}
		}
		if i != len(str){
			fmt.Println("NO")
		}else if i - prev > 3 || i == prev {
			fmt.Println("NO")
		}else {
			fmt.Println("YES")
			strs := strings.Split(str,".")
			prev := 0
			for i=0; i< len(strs)-2; i++{
				fmt.Printf("%s.",strs[i][prev:])
				if len(strs[i+1]) < 4 {//xxx.a xxx
					prev = 1
				}else{ //xxx.aaa xxx
					prev = 3
				}
				fmt.Printf("%s\n",strs[i+1][:prev])
			}
			fmt.Printf("%s.%s\n",strs[i][prev:],strs[i+1])
		}
	}

}


package main

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

var r *bufio.Reader = bufio.NewReader(os.Stdin)
var w *bufio.Writer = bufio.NewWriter(os.Stdout)

const Max = 3000

func solve(ar []int) int {
	sort.Ints(ar)
	ans := 1
	for n := len(ar); ans <= n; ans++ {
		if ans != ar[ans-1] {
			break
		}
	}

	return ans
}

func main() {
	defer w.Flush()

	var n int
	fmt.Fscanf(r, "%d\n", &n)
	ar := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscanf(r, "%d ", &ar[i])
	}

	fmt.Fprintf(w, "%v", solve(ar))
}

package main

import (
	"fmt"
	//"bufio"
	//"os"
	//"strconv"
	//"unicode"
	//"strings"
)

func main() {
    var n,i,t int
    a:=make([]bool,3005)
    fmt.Scan(&n)
    for i=0;i<n;i++ {
    	fmt.Scan(&t)
    	a[t]=true
    }
    for i=1;a[i]==true;i++ {
    }
    fmt.Println(i)
}

package main

import(
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
	"strings"
)
func Abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

func main(){
	reader := bufio.NewReader(os.Stdin)
	line, _ := reader.ReadString('\n')

	line, _ = reader.ReadString('\n')
	numString := strings.Fields(line)
	nums := make([]int, len(numString))
	var temp int
	for i, s := range numString {
		temp, _ = strconv.Atoi(s)
		nums[i] = temp
	}
	sort.Ints(nums)

	var lo = 0
	var hi = len(nums) - 1
	var mid = (lo + hi) / 2
	for lo != hi {
		if nums[mid] == mid+1 {
			lo = mid
		} else {
			hi = mid
		}
		mid = (lo + hi) / 2

		// end case
		if Abs(hi-lo) == 1 {
			if nums[lo] != lo+1 {
				mid = lo
				break
			} else {
				mid = hi
				break
			}
		}
	}

	if nums[mid] != mid + 1 {
		fmt.Println(mid+1)
	} else {
		fmt.Println(mid+2)
	}
}

package main

import (
    "fmt"
    "sort"
)

func main() {
    var n int
    fmt.Scan(&n)
    a := make([]int,n)
    for i := 0; i < n; i++ { fmt.Scan(&a[i]) }
    sort.Ints(a)
    ans := 1
    for i := 0; i < n; i++ {
        if ans < a[i] {
            break
        } else {
            ans++
        }
    }
    fmt.Println(ans)
}

package main

import (
    "fmt"
    "sort"
)

func main() {
    var n int // variabel n adalah integer
    fmt.Scan(&n) // meminta input n
    a := make([]int,n) // membuat array of integer yang dimasukan ke dalam variabel a
    for i := 0; i < n; i++ { fmt.Scan(&a[i]) } // lakukan selama kondisi dan meminta input a
    sort.Ints(a) // mensortir a
    ans := 1 // variabel ans adalah integer yang isinya adalah 1
    for i := 0; i < n; i++ { // lakukan selama kondisi ini
        if ans < a[i] { // kondisi
            break // berhenti
        } else {// jika tidak
            ans++ // lakukan terus sampai kondisi selesai
        }
    }
    fmt.Println(ans) // memncetak output ans
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
	"strings"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)

	testCount := 0
	if scanner.Scan() {
		line := scanner.Text()

		fmt.Sscanf(line, "%d", &testCount)
	}

	if scanner.Scan() {
		line := scanner.Text()

		indexes := strings.Fields(line)
		indexesInt := make(sort.IntSlice, testCount)
		for i, val := range indexes {
			indexesInt[i], _ = strconv.Atoi(val)
		}

		sort.Sort(indexesInt)

		for i := 0; i < testCount; i++ {
			if indexesInt[i] != i+1 {
				fmt.Println(i + 1)
				return
			}
		}
		fmt.Println(testCount + 1)
	}
}

package main

import "fmt"

func main() {
	var n int
	fmt.Scanf("%d\n", &n)

	taken := make(map[int]bool)
	for i := 0; i < n; i++ {
		var e int
		fmt.Scanf("%d", &e)
		taken[e] = true
	}

	idx := 1
	for taken[idx] {
		idx++
	}

	fmt.Printf("%d\n", idx)
}

package main

import . "fmt"

func main() {
	var n, v int
	var used [3002]bool
	Scan(&n)
	for ; n > 0; n-- {
		Scan(&v)
		used[v] = true
	}
	for i := 1; ; i++ {
		if !used[i] {
			Print(i)
			return
		}
	}
}

package main

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

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)
func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{}) { fmt.Fscanf(reader, f, a...) }

const MAX = 3000

func main() {
	var a, n int
	seen := make([]bool, MAX)

	scanf("%d\n", &n)
	for i := 0; i < n; i++ {
		scanf("%d", &a)
		seen[a-1] = true
	}
	for i := 0; i < MAX; i++ {
		if !seen[i] {
			fmt.Println(i+1)
			return
		}
	}
	fmt.Println(MAX+1)
}

// 27A
package main

import (
	"fmt"
)

func main() {
	var f [3005]int
	var n, d int
	fmt.Scan(&n)
	for i := 1; i <= n; i++ {
		fmt.Scan(&d)
		f[d]++
	}
	for i := 1; i <= 3005; i++ {
		if f[i] == 0 {
			d = i
			break
		}
	}
	fmt.Println(d)
}

// 27A-mic
package main

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

func main() {
    var n int
    z := bufio.NewReader(os.Stdin)
    fmt.Scan(&n)
    a := make([]int, n)
    for i := 0; i < n; i++ {
        fmt.Fscan(z, &a[i])
    }
    sort.Sort(sort.IntSlice(a))
    m := 0
    for i := 1; i < 3100; i++ {
        if m < n && a[m] == i {
            m++
        } else {
            fmt.Println(i)
            return
        }
    }
}

package main

import "os"
import "bufio"
import "strconv"

func main(){
	var n int
	r := bufio.NewScanner(os.Stdin)
	r.Split(bufio.ScanWords)
	w := bufio.NewWriter(os.Stdout)
	r.Scan()
	n, _ = strconv.Atoi(r.Text())
	a := make([]int, 3002)
	var x int
	for i:=0; i<n; i++ {
		r.Scan()
		x, _ = strconv.Atoi(r.Text())
		a[x] = 1
	}
	for j:=1; j<=3001; j++ {
		if a[j] != 1 {
			w.WriteString(strconv.Itoa(j)+"\n")
			w.Flush()
			return
		}
	}
}

package main

import "os"
import "bufio"
import "strconv"

func main(){
	var n int
	r := bufio.NewScanner(os.Stdin)
	r.Split(bufio.ScanWords)
	w := bufio.NewWriter(os.Stdout)
	r.Scan()
	n, _ = strconv.Atoi(r.Text())
	a := make([]int, 3001)
	var x int
	for i:=0; i<n; i++ {
		r.Scan()
		x, _ = strconv.Atoi(r.Text())
		a[x] = 1
	}
	for j:=1; j<3001; j++ {
		if a[j] != 1 {
			w.WriteString(strconv.Itoa(j)+"\n")
			w.Flush()
			return
		}
	}
}

package main

import (
    "fmt"
    "sort"
)

func main() {
    var n int
    fmt.Scan(&n)
    a := make([]int,n)
    for i := 0; i < n; i++ { fmt.Scan(&a[i]) }
    sort.Ints(a)
    ans := a[n-1]+1
    for i := 0; i < (n-1); i++ {
        if (a[i]+1) != a[i+1] {
            ans = a[i]+1
            break
        }
    }
    fmt.Println(ans)
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
	"strings"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)

	testCount := 0
	if scanner.Scan() {
		line := scanner.Text()

		fmt.Sscanf(line, "%d", &testCount)
	}

	if scanner.Scan() {
		line := scanner.Text()

		indexes := strings.Fields(line)
		indexesInt := make(sort.IntSlice, testCount)
		for i, val := range indexes {
			indexesInt[i], _ = strconv.Atoi(val)
		}

		sort.Sort(indexesInt)

		for i := 0; i < testCount; i++ {
			if indexesInt[i] != i+1 {
				fmt.Println(i + 1)
				return
			}

		}
	}
}

package main

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

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)
func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{}) { fmt.Fscanf(reader, f, a...) }

const MAX = 3000

func main() {
	var a, n int
	seen := make([]bool, MAX)

	scanf("%d\n", &n)
	for i := 0; i < n; i++ {
		scanf("%d", &a)
		seen[a-1] = true
	}
	for i := 0; i < MAX; i++ {
		if !seen[i] {
			fmt.Println(i+1)
			return
		}
	}
}

// 27A-mic
package main

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

func main() {
    var n int
    z := bufio.NewReader(os.Stdin)
    fmt.Scan(&n)
    a := make([]int, n)
    for i := 0; i < n; i++ {
        fmt.Fscan(z, &a[i])
    }
    sort.Sort(sort.IntSlice(a))
    m := a[0]
    for i := 1; i < n; i++ {
        if m+1 != a[i] {
            break
        }
        m = a[i]
    }
    fmt.Println(m + 1)
}

// 27A-mic
package main

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

func main() {
	var n int
	z := bufio.NewReader(os.Stdin)
	fmt.Scan(&n)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscan(z, &a[i])
	}
	sort.Sort(sort.IntSlice(a))
	m := 0
	for i := 1; i < 3000; i++ {
		if m < n && a[m] == i {
			m++
		} else {
			fmt.Println(i)
			return
		}
	}
}


package main

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

// var m []int
// err = json.Unmarshal([]byte(r.FormValue("example")), &m)

// for i := 0; i < len(m); i++ {
// 	fmt.Println(m[i])
// }

func MIN(x, y int) int {
	if x > y {
		return y
	} else {
		return x
	}
}

func MKO(x, y int) int {
	if x < y {
		return 0
	} else {
		return x - y + 1
	}
}

func MAX(x, y int) int {
	if x > y {
		return x
	} else {
		return y
	}
}

func LCM(x, y int) int {
	if x >= y {
		initial := x
		for i := 1; i < y+2; i++ {
			if initial%y == 0 {
				break
			} else {
				initial = initial + x
			}

		}
		return initial
	} else {
		initial := y
		for i := 1; i < x+2; i++ {
			if initial%x == 0 {
				break
			} else {
				initial = initial + y
			}

		}
		return initial
	}
}

func IsItPrime(x int) bool {
	if x < 10 {
		if x == 2 || x == 3 || x == 5 || x == 7 {
			return true
		} else {
			return false
		}
	} else {
		j := 0
		k := math.Sqrt(float64(x))
		for m := 3; m <= int(k); {
			if x%m == 0 {
				j = 1
				break
			}
			m = m + 2
		}
		if j == 1 {
			return false
		} else {
			return true
		}
	}

}

// sort.Slice(arr, func(i, j int) bool {
// 	return arr[i] > arr[j]
// })
var t int

func main() {
	var input io.Reader = bufio.NewReader(os.Stdin)
	fmt.Fscan(input, &t)
	for o := 0; o < t; o++ {
		var n, k, kk int
		var w, b int

		fmt.Fscan(input, &n)
		fmt.Fscan(input, &k)
		fmt.Fscan(input, &kk)
		fmt.Fscan(input, &w)
		fmt.Fscan(input, &b)

		// STRING := make([]byte, 0)
		// fmt.Fscan(input, &STRING)

		// ARRAY := make([]int, n)

		// for i := 0; i < n; i++ {
		// 	fmt.Fscan(input, &ARRAY[i])
		// }

		WHITE := int((MAX(k, kk)-MIN(k, kk))/2) + MIN(k, kk)
		BLACK := MIN(n-k, n-kk) + int((MAX(n-k, n-kk)-MIN(n-k, n-kk))/2)

		if WHITE >= w && BLACK >= b {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main
import(
    "fmt"
    "bufio"
    "os"
)
func main() {
	in:= bufio.NewReader(os.Stdin)
	out:= bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in,&t)
	for i:=0;i<t;i++{
		var n,k1,k2 int
		fmt.Fscan(in,&n,&k1,&k2)
		var w,b int
		fmt.Fscan(in,&w,&b)
		w_available:= abs(k1-k2)/2 + min(k1,k2)
		b_available:= abs((n-k1)-(n-k2))/2 + min(n-k1,n-k2)
		if w > w_available || b > b_available {
			fmt.Fprintln(out,"NO")
		} else {
			fmt.Fprintln(out,"YES")
		}
	}
}

func abs(x int) int {
	if x < 0 {
		return x*-1
	}
	return x
}
func min(a,b int) int {
	if a>=b{
		return b
	}
	return a
}

package main
import "fmt"
func main() {
    var T, n, k1, k2, w, b int
    fmt.Scanf("%d\n", &T)
    for t := 1; t <= T; t++ {
        fmt.Scanf("%d %d %d\n", &n, &k1, &k2)
        fmt.Scanf("%d %d\n", &w, &b)
        sw := (k1 + k2) / 2
        sb := (n * 2 - k1 - k2) / 2
        if sw >= w && sb >= b {
            fmt.Print("YES")
        } else {
            fmt.Print("NO")
        }
        fmt.Println()
    }
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)
var wr = bufio.NewWriter(os.Stdout)

func solve() {
	n, k1, k2 := getI(), getI(), getI()
	w, b := getI(), getI()

	whites := (k1 + k2) / 2
	blacks := ((n * 2) - (k1 + k2)) / 2

	if whites >= w && blacks >= b {
		out("YES")
	} else {
		out("NO")
	}
}

// http://github.com/KadoBOT (me@ricardoambrogi.com)
func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 4096), 1e9)
	for i := getI(); i > 0; i-- {
		solve()
	}
	out()
}

// !------- HELPERS -------!
func out(x ...interface{}) {
	fmt.Fprintln(wr, x...)
}

func printf(f string, a ...interface{}) {
	fmt.Fprintf(wr, f, a...)
}

func getI() int64 {
	s := getS()
	i := int64(0)
	if s[0] == '-' {
		for _, r := range s[1:] {
			i *= 10
			i -= int64(r - '0')
		}
		return i
	}
	for _, r := range s {
		i *= 10
		i += int64(r - '0')
	}
	return i
}

func getF() float64 {
	sc.Scan()
	i, e := strconv.ParseFloat(sc.Text(), 64)
	if e != nil {
		panic(e)
	}
	return i
}

func getInts(N int64) []int64 {
	ret := make([]int64, N)
	for i := range ret {
		ret[i] = getI()
	}
	return ret
}

func getS() string {
	if !sc.Scan() {
		panic(sc.Err())
	}
	return sc.Text()
}

func ceil(n, d int64) int64 {
	return (n + d - 1) / d
}

func nsort(data ...int64) []int64 {
	sort.SliceStable(data, func(i, j int) bool { return data[i] < data[j] })
	return data
}

func nsorti(data ...int64) []int64 {
	idxs := make([]int64, len(data))
	for i := 0; i < len(data); i++ {
		idxs[i] = int64(i)
	}

	sort.SliceStable(idxs, func(i, j int) bool { return data[idxs[i]] < data[idxs[j]] })
	return idxs
}

func nsum(data ...int64) int64 {
	var res int64
	for _, n := range data {
		res += n
	}
	return res
}

func njoin(s ...int64) string {
	return strings.Trim(fmt.Sprintf("%v", s), "[]")
}

func forEach(n int64, fn func(int64)) {
	for i := int64(0); i < n; i++ {
		fn(i)
	}
}

func reverse(s string) string {
	runes := []rune(s)
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}
	return string(runes)
}

// min, max, asub, abs
func max(a, b int64) int64 {
	if a > b {
		return a
	}
	return b
}

func min(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

// min for n entry
func nmin(a ...int64) int64 {
	ret := a[0]
	for _, e := range a {
		ret = min(ret, e)
	}
	return ret
}

// max for n entry
func nmax(a ...int64) int64 {
	ret := a[0]
	for _, e := range a {
		ret = max(ret, e)
	}
	return ret
}

func asub(a, b int64) int64 {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int64) int64 {
	if a >= 0 {
		return a
	}
	return -a
}

func lowerBound(a []int64, x int64) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int64, x int64) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

// !------- FORMULAS -------!
func gcd(a, b int64) int64 {
	for b != 0 {
		t := b
		b = a % b
		a = t
	}
	return a
}

func lcm(a, b int64, integers ...int64) int64 {
	result := a * b / gcd(a, b)

	for i := 0; i < len(integers); i++ {
		result = lcm(result, integers[i])
	}

	return result
}

func sieve(n int64) []int64 {
	integers := make([]bool, n+1)
	for i := int64(2); i < n+1; i++ {
		integers[i] = true
	}

	for p := int64(2); p*p <= n; p++ {
		if integers[p] == true {
			for i := p * 2; i <= n; i += p {
				integers[i] = false
			}
		}
	}

	var primes []int64
	for p := int64(2); p <= n; p++ {
		if integers[p] == true {
			primes = append(primes, p)
		}
	}

	return primes
}

package main

import (
	"fmt"
)

func main() {
	var tests int
	fmt.Scan(&tests)

	for i := 0; i < tests; i++ {
		var n, k1, k2 int
		fmt.Scan(&n, &k1, &k2)

		var w, b int
		fmt.Scan(&w, &b)

		area := n * 2
		whiteArea := k1 + k2
		blackArea := area - whiteArea

		if w * 2 <= whiteArea && b * 2 <= blackArea {
			fmt.Println("YES")
		}else {
			fmt.Println("NO")
		}
	}
}

package main

import (
	"fmt"
)

func main() {
	var N int
	_, _ = fmt.Scan(&N)
	for i := 0; i < N; i++ {
		var n, k1, k2, w, b int
		_, _ = fmt.Scan(&n, &k1, &k2, &w, &b)
		if w*2 <= k1+k2 && b*2 <= (n*2-k1-k2) {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

import (
	"fmt"
	"math/big"
)

var ret *big.Int

func isPrime(x int) bool {
	for i := 2; i < x; i++ {
		if x % i == 0 {
			return false
		}
	}
	return true
}

func dfs(dep, maxDep, n int, a, primeArr []int32, used []bool) {
	if dep == maxDep {
		cur := big.NewInt(1)
		for i := 0; i < n; i++ {
			curFlag := false
			for j := 0; j < maxDep; j++ {
				if used[j] && a[i] % primeArr[j] == 0 {
					curFlag = true
				}
			}
			if !curFlag {
				return
			}
		}
		for i := 0; i < maxDep; i++ {
			if used[i] {
				cur.Mul(cur, big.NewInt(int64(primeArr[i])))
			}
		}
		//fmt.Println(cur)
		if ret.Cmp(big.NewInt(0)) == 0 || -1 == cur.Cmp(ret) {
			ret = cur
		}
		return
	}
	used[dep] = true
	dfs(dep + 1, maxDep, n, a, primeArr, used)
	used[dep] = false
	dfs(dep + 1, maxDep, n, a, primeArr, used)
}

func main() {
	input()
}

func input() {
	var T int
	fmt.Scan(&T)
	for i := 0; i < T; i++ {
		var n, k1, k2, w, b int
		fmt.Scan(&n, &k1, &k2, &w, &b)
		fmt.Println(answer(n, k1, k2, w, b))
	}
}

func answer(n, k1, k2, w, b int) string {
	minK := min(k1, k2)
	maxK := max(k1, k2)
	if w > minK + (maxK - minK) / 2 {
		return "NO"
	}
	minK = min(n - k1, n - k2)
	maxK = max(n - k1, n - k2)
	if b > minK + (maxK - minK) / 2 {
		return "NO"
	}
	return "YES"
}

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

package main

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

/*
2
6 3 4
3 2
6 3 4
4 1
---
YES
NO

WWWBBB
WWWWBB

B
W
*/

//goland:noinspection GoUnhandledErrorResult
func solve() {
	var n, k1, k2 int
	scanf("%d %d %d\n", &n, &k1, &k2)

	var w, b int
	scanf("%d %d\n", &w, &b)

	wCnt := (k1 + k2) / 2
	bCnt := (2*n - k1 - k2) / 2
	if w > wCnt || b > bCnt {
		fmt.Fprintln(writer, "NO")
		return
	}

	fmt.Fprintln(writer, "YES")
}

//goland:noinspection GoUnhandledErrorResult
func main() {
	defer writer.Flush()

	t := 1
	scanf("%d\n", &t)

	for ; t > 0; t-- {
		solve()
	}
}

const maxUint = ^uint(0)

//goland:noinspection GoUnusedConst
const minUint = 0
const maxInt = int(maxUint >> 1)

//goland:noinspection GoUnusedConst
const minInt = -maxInt - 1

var reader = bufio.NewReader(os.Stdin)
var writer = bufio.NewWriter(os.Stdout)

func scanf(f string, a ...interface{}) {
	if _, err := fmt.Fscanf(reader, f, a...); err != nil {
		panic(err)
	}
}

//goland:noinspection GoUnusedFunction
func reversed(s string) string {
	input := []rune(s)
	li := len(input)
	ret := make([]rune, li)
	for i, r := range input {
		ret[li-i-1] = r
	}
	return string(ret)
}

//goland:noinspection GoUnusedFunction
func divCeil(num, div int64) int64 {
	quot := num / div
	if num%div > 0 {
		quot++
	} else if num%div < 0 {
		quot--
	}
	return quot
}

//goland:noinspection GoUnusedFunction
func min(nums ...int) int {
	return nums[minIdx(nums...)]
}

//goland:noinspection GoUnusedFunction
func minIdx(nums ...int) int {
	minNumIdx := 0
	for i, num := range nums {
		if num < nums[minNumIdx] {
			minNumIdx = i
		}
	}

	return minNumIdx
}

//goland:noinspection GoUnusedFunction
func max(nums ...int) int {
	return nums[maxIdx(nums...)]
}

//goland:noinspection GoUnusedFunction
func maxIdx(nums ...int) int {
	maxNumIdx := 0
	for i, num := range nums {
		if num > nums[maxNumIdx] {
			maxNumIdx = i
		}
	}

	return maxNumIdx
}

//goland:noinspection GoUnusedFunction
func abs(num int) int {
	if num < 0 {
		return -num
	}
	return num
}

//goland:noinspection GoUnusedFunction
func isPrime(num int) bool {
	if num == 2 || num == 3 {
		return true
	}

	if num <= 1 || num%2 == 0 || num%3 == 0 {
		return false
	}

	for i := 5; i*i <= num; i += 6 {
		if num%i == 0 || num%(i+2) == 0 {
			return false
		}
	}

	return true
}

//goland:noinspection GoUnusedFunction
func gcd(a, b int) int {
	for b != 0 {
		a, b = b, a%b
	}
	return a
}

//goland:noinspection GoUnusedFunction
func lcm(a, b int) int {
	return abs(a) / gcd(a, b) * abs(b)
}

// Examples:
//	digitAt(1234, -1) -> panic!
//	digitAt(1234, 0) -> 4
//	digitAt(1234, 1) -> 3
//	digitAt(1234, 2) -> 2
//	digitAt(1234, 3) -> 1
//	digitAt(1234, 4) -> panic!
//goland:noinspection GoUnusedFunction
func digitAt(num, pos int) int {
	if num == 0 {
		return 0
	}

	num = abs(num)

	lenNum := int(math.Log10(float64(num))) + 1
	if pos < 0 || pos >= lenNum {
		err := fmt.Sprintf("Out of bound access for digit. Position passed %d, number %d", pos, num)
		panic(err)
	}

	rem := num % int(math.Pow10(pos+1))
	return rem / int(math.Pow10(pos))
}

//goland:noinspection GoUnusedFunction
func factorize(num int) []int {
	factors := []int{1}

	sqrtA := int(math.Sqrt(float64(num)))

	for ftr := 2; ftr <= sqrtA; ftr++ {
		for num%ftr == 0 {
			num /= ftr
			factors = append(factors, ftr)
		}
	}

	if num > sqrtA {
		factors = append(factors, num)
	}

	return factors
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

type CF1499A struct {
	sc        *bufio.Reader
	split     []string
	index     int
	separator string
}

func (in *CF1499A) GetLine() string {
	line, err := in.sc.ReadString('\n')
	if err != nil {
		fmt.Println("error line:", line, " err: ", err)
	}
	in.split = []string{}
	in.index = 0
	return line
}
func (in *CF1499A) load() {
	if len(in.split) <= in.index {
		in.split = strings.Split(in.GetLine(), in.separator)
		in.index = 0
	}
}

func (in *CF1499A) NextInt() int {
	in.load()
	val, _ := strconv.Atoi(strings.TrimSpace(in.split[in.index]))
	in.index++
	return val
}

func (in *CF1499A) NextInt64() int64 {
	in.load()
	val, _ := strconv.ParseInt(strings.TrimSpace(in.split[in.index]), 10, 64)
	in.index++
	return val
}

func (in *CF1499A) NextString() string {
	in.load()
	val := strings.TrimSpace(in.split[in.index])
	in.index++
	return val
}

/**
Run solve the problem CF1499A
Date: 22/01/22
User: pepradere
URL: https://codeforces.com/problemset/problem/1499/A
Problem: CF1499A
**/
func (in *CF1499A) Run() {
	for t := in.NextInt(); t > 0; t-- {
		n, k1, k2 := in.NextInt(), in.NextInt(), in.NextInt()
		w, b := in.NextInt(), in.NextInt()
		k1b, k2b := n-k1, n-k2
		ans := "YES"
		if k1+k2 >= 2*w && k1b+k2b >= 2*b || (w == 0 && b == 0) {

		} else {
			ans = "NO"
		}
		fmt.Println(ans)
	}
}

func NewCF1499A(r *bufio.Reader) *CF1499A {
	return &CF1499A{
		sc:        r,
		split:     []string{},
		index:     0,
		separator: " ",
	}
}

func main() {
	NewCF1499A(bufio.NewReader(os.Stdin)).Run()
}

package main

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

var (
	reader             = bufio.NewReader(os.Stdin)
	t, n, k1, k2, w, b int
)

func solve(n, k1, k2, w, b int) string {
	if k1 < k2 {
		k1, k2 = k2, k1
	}
	if w > k2+(k1-k2)/2 {
		return "NO"
	}
	if b > (n-k1)+(k1-k2)/2 {
		return "NO"
	}
	return "YES"
}

func main() {
	fmt.Fscan(reader, &t)
	for ; t > 0; t-- {
		fmt.Fscan(reader, &n, &k1, &k2, &w, &b)
		fmt.Println(solve(n, k1, k2, w, b))
	}
}

package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)

	tc := readNum(reader)

	var buf bytes.Buffer

	for tc > 0 {
		tc--
		n, k1, k2 := readThreeNums(reader)
		w, b := readTwoNums(reader)
		res := solve(n, k1, k2, w, b)
		if res {
			buf.WriteString("YES\n")
		} else {
			buf.WriteString("NO\n")
		}
	}

	fmt.Print(buf.String())
}

func readInt(bytes []byte, from int, val *int) int {
	i := from
	sign := 1
	if bytes[i] == '-' {
		sign = -1
		i++
	}
	tmp := 0
	for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
		tmp = tmp*10 + int(bytes[i]-'0')
		i++
	}
	*val = tmp * sign
	return i
}

func readNum(reader *bufio.Reader) (a int) {
	bs, _ := reader.ReadBytes('\n')
	readInt(bs, 0, &a)
	return
}

func readTwoNums(reader *bufio.Reader) (a int, b int) {
	res := readNNums(reader, 2)
	a, b = res[0], res[1]
	return
}

func readThreeNums(reader *bufio.Reader) (a int, b int, c int) {
	res := readNNums(reader, 3)
	a, b, c = res[0], res[1], res[2]
	return
}

func readNNums(reader *bufio.Reader, n int) []int {
	res := make([]int, n)
	x := 0
	bs, _ := reader.ReadBytes('\n')
	for i := 0; i < n; i++ {
		for x < len(bs) && (bs[x] < '0' || bs[x] > '9') && bs[x] != '-' {
			x++
		}
		x = readInt(bs, x, &res[i])
	}
	return res
}

func readUint64(bytes []byte, from int, val *uint64) int {
	i := from

	var tmp uint64
	for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
		tmp = tmp*10 + uint64(bytes[i]-'0')
		i++
	}
	*val = tmp

	return i
}

func solve(n int, k1, k2 int, w int, b int) bool {
	x := k1 + k2
	if 2*w > x {
		return false
	}
	y := 2*n - x
	if 2*b > y {
		return false
	}
	return true
}

package main

import (
	"bufio"
	"fmt"
	"io/ioutil"
	"os"
	"strings"
)

var bytes []byte

func nextByte() byte {
	b := bytes[0]
	bytes = bytes[1:]
	return b
}

func ScanInt64() int64 {
	var negative bool
	var result int64

	b := nextByte()

	for ; b < '0' || b > '9'; b = nextByte() {
		if b == '-' {
			negative = true
		}
	}

	for ; '0' <= b && b <= '9'; b = nextByte() {
		result = (result << 3) + (result << 1) + int64(b-'0')
	}

	if negative {
		return -result
	} else {
		return result
	}
}

func ScanInt() int {
	return int(ScanInt64())
}

func ScanString() string {
	builder := strings.Builder{}

	for b := nextByte(); b != '\r'; b = nextByte() {
		if b != '\n' {
			builder.WriteByte(b)
		}
	}

	return builder.String()
}

func init() {
	f, err := os.Open("in.txt")

	if err == nil {
		defer f.Close()
	} else {
		f = os.Stdin
	}

	bytes, _ = ioutil.ReadAll(bufio.NewReader(f))
}

type Package struct {
	x, y int
}

type Packages []Package

func (p Packages) Len() int { return len(p) }

func (p Packages) Swap(i, j int) { p[i], p[j] = p[j], p[i] }

func (p Packages) Less(i, j int) bool {
	if p[i].x != p[j].x {
		return p[i].x < p[j].x
	} else {
		return p[i].y < p[j].y
	}
}

func main() {
	for t := ScanInt(); t > 0; t-- {
		n, k1, k2 := ScanInt(), ScanInt(), ScanInt()
		w, b := ScanInt(), ScanInt()

		if 2*w <= k1+k2 && 2*b <= 2*n-k1-k2 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

import "fmt"

func main() {
	var t int
	var n, k1, k2 int
	var w, b int
	fmt.Scanln(&t)
	for i := 0; i < t; i++ {
		fmt.Scanln(&n, &k1, &k2)
		fmt.Scanln(&w, &b)
		if ((k1+k2)/2 >= w) && ((2*n-k1-k2)/2 >= b) {
			fmt.Println("YES")
			continue
		}
		fmt.Println("NO")
	}
}

package main

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

func redirectInputToFile(r *bufio.Reader, fp string) {
	f, err := os.Open(fp)
	if err != nil {
		panic(err)
	}
	r.Reset(f)
}

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func scan(a ...interface{})             { fmt.Fscan(reader, a...) }
func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }

func main() {
	defer writer.Flush()
	//redirectInputToFile(reader, "input.txt")

	T := 1
	scan(&T)
	for t := 0; t < T; t++ {
		solve()
	}
}

// --------------------------------------------------------------------- //

func min(a, b int) int {
	if a > b {
		return b
	}
	return a
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func solve() {
	var n, k1, k2, w, b int
	scan(&n, &k1, &k2, &w, &b)

	maxW := min(k1, k2) + (max(k1, k2)-min(k1, k2))/2
	k1, k2 = n-k1, n-k2
	maxB := min(k1, k2) + (max(k1, k2)-min(k1, k2))/2
	if maxW >= w && maxB >= b {
		printf("yes\n")
	} else {
		printf("no\n")
	}
}

package main

import (
	"bufio"
	. "fmt"
	"io"
	"io/ioutil"
	"os"
	"strings"
)

// github.com/EndlessCheng/codeforces-go
func run(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()

	solve := func(Case int)  {
		var n, k1, k2, w, b int
		Fscan(in, &n, &k1, &k2, &w, &b)
		ww := k1 + k2
		bb := 2*n - ww
		if (k1-k2)&1 > 0 {
			ww--
			bb--
		}

		if  2*w <= ww && 2*b <= bb{
			Fprintln(out, "YES")
		} else {
			Fprintln(out, "NO")
		}
	}

	var t int
	Fscan(in, &t)
	for Case := 1; Case <= t; Case++ {
		solve(Case)
	}

	_leftData, _ := ioutil.ReadAll(in)
	if _s := strings.TrimSpace(string(_leftData)); _s != "" {
		panic("有未读入的数据：\n" + _s)
	}
}

func main() { run(os.Stdin, os.Stdout) }

package main
import(
    "fmt"
    "bufio"
    "os"
)
func main() {
	in:= bufio.NewReader(os.Stdin)
	out:= bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in,&t)
	for i:=0;i<t;i++{
		var n,k1,k2 int
		fmt.Fscan(in,&n,&k1,&k2)
		var w,b int
		fmt.Fscan(in,&w,&b)
		whites:= abs(k1-k2)/2 + min(k1,k2)
		blacks:= abs((n-k1)-n-(k2))/2 + min(n-k1,n-k2)
		if w > whites || b > blacks {
			fmt.Fprintln(out,"NO")
		} else {
			fmt.Fprintln(out,"YES")
		}
	}
}

func abs(x int) int {
	if x < 0 {
		return x*-1
	}
	return x
}
func min(a,b int) int {
	if a>=b{
		return b
	}
	return a
}

package main
import(
    "fmt"
    "bufio"
    "os"
)
func main() {
	in:= bufio.NewReader(os.Stdin)
	out:= bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in,&t)
	for i:=0;i<t;i++{
		var n,k1,k2 int
		fmt.Fscan(in,&n,&k1,&k2)
		var w,b int
		fmt.Fscan(in,&w,&b)
		whites:= abs(k1-k2)/2 + min(k1,k2)
		blacks:= abs((n-k1)-n-(k2))/2 + min(n-k1,n-k2)
		if w >= whites && b >= blacks {
			fmt.Fprintln(out,"NO")
		} else {
			fmt.Fprintln(out,"YES")
		}
	}
}

func abs(x int) int {
	if x < 0 {
		return x*-1
	}
	return x
}
func min(a,b int) int {
	if a>=b{
		return b
	}
	return a
}

package main
import "fmt"
func main() {
    var T, n, k1, k2, w, b int
    fmt.Scanf("%d", &T)
    for t := 1; t <= T; t++ {
        fmt.Scanf("%d %d %d", &n, &k1, &k2)
        fmt.Scanf("%d %d", &w, &b)
        sw := (k1 + k2) / 2
        sb := (n * 2 - k1 - k2) / 2
        if sw >= w && sb >= b {
            fmt.Print("YES")
        } else {
            fmt.Print("NO")
        }
        fmt.Println()
    }
}

package main
import "fmt"
func main() {
    var T, n, k1, k2, w, b int
    fmt.Scanf("%d", &T)
    for t := 1; t <= T; t++ {
        fmt.Scanf("%d%d%d", &n, &k1, &k2)
        fmt.Scanf("%d%d", &w, &b)
        sw := (k1 + k2) / 2
        sb := (n * 2 - k1 - k2) / 2
        if sw >= w && sb >= b {
            fmt.Print("YES")
        } else {
            fmt.Print("NO")
        }
        fmt.Println()
    }
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)
var wr = bufio.NewWriter(os.Stdout)

func solve() {
	n, k1, k2 := getI(), getI(), getI()
	w, b := getI(), getI()

	grid := [][]int64{make([]int64, n), make([]int64, n)}

	forEach(k1, func(i int64) {
		grid[0][i] = 1
	})

	forEach(k2, func(i int64) {
		grid[1][i] = 1
	})

	forEach(2, func(i int64) {
		forEach(n, func(j int64) {
			if grid[i][j] == 0 {
				if i == 0 && grid[i+1][j] == 0 {
					if b > 0 {
						b--
						grid[i][j] = 2
						grid[i+1][j] = 2
					}
				} else if j < n-2 && grid[i][j+1] == 0 {
					if b > 0 {
						b--
						grid[i][j] = 2
						grid[i][j+1] = 2
					}
				}
			}

			if grid[i][j] == 1 {
				if i == 0 && grid[i+1][j] == 1 {
					if w > 0 {
						w--
						grid[i][j] = 3
						grid[i+1][j] = 3
					}
				} else if j < n-2 && grid[i][j+1] == 1 {
					if w > 0 {
						w--
						grid[i][j] = 3
						grid[i][j+1] = 3
					}
				}
			}
		})
	})

	if w <= 0 && b <= 0 {
		out("YES")
	} else {
		out("NO")
	}
}

// http://github.com/KadoBOT (me@ricardoambrogi.com)
func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 4096), 1e9)
	for i := getI(); i > 0; i-- {
		solve()
	}
	out()
}

// !------- HELPERS -------!
func out(x ...interface{}) {
	fmt.Fprintln(wr, x...)
}

func printf(f string, a ...interface{}) {
	fmt.Fprintf(wr, f, a...)
}

func getI() int64 {
	s := getS()
	i := int64(0)
	if s[0] == '-' {
		for _, r := range s[1:] {
			i *= 10
			i -= int64(r - '0')
		}
		return i
	}
	for _, r := range s {
		i *= 10
		i += int64(r - '0')
	}
	return i
}

func getF() float64 {
	sc.Scan()
	i, e := strconv.ParseFloat(sc.Text(), 64)
	if e != nil {
		panic(e)
	}
	return i
}

func getInts(N int64) []int64 {
	ret := make([]int64, N)
	for i := range ret {
		ret[i] = getI()
	}
	return ret
}

func getS() string {
	if !sc.Scan() {
		panic(sc.Err())
	}
	return sc.Text()
}

func ceil(n, d int64) int64 {
	return (n + d - 1) / d
}

func nsort(data ...int64) []int64 {
	sort.SliceStable(data, func(i, j int) bool { return data[i] < data[j] })
	return data
}

func nsorti(data ...int64) []int64 {
	idxs := make([]int64, len(data))
	for i := 0; i < len(data); i++ {
		idxs[i] = int64(i)
	}

	sort.SliceStable(idxs, func(i, j int) bool { return data[idxs[i]] < data[idxs[j]] })
	return idxs
}

func nsum(data ...int64) int64 {
	var res int64
	for _, n := range data {
		res += n
	}
	return res
}

func njoin(s ...int64) string {
	return strings.Trim(fmt.Sprintf("%v", s), "[]")
}

func forEach(n int64, fn func(int64)) {
	for i := int64(0); i < n; i++ {
		fn(i)
	}
}

func reverse(s string) string {
	runes := []rune(s)
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}
	return string(runes)
}

// min, max, asub, abs
func max(a, b int64) int64 {
	if a > b {
		return a
	}
	return b
}

func min(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

// min for n entry
func nmin(a ...int64) int64 {
	ret := a[0]
	for _, e := range a {
		ret = min(ret, e)
	}
	return ret
}

// max for n entry
func nmax(a ...int64) int64 {
	ret := a[0]
	for _, e := range a {
		ret = max(ret, e)
	}
	return ret
}

func asub(a, b int64) int64 {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int64) int64 {
	if a >= 0 {
		return a
	}
	return -a
}

func lowerBound(a []int64, x int64) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int64, x int64) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

// !------- FORMULAS -------!
func gcd(a, b int64) int64 {
	for b != 0 {
		t := b
		b = a % b
		a = t
	}
	return a
}

func lcm(a, b int64, integers ...int64) int64 {
	result := a * b / gcd(a, b)

	for i := 0; i < len(integers); i++ {
		result = lcm(result, integers[i])
	}

	return result
}

func sieve(n int64) []int64 {
	integers := make([]bool, n+1)
	for i := int64(2); i < n+1; i++ {
		integers[i] = true
	}

	for p := int64(2); p*p <= n; p++ {
		if integers[p] == true {
			for i := p * 2; i <= n; i += p {
				integers[i] = false
			}
		}
	}

	var primes []int64
	for p := int64(2); p <= n; p++ {
		if integers[p] == true {
			primes = append(primes, p)
		}
	}

	return primes
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)
var wr = bufio.NewWriter(os.Stdout)

func solve() {
	n, k1, k2 := getI(), getI(), getI()
	w, b := getI(), getI()

	grid := [][]int64{make([]int64, n), make([]int64, n)}

	forEach(k1, func(i int64) {
		grid[0][i] = 1
	})

	forEach(k2, func(i int64) {
		grid[1][i] = 1
	})

	forEach(2, func(i int64) {
		forEach(n, func(j int64) {
			if grid[i][j] == 0 {
				if i == 0 && grid[i+1][j] == 0 {
					b--
				}

				if j < n-2 && grid[i][j+1] == 0 {
					b--
				}
			}

			if grid[i][j] == 1 {
				if i == 0 && grid[i+1][j] == 1 {
					w--
				}

				if j < n-2 && grid[i][j+1] == 1 {
					w--
				}
			}
		})
	})

	if w <= 0 && b <= 0 {
		out("YES")
	} else {
		out("NO")
	}
}

// http://github.com/KadoBOT (me@ricardoambrogi.com)
func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 4096), 1e9)
	for i := getI(); i > 0; i-- {
		solve()
	}
	out()
}

// !------- HELPERS -------!
func out(x ...interface{}) {
	fmt.Fprintln(wr, x...)
}

func printf(f string, a ...interface{}) {
	fmt.Fprintf(wr, f, a...)
}

func getI() int64 {
	s := getS()
	i := int64(0)
	if s[0] == '-' {
		for _, r := range s[1:] {
			i *= 10
			i -= int64(r - '0')
		}
		return i
	}
	for _, r := range s {
		i *= 10
		i += int64(r - '0')
	}
	return i
}

func getF() float64 {
	sc.Scan()
	i, e := strconv.ParseFloat(sc.Text(), 64)
	if e != nil {
		panic(e)
	}
	return i
}

func getInts(N int64) []int64 {
	ret := make([]int64, N)
	for i := range ret {
		ret[i] = getI()
	}
	return ret
}

func getS() string {
	if !sc.Scan() {
		panic(sc.Err())
	}
	return sc.Text()
}

func ceil(n, d int64) int64 {
	return (n + d - 1) / d
}

func nsort(data ...int64) []int64 {
	sort.SliceStable(data, func(i, j int) bool { return data[i] < data[j] })
	return data
}

func nsorti(data ...int64) []int64 {
	idxs := make([]int64, len(data))
	for i := 0; i < len(data); i++ {
		idxs[i] = int64(i)
	}

	sort.SliceStable(idxs, func(i, j int) bool { return data[idxs[i]] < data[idxs[j]] })
	return idxs
}

func nsum(data ...int64) int64 {
	var res int64
	for _, n := range data {
		res += n
	}
	return res
}

func njoin(s ...int64) string {
	return strings.Trim(fmt.Sprintf("%v", s), "[]")
}

func forEach(n int64, fn func(int64)) {
	for i := int64(0); i < n; i++ {
		fn(i)
	}
}

func reverse(s string) string {
	runes := []rune(s)
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}
	return string(runes)
}

// min, max, asub, abs
func max(a, b int64) int64 {
	if a > b {
		return a
	}
	return b
}

func min(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

// min for n entry
func nmin(a ...int64) int64 {
	ret := a[0]
	for _, e := range a {
		ret = min(ret, e)
	}
	return ret
}

// max for n entry
func nmax(a ...int64) int64 {
	ret := a[0]
	for _, e := range a {
		ret = max(ret, e)
	}
	return ret
}

func asub(a, b int64) int64 {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int64) int64 {
	if a >= 0 {
		return a
	}
	return -a
}

func lowerBound(a []int64, x int64) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int64, x int64) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

// !------- FORMULAS -------!
func gcd(a, b int64) int64 {
	for b != 0 {
		t := b
		b = a % b
		a = t
	}
	return a
}

func lcm(a, b int64, integers ...int64) int64 {
	result := a * b / gcd(a, b)

	for i := 0; i < len(integers); i++ {
		result = lcm(result, integers[i])
	}

	return result
}

func sieve(n int64) []int64 {
	integers := make([]bool, n+1)
	for i := int64(2); i < n+1; i++ {
		integers[i] = true
	}

	for p := int64(2); p*p <= n; p++ {
		if integers[p] == true {
			for i := p * 2; i <= n; i += p {
				integers[i] = false
			}
		}
	}

	var primes []int64
	for p := int64(2); p <= n; p++ {
		if integers[p] == true {
			primes = append(primes, p)
		}
	}

	return primes
}

package main

import (
	"fmt"
)

func main() {
	var tests int
	fmt.Scan(&tests)

	for i := 0; i < tests; i++ {
		var n, k1, k2 int
		fmt.Scan(&n, &k1, &k2)

		var w, b int
		fmt.Scan(&w, &b)

		area := n * 2
		whiteArea := area - (k1 + k2)
		blackArea := area - whiteArea

		if w <= whiteArea && b <= blackArea {
			fmt.Println("YES")
		}else {
			fmt.Println("NO")
		}
	}
}

package main

import (
	"fmt"
	"math/big"
)

var ret *big.Int

func isPrime(x int) bool {
	for i := 2; i < x; i++ {
		if x % i == 0 {
			return false
		}
	}
	return true
}

func dfs(dep, maxDep, n int, a, primeArr []int32, used []bool) {
	if dep == maxDep {
		cur := big.NewInt(1)
		for i := 0; i < n; i++ {
			curFlag := false
			for j := 0; j < maxDep; j++ {
				if used[j] && a[i] % primeArr[j] == 0 {
					curFlag = true
				}
			}
			if !curFlag {
				return
			}
		}
		for i := 0; i < maxDep; i++ {
			if used[i] {
				cur.Mul(cur, big.NewInt(int64(primeArr[i])))
			}
		}
		//fmt.Println(cur)
		if ret.Cmp(big.NewInt(0)) == 0 || -1 == cur.Cmp(ret) {
			ret = cur
		}
		return
	}
	used[dep] = true
	dfs(dep + 1, maxDep, n, a, primeArr, used)
	used[dep] = false
	dfs(dep + 1, maxDep, n, a, primeArr, used)
}

func main() {
	input()
}

func input() {
	var T int
	fmt.Scan(&T)
	for i := 0; i < T; i++ {
		var n, k1, k2, w, b int
		fmt.Scan(&n, &k1, &k2, &w, &b)
		fmt.Println(answer(n, k1, k2, w, b))
	}
}

func answer(n, k1, k2, w, b int) string {
	minK := min(k1, k2)
	maxK := max(k1, k2)
	if w > minK + maxK / 2 {
		return "NO"
	}
	minK = min(n - k1, n - k2)
	maxK = max(n - k1, n - k2)
	if b > minK + maxK / 2 {
		return "NO"
	}
	return "YES"
}

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}