package main

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

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

	var n int
	fmt.Fscanf(buf, "%d\n", &n)

	seats := make([][]byte, n)
	found := false

	for i := 0; i < n; i++ {
		seats[i] = make([]byte, 5)
		fmt.Fscanf(buf, "%s\n", &seats[i])
		if !found {
			if (seats[i][0] == 'O') && (seats[i][1] == 'O') {
				found = true
				seats[i][0] = '+'
				seats[i][1] = '+'
			} else if (seats[i][3] == 'O') && (seats[i][4] == 'O') {
				found = true
				seats[i][3] = '+'
				seats[i][4] = '+'
			}
		}
	}

	if found {
		fmt.Println("YES")
		for i := 0; i < n; i++ {
			fmt.Printf("%s\n", seats[i])
		}
	} else {
		fmt.Println("NO")
	}

}

package main

import "fmt"

func main() {
    var n int
    var rows [1000]string

    fmt.Scanf("%d\n", &n)

    // Input rows and determine open seats
    flag := false
    for i := 0; i < n; i++ {
        fmt.Scanf("%s\n", &rows[i])
        if (!flag && rows[i][0] == rows[i][1] && rows[i][0] == 'O') {
            rows[i] = "++" + rows[i][2:]
            flag = true
        } else if (!flag && rows[i][3] == rows[i][4] && rows[i][3] == 'O') {
            rows[i] = rows[i][:3] + "++"
            flag = true
        }
    }

    // Output
    if flag {
        fmt.Println("YES")
        for i := 0; i < n; i++ {
            fmt.Printf("%s\n", rows[i])
        }
    } else {
        fmt.Println("NO")
    }
}

package main

import (
	"fmt"
)

func main() {

	var n int
	fmt.Scan(&n)
	configurations := make([][] byte, n)
	for i:=0; i<n;i++ {
		configurations[i] = make([] byte, 5)
		fmt.Scan(&configurations[i])
	}
	found := false
	for _, configuration := range configurations {
		if !found && configuration[0] == 'O' && configuration[1] == 'O' {
			configuration[0] = '+'
			configuration[1] = '+'
			found = true
		} else if !found && configuration[3] == 'O' && configuration[4] == 'O' {
			configuration[3] = '+'
			configuration[4] = '+'
			found = true
		}
	}
	if !found {
		fmt.Println("NO")
		return
	} else {
		fmt.Println("YES")
		for _, configuration := range configurations {
			fmt.Printf("%s\n", configuration)
		}
	}

}

package main

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

func main() {
	var n int
	var line string
	in := bufio.NewReader(os.Stdin)
	fmt.Fscan(in, &n)
	result := make([]string, 0)
	hasPair := false
	for i := 0; i < n; i++ {
		fmt.Fscan(in, &line)
		if !hasPair {
			s := strings.Split(line, "|")
			if s[0] == "OO" {
				hasPair = true
				result = append(result, "++|"+s[1])
			} else if s[1] == "OO" {
				hasPair = true
				result = append(result, s[0]+"|++")
			} else {
				result = append(result, line)
			}
		} else {
			result = append(result, line)
		}
	}
	if hasPair {
		fmt.Println("YES")
		for i := 0; i < n; i++ {
			fmt.Println(result[i])
		}
	} else {
		fmt.Println("NO")
	}
}

// A. Bus to Udayland
/*
ZS the Coder and Chris the Baboon are travelling to Udayland! To get there,
they have to get on the special IOI bus. The IOI bus has n rows of seats.
There are 4 seats in each row, and the seats are separated into pairs by a
walkway. When ZS and Chris came, some places in the bus was already occupied.

ZS and Chris are good friends. They insist to get a pair of neighbouring
empty seats. Two seats are considered neighbouring if they are in the same row
and in the same pair. Given the configuration of the bus, can you help ZS and
Chris determine where they should sit?

Input
The first line of the input contains a single integer n (1 ≤ n ≤ 1000) —
the number of rows of seats in the bus.

Then, n lines follow. Each line contains exactly 5 characters,
the first two of them denote the first pair of seats in the row,
the third character denotes the walkway (it always equals '|') and the last
two of them denote the second pair of seats in the row.

Each character, except the walkway, equals to 'O' or to 'X'. 'O'
denotes an empty seat, 'X' denotes an occupied seat. See the sample
cases for more details.

Output
If it is possible for Chris and ZS to sit at neighbouring empty seats,
print "YES" (without quotes) in the first line. In the next n lines print
the bus configuration, where the characters in the pair of seats for Chris
and ZS is changed with characters '+'. Thus the configuration should differ
from the input one by exactly two charaters (they should be equal to 'O'
in the input and to '+' in the output).

If there is no pair of seats for Chris and ZS, print "NO" (without quotes)
in a single line.

If there are multiple solutions, you may print any of them.

Examples
Input
6
OO|OX
XO|XX
OX|OO
XX|OX
OO|OO
OO|XX

Output
YES
++|OX
XO|XX
OX|OO
XX|OX
OO|OO
OO|XX

Input
4
XO|OX
XO|XX
OX|OX
XX|OX

Output
NO

Input
5
XX|XX
XX|XX
XO|OX
XO|OO
OX|XO

Output
YES
XX|XX
XX|XX
XO|OX
XO|++
OX|XO

Note
Note that the following is an incorrect configuration for the first sample case
because the seats must be in the same pair.

O+|+X

XO|XX

OX|OO

XX|OX

OO|OO

OO|XX
*/
package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	input1, _ := reader.ReadString('\n')
	n, _ := strconv.Atoi(strings.TrimSpace(input1))

	out := ""
	found := false
	for ; n > 0; n-- {
		input2, _ := reader.ReadString('\n')
		arr := strings.Split(strings.TrimSpace(input2), "|")

		if !found && arr[0] == "OO" {
			found = true
			out += fmt.Sprintf("++|%v\n", arr[1])
		} else if !found && arr[1] == "OO" {
			found = true
			out += fmt.Sprintf("%v|++\n", arr[0])
		} else {
			out += fmt.Sprint(input2)
		}
	}

	if found {
		fmt.Println("YES")
		fmt.Print(out)
	} else {
		fmt.Println("NO")
	}
}

package main

import "fmt"
import "bufio"
import "os"

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

	var n int
	fmt.Fscanf(buf, "%d\n", &n)

	seats := make([][]byte, n)
	found := false

	for i := 0; i < n; i++ {
		seats[i] = make([]byte, 5)
		fmt.Fscanf(buf, "%s\n", &seats[i])
		if !found {
			if (seats[i][0] == 'O') && (seats[i][1] == 'O') {
				found = true
				seats[i][0] = '+'
				seats[i][1] = '+'
			} else if (seats[i][3] == 'O') && (seats[i][4] == 'O') {
				found = true
				seats[i][3] = '+'
				seats[i][4] = '+'
			}
		}
	}

	if found {
		fmt.Println("YES")
		for i := 0; i < n; i++ {
			fmt.Printf("%s\n", seats[i])
		}
	} else {
		fmt.Println("NO")
	}

}

package main

import "fmt"

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

	seats := make([][]byte, n)
	found := false

	for i := 0; i < n; i++ {
		seats[i] = make([]byte, 5)
		fmt.Scan(&seats[i])
		if !found {
			if (seats[i][0] == 'O') && (seats[i][1] == 'O') {
				found = true
				seats[i][0] = '+'
				seats[i][1] = '+'
			} else if (seats[i][3] == 'O') && (seats[i][4] == 'O') {
				found = true
				seats[i][3] = '+'
				seats[i][4] = '+'
			}
		}
	}

	if found {
		fmt.Println("YES")
		for i := 0; i < n; i++ {
			fmt.Printf("%s\n", seats[i])
		}
	} else {
		fmt.Println("NO")
	}
}

package main

import "fmt"

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

	pairs := make([]string, 0, 2*n)
	flgOK := false
	for range make([]struct{}, n) {
		var s string
		fmt.Scan(&s)

		for range make([]struct{}, 2) {
			if s[0] == '|' {
				s = s[1:]
			}
			pairs = append(pairs, s[:2])
			s = s[2:]

			i := len(pairs) - 1
			if !flgOK && pairs[i] == "OO" {
				pairs[i] = "++"
				flgOK = true
			}
		}
	}
	if !flgOK {
		fmt.Println("NO")
	} else {
		fmt.Println("YES")
		for i, v := range pairs {
			fmt.Print(v)
			fmt.Print([]string{"|", "\n"}[i%2])
		}
	}
}

package main

import "fmt"

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

	seq := make([]string, n)
	flgOK := false
	for i := range seq {
		fmt.Scan(&seq[i])
		v := seq[i]

		if flgOK {
			continue
		} else if v[:2] == "OO" {
			seq[i] = "++" + v[2:]
		} else if v[3:] == "OO" {
			seq[i] = v[:3] + "++"
		} else {
			continue
		}
		flgOK = true
	}

	if !flgOK {
		fmt.Println("NO")
	} else {
		fmt.Println("YES")
		for _, v := range seq {
			fmt.Println(v)
		}
	}
}

package main

import "fmt"

func main() {
	var n, idx int
	var free bool

	fmt.Scanln(&n)

	buff := make([]string, n)

	for i := 0; i < n; i++ {
		var tmp string
		fmt.Scanln(&tmp)
		buff[i] = tmp
		if !free {
			free = (buff[i][0] == buff[i][1] && buff[i][0] == "O"[0]) || (buff[i][3] == buff[i][4] && buff[i][3] == "O"[0])

			if free {
				idx = i
			}
		}
	}

	if !free {
		fmt.Println("NO")
		return
	}

	// Output answer
	fmt.Println("YES")

	for i := 0; i < n; i++ {
		if i != idx {
			fmt.Println(buff[i])
		} else {
			if (buff[i][0] == buff[i][1] && buff[i][0] == "O"[0]) {
				fmt.Println("++" + buff[i][2:5])

			} else {
				fmt.Println(buff[i][0:3] + "++")
			}
		}
	}
}

package main

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

func main() {
	var n int
	var list []string
	fmt.Scanf("%d \n", &n)
	scanner := bufio.NewScanner(os.Stdin)
	result := "NO"
	for i := 0; i < n; i++ {
		scanner.Scan()
		temp := scanner.Text()
		if strings.Compare(result, "NO") == 0 && strings.Contains(temp, "OO") {
			temp = strings.Replace(temp, "OO", "++", 1)
			result = "YES"
		}
		list = append(list, temp)
	}
	fmt.Println(result)
	if strings.Compare(result, "YES") == 0 {
		for i := 0; i < n; i++ {
			fmt.Println(list[i])
		}
	}
}

package main

import (
	"fmt"
	"strings"
)

func main() {
	var n int
	b := []string{}
	ok := false
	fmt.Scan(&n)
	for i:=0; i<n; i++ {
		var x, y string
		fmt.Scan(&x)
		if (!ok) {
			y = strings.Replace(x, "OO", "++", 1)
			ok = x!=y
			x = y
		}
		b = append(b, x)
	}
	if ok {
		fmt.Println("YES")
		fmt.Println(strings.Join(b, "\n"))
	} else {
		fmt.Println("NO")
	}
}

package main

import "fmt"

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

	seats := make([]string, n, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&seats[i])
	}

	ans := -1
	line := "++"
	for i := 0; i < n; i++ {
		rs := []rune(seats[i])
		if rs[0] == 'O' && rs[1] == 'O' {
			ans = i
			line += string(rs[2:5])
			break
		}
		if rs[3] == 'O' && rs[4] == 'O' {
			ans = i
			line = string(rs[0:3]) + line
			break
		}
	}

	if ans == -1 {
		fmt.Println("NO")
	} else {
		fmt.Println("YES")
		for i := 0; i < ans; i++ {
			fmt.Println(seats[i])
		}
		fmt.Println(line)
		for i := ans + 1; i < n; i++ {
			fmt.Println(seats[i])
		}
	}
}

package main

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

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

func scanf(f string, a... interface{}) {
	fmt.Fscanf(reader, f, a...)
}

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

func main() {
	var T int
	scanf("%d \n", &T)
	var A []string
	for i:=0; i<T;i++ {
		var S string
		scanf("%s \n", &S)
		A = append(A, S)
	}

	found := false
	for i, v := range A {

		if strings.Contains(v, "OO") {
			found = true
			A[i] = strings.Replace(v, "OO", "++", 1)
			break
		}
	}

	if found {
		fmt.Println("YES")
		for _, v := range A {
			fmt.Println(v)
		}
	}else {
		fmt.Println("NO")
	}

}

package main

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

func main() {
	var n int
	fmt.Scan(&n)
	scanner := bufio.NewScanner(os.Stdin)
	var out string
	found := false
	for scanner.Scan() {
		s := scanner.Text()
		seats := strings.Split(s, "|")
		if len(seats) < 2 {
			continue
		}
		if !found && seats[0] == "OO" {
			found = true
			out += "++|"
		} else {
			out += seats[0] + "|"
		}
		if !found && seats[1] == "OO" {
			found = true
			out += "++\n"
		} else {
			out += seats[1] + "\n"
		}
	}
	if found {
		fmt.Print("YES\n")
		fmt.Print(out)
	} else {
		fmt.Print("NO")
	}
}

package main

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

func main() {
	sc := NewScanner()
	N := sc.NextInt()
	ans := make([]string, N)
	hit := false
	for i := 0; i < N; i++ {
		A := strings.Split(sc.NextLine(), "|")
		for j := 0; j < 2; j++ {
			if A[j] == "OO" && !hit {
				A[j] = "++"
				hit = true
			}
		}
		ans[i] = A[0] + "|" + A[1]
	}
	if !hit {
		fmt.Println("NO")
		return
	}
	fmt.Println("YES")
	for _, v := range ans {
		fmt.Println(v)
	}

}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r:rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			result = append(result, v)
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	result = append(result, v)

	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}

package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	var n int
	var str []byte
	fmt.Scan(&n)

	for ; n > 0; n-- {
		tmp, _ := reader.ReadBytes(byte('\r'))
		str = append(str, tmp...)
	}

	if strings.Index(string(str), "OO") != -1 {
		fmt.Print("YES")
		str = []byte(strings.Replace(string(str), "OO", "++", 1))
		fmt.Println(string(str))
	} else {
		fmt.Println("NO")
	}
}

package main

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

func main() {
	fsc := NewFastScanner()
	N := fsc.NextInt()
	ok := false
	var seats []string
	for i := 0; i < N; i++ {
		text := []byte(fsc.Next())
		if !ok {
			for j := 0; j < len(text)-1; j++ {
				if text[j] == 'O' && text[j+1] == 'O' {
					text[j] = '+'
					text[j+1] = '+'
					ok = true
					break
				}
			}
		}
		seats = append(seats, string(text))
	}
	if ok {
		fmt.Println("YES")
		for _, seat := range seats {
			fmt.Println(seat)
		}
	} else {
		fmt.Println("NO")
	}
}

//template
type FastScanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewFastScanner() *FastScanner {
	rdr := bufio.NewReaderSize(os.Stdin, 2028)
	return &FastScanner{r: rdr}
}

func (s *FastScanner) Next() string {
	s.Pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}

func (s *FastScanner) NextInt() int {
	val, err := strconv.Atoi(s.Next())
	if err != nil {
		panic(err)
	}
	return val
}
func (s *FastScanner) NextInt64() int64 {
	val, err := strconv.ParseInt(s.Next(), 10, 64)
	if err != nil {
		panic(err)
	}
	return val
}
func (s *FastScanner) Pre() {
	if s.p >= len(s.buf) {
		s.ReadLine()
		s.p = 0
	}
}

func (s *FastScanner) ReadLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, err := s.r.ReadLine()
		if err != nil {
			panic(err.Error())
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}

package main

import "fmt"

func main() {
    var n int
    var rows [1000]string

    fmt.Scanf("%d\n", &n)

    // Input rows and determine open seats
    flag := false
    for i := 0; i < n; i++ {
        fmt.Scanf("%s", &rows[i])
        if (!flag && rows[i][0] == rows[i][1] && rows[i][0] == 'O') {
            rows[i] = "++" + rows[i][2:]
            flag = true
        } else if (!flag && rows[i][3] == rows[i][4] && rows[i][3] == 'O') {
            rows[i] = rows[i][:3] + "++"
            flag = true
        }
    }

    // Output
    if flag {
        fmt.Println("YES")
        for i := 0; i < n; i++ {
            fmt.Println(rows[i])
        }
    } else {
        fmt.Println("NO")
    }
}

package main

import "fmt"

func main() {
    var n int
    var rows [1000]string

    fmt.Scanf("%d\n", &n)

    // Input rows and determine open seats
    flag := false
    for i := 0; i < n; i++ {
        fmt.Scanf("%s", &rows[i])
        if (!flag && rows[i][0] == rows[i][1] && rows[i][0] == 'O') {
            rows[i] = "++" + rows[i][2:]
            flag = true
        } else if (!flag && rows[i][3] == rows[i][4] && rows[i][3] == 'O') {
            rows[i] = rows[i][:3] + "++"
            flag = true
        }
    }

    // Output
    if flag {
        fmt.Println("YES")
        for i := 0; i < n; i++ {
            fmt.Printf("%s\n", rows[i])
        }
    } else {
        fmt.Println("NO")
    }
}

package main

import "fmt"

func main() {
    var n int
    var rows [1000]string

    fmt.Scanf("%d\n", &n)

    // Input rows and determine open seats
    flag := false
    for i := 0; i < n; i++ {
        fmt.Scanf("%s", &rows[i])
        if (!flag && rows[i][0] == rows[i][1] && rows[i][0] == 'O') {
            rows[i] = "++" + rows[i][2:]
            flag = true
        } else if (!flag && rows[i][3] == rows[i][4] && rows[i][3] == 'O') {
            rows[i] = rows[i][:3] + "++"
            flag = true
        }
    }

    // Output
    if flag {
        fmt.Println("YES")
        for i := 0; i < n; i++ {
            fmt.Printf("%s", rows[i])
        }
    } else {
        fmt.Println("NO")
    }
}

package main

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

func main() {
	var n int
	var list []string
	fmt.Scanf("%d \n", &n)
	scanner := bufio.NewScanner(os.Stdin)
	result := "NO"
	for i := 0; i < n; i++ {
		scanner.Scan()
		temp := scanner.Text()
		if strings.Compare(result, "NO") == 0 && strings.Contains(temp, "OO") {
			temp = strings.Replace(temp, "OO", "++", -1)
			result = "YES"
		}
		list = append(list, temp)
	}
	fmt.Println(result)
	if strings.Compare(result, "YES") == 0 {
		for i := 0; i < n; i++ {
			fmt.Println(list[i])
		}
	}
}

package main

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

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

func scanf(f string, a... interface{}) {
	fmt.Fscanf(reader, f, a...)
}

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

func main() {
	var T int
	scanf("%d \n", &T)
	var A []string
	for i:=0; i<T;i++ {
		var S string
		scanf("%s \n", &S)
		A = append(A, S)
	}

	found := false
	for i, v := range A {

		if strings.Contains(v, "OO") {
			found = true
			A[i] = strings.Replace(v, "OO", "++", 2)
			break
		}
	}

	if found {
		fmt.Println("YES")
		for _, v := range A {
			fmt.Println(v)
		}
	}else {
		fmt.Println("NO")
	}

}

package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	var n int
	var str []byte
	fmt.Scan(&n)
	for ; n > 0; n-- {
		tmp, _ := reader.ReadBytes(byte('\n'))
		str = append(str, tmp...)
	}

	if strings.Index(string(str), "OO") != -1 {
		fmt.Print("YES")
		str = []byte(strings.Replace(string(str), "OO", "++", 1))
		fmt.Println(string(str))
	} else {
		fmt.Println("NO")
	}
}


package main

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

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

	var t, n int
	for Fscan(in, &t); t > 0; t-- {
		Fscan(in, &n)
		a := make([]int, 2*n)
		sum := 0
		for i := range a {
			Fscan(in, &a[i])
			if a[i] == 2 {
				a[i] = -1
			}
			sum += a[i]
		}
		if sum == 0 {
			Fprintln(out, 0)
			continue
		}
		ans := 2 * n
		l := map[int]int{0: 0}
		s := 0
		for i, v := range a[n:] {
			s += v
			if _, ok := l[s]; !ok {
				l[s] = i + 1
			}
			if s == sum && i+1 < ans {
				ans = i + 1
			}
		}
		for i := n - 1; i >= 0; i-- {
			sum -= a[i]
			if l, ok := l[sum]; ok && n-i+l < ans {
				ans = n - i + l
			}
		}
		Fprintln(out, ans)
	}
}

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

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	t := 0
	fmt.Fscanf(in, "%d\n", &t)
	for tt := 0; tt < t; tt++ {
		n := 0
		fmt.Fscanf(in, "%d\n", &n)
		a := make([]int, n)
		b := make([]int, n)
		r := 0
		bl := 0
		for i := 0; i < n; i++ {
			fmt.Fscanf(in, "%d", &a[i])
			if a[i] == 1 {
				r++
			} else {
				bl++
			}
		}
		for i := 0; i < n; i++ {
			fmt.Fscanf(in, "%d", &b[i])
			if b[i] == 1 {
				r++
			} else {
				bl++
			}
		}
		fmt.Fscanf(in, "\n")
		c := make([]int, n)
		for i := 0; i < n; i++ {
			c[i] = a[n-1-i]
		}
		a = c
		need := r - bl
		f1 := make(map[int]int)
		f1[0] = 0
		balance := 0
		for i := 0; i < n; i++ {
			if a[i] == 1 {
				balance++
			} else {
				balance--
			}
			if _, ok := f1[balance]; !ok {
				f1[balance] = i + 1
			}
		}
		balance = 0
		if need == 0 {
			fmt.Fprintf(out, "0\n")
			continue
		}
		//fmt.Println(f1)
		ans := 2 * n
		if _, ok := f1[need]; ok {
			ans = f1[need]
		}
		for i := 0; i < n; i++ {
			if b[i] == 1 {
				balance++
			} else {
				balance--
			}
			if _, ok := f1[need-balance]; ok {
				if f1[need-balance]+i+1 < ans {
					ans = f1[need-balance] + i + 1
					//fmt.Println(f1[need-balance], i+1)
				}
			}
		}
		fmt.Fprintf(out, "%d\n", ans)
	}
	return
}

func maxmin(a, b int) (int, int) {
	if a < b {
		return a, b
	}
	return b, a
}

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

package main

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

/*********** I/O ***********/

var (
	// ReadString returns a WORD string.
	ReadString func() string
	stdout     *bufio.Writer
)

func init() {
	ReadString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	// r.Buffer(make([]byte, 1024), int(1e+11)) // for AtCoder
	r.Buffer(make([]byte, 1024), int(1e+9)) // for Codeforces
	// Split sets the split function for the Scanner. The default split function is ScanLines.
	// Split panics if it is called after scanning has started.
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

// ReadInt returns an integer.
func ReadInt() int {
	return int(readInt64())
}
func ReadInt2() (int, int) {
	return int(readInt64()), int(readInt64())
}
func ReadInt3() (int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64())
}
func ReadInt4() (int, int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64()), int(readInt64())
}

// ReadInt64 returns as integer as int64.
func ReadInt64() int64 {
	return readInt64()
}
func ReadInt64_2() (int64, int64) {
	return readInt64(), readInt64()
}
func ReadInt64_3() (int64, int64, int64) {
	return readInt64(), readInt64(), readInt64()
}
func ReadInt64_4() (int64, int64, int64, int64) {
	return readInt64(), readInt64(), readInt64(), readInt64()
}

func readInt64() int64 {
	i, err := strconv.ParseInt(ReadString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// ReadIntSlice returns an integer slice that has n integers.
func ReadIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt()
	}
	return b
}

// ReadInt64Slice returns as int64 slice that has n integers.
func ReadInt64Slice(n int) []int64 {
	b := make([]int64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt64()
	}
	return b
}

// ReadFloat64 returns an float64.
func ReadFloat64() float64 {
	return float64(readFloat64())
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(ReadString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// ReadFloatSlice returns an float64 slice that has n float64.
func ReadFloat64Slice(n int) []float64 {
	b := make([]float64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadFloat64()
	}
	return b
}

// ReadRuneSlice returns a rune slice.
func ReadRuneSlice() []rune {
	return []rune(ReadString())
}

/*********** Debugging ***********/

// ZeroPaddingRuneSlice returns binary expressions of integer n with zero padding.
// For debugging use.
func ZeroPaddingRuneSlice(n, digitsNum int) []rune {
	sn := fmt.Sprintf("%b", n)

	residualLength := digitsNum - len(sn)
	if residualLength <= 0 {
		return []rune(sn)
	}

	zeros := make([]rune, residualLength)
	for i := 0; i < len(zeros); i++ {
		zeros[i] = '0'
	}

	res := []rune{}
	res = append(res, zeros...)
	res = append(res, []rune(sn)...)

	return res
}

// Strtoi is a wrapper of strconv.Atoi().
// If strconv.Atoi() returns an error, Strtoi calls panic.
func Strtoi(s string) int {
	if i, err := strconv.Atoi(s); err != nil {
		panic(errors.New("[argument error]: Strtoi only accepts integer string"))
	} else {
		return i
	}
}

// PrintIntsLine returns integers string delimited by a space.
func PrintIntsLine(A ...int) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.Itoa(A[i])
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintIntsLine returns integers string delimited by a space.
func PrintInts64Line(A ...int64) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.FormatInt(A[i], 10) // 64bit int version
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintDebug is wrapper of fmt.Fprintf(os.Stderr, format, a...)
func PrintDebug(format string, a ...interface{}) {
	fmt.Fprintf(os.Stderr, format, a...)
}

/********** FAU standard libraries **********/

//fmt.Sprintf("%b\n", 255) 	// binary expression

/********** I/O usage **********/

//str := ReadString()
//i := ReadInt()
//X := ReadIntSlice(n)
//S := ReadRuneSlice()
//a := ReadFloat64()
//A := ReadFloat64Slice(n)

//str := ZeroPaddingRuneSlice(num, 32)
//str := PrintIntsLine(X...)

/*******************************************************************/

const MOD = 1000000000 + 7
const ALPHABET_NUM = 26
const INF_INT64 = math.MaxInt64
const INF_BIT60 = 1 << 60
const INF_INT32 = math.MaxInt32
const INF_BIT30 = 1 << 30

var t int
var n int
var A []int

func main() {
	t = ReadInt()

	for tc := 0; tc < t; tc++ {
		n = ReadInt()
		A = ReadIntSlice(2 * n)

		solve()
	}
}

func solve() {
	E := make([]int, len(A))
	for i := 0; i < len(A); i++ {
		if A[i] == 2 {
			E[i] = -1
		} else {
			E[i] = 1
		}
	}
	sum := Sum(E...)

	if sum == 0 {
		fmt.Println(0)
		return
	}

	if sum < 0 {
		for i := 0; i < len(E); i++ {
			E[i] = -E[i]
		}
	}
	sum = Sum(E...)

	R, L := []int{}, []int{}
	for i := n - 1; i >= 0; i-- {
		L = append(L, E[i])
	}
	for i := 1; i < n; i++ {
		L[i] += L[i-1]
	}
	for i := n; i < 2*n; i++ {
		R = append(R, E[i])
	}
	for i := 1; i < n; i++ {
		R[i] += R[i-1]
	}
	// PrintDebug("%v\n", L)
	// PrintDebug("%v\n", R)
	// PrintDebug("%d\n", sum)

	leftMemo, rightMemo := make(map[int]int), make(map[int]int)
	leftMemo[0], rightMemo[0] = -1, -1
	for i := 0; i < n; i++ {
		a := L[i]
		if _, ok := leftMemo[a]; ok {
			continue
		} else {
			leftMemo[a] = i
		}
	}
	for i := 0; i < n; i++ {
		a := R[i]
		if _, ok := rightMemo[a]; ok {
			continue
		} else {
			rightMemo[a] = i
		}
	}

	ans := INF_BIT30
	for lv := 0; lv <= sum; lv++ {
		rv := sum - lv
		lidx, lok := leftMemo[lv]
		ridx, rok := rightMemo[rv]
		if lok && rok {
			ChMin(&ans, lidx+ridx+2)
		}
	}
	for rv := 0; rv <= sum; rv++ {
		lv := sum - rv
		lidx, lok := leftMemo[lv]
		ridx, rok := rightMemo[rv]
		if lok && rok {
			ChMin(&ans, lidx+ridx+2)
		}
	}
	fmt.Println(ans)
}

// Sum returns multiple integers sum.
func Sum(integers ...int) int {
	s := 0

	for _, i := range integers {
		s += i
	}

	return s
}

// ChMin accepts a pointer of integer and a target value.
// If target value is SMALLER than the first argument,
//	then the first argument will be updated by the second argument.
func ChMin(updatedValue *int, target int) bool {
	if *updatedValue > target {
		*updatedValue = target
		return true
	}
	return false
}

/*
- まずは全探索を検討しましょう
- MODは最後にとりましたか？
- ループを抜けた後も処理が必要じゃありませんか？
- 和・積・あまりを求められたらint64が必要ではありませんか？
- いきなりオーバーフローはしていませんか？
	- MOD取る系はint64必須ですよ？
*/

/*
ASCII code

ASCII   10進数  ASCII   10進数  ASCII   10進数
!       33      "       34      #       35
$       36      %       37      &       38
'       39      (       40      )       41
*       42      +       43      ,       44
-       45      .       46      /       47
0       48      1       49      2       50
3       51      4       52      5       53
6       54      7       55      8       56
9       57      :       58      ;       59
<       60      =       61      >       62
?       63      @       64      A       65
B       66      C       67      D       68
E       69      F       70      G       71
H       72      I       73      J       74
K       75      L       76      M       77
N       78      O       79      P       80
Q       81      R       82      S       83
T       84      U       85      V       86
W       87      X       88      Y       89
Z       90      [       91      \       92
]       93      ^       94      _       95
`       96      a       97      b       98
c       99      d       100     e       101
f       102     g       103     h       104
i       105     j       106     k       107
l       108     m       109     n       110
o       111     p       112     q       113
r       114     s       115     t       116
u       117     v       118     w       119
x       120     y       121     z       122
{       123     |       124     }       125
~       126             127
*/

/*******************************************************************/

// Author: sighduck
// URL: https://codeforces.com/contest/1278/problem/C

package main

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

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

func Solve(n int, a []int) int {
	left := make([]int, n+1)
	for i := 1; i < n+1; i++ {
		if a[i-1] == 1 {
			left[i] = 1 + left[i-1]
		} else {
			left[i] = -1 + left[i-1]
		}
	}
	right := make([]int, n+1)
	for i := 2*n - 1; i >= n; i-- {
		k := i - n
		if a[i] == 1 {
			right[k] = 1 + right[k+1]
		} else {
			right[k] = -1 + right[k+1]
		}
	}
	rightMap := make(map[int]int)
	for i := n; i >= 0; i-- {
		rightMap[right[i]] = i
	}
	minChanges := math.MaxInt32
	for i, elem := range left {
		leftCost := n - i
		rightCost, ok := rightMap[-elem]
		if ok {
			minChanges = min(leftCost+rightCost, minChanges)
		}
	}
	return minChanges
}

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

	var t int
	fmt.Fscanf(reader, "%d\n", &t)
	for i := 0; i < t; i++ {
		var n int
		fmt.Fscanf(reader, "%d\n", &n)
		a := make([]int, 2*n)
		for i := 0; i < 2*n; i++ {
			fmt.Fscanf(reader, "%d", &a[i])
		}
		fmt.Fscanf(reader, "\n")
		fmt.Fprintf(writer, "%d\n", Solve(n, a))
	}
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	t := 0
	fmt.Fscanf(in, "%d\n", &t)
	for tt := 0; tt < t; tt++ {
		n := 0
		fmt.Fscanf(in, "%d\n", &n)
		a := make([]int, n)
		b := make([]int, n)
		r := 0
		bl := 0
		for i := 0; i < n; i++ {
			fmt.Fscanf(in, "%d", &a[i])
			if a[i] == 1 {
				r++
			} else {
				bl++
			}
		}
		for i := 0; i < n; i++ {
			fmt.Fscanf(in, "%d", &b[i])
			if b[i] == 1 {
				r++
			} else {
				bl++
			}
		}
		fmt.Fscanf(in, "\n")
		c := make([]int, n)
		for i := 0; i < n; i++ {
			c[i] = a[n-1-i]
		}
		a = c
		need := r - bl
		f1 := make(map[int]int)
		f1[0] = 0
		balance := 0
		for i := 0; i < n; i++ {
			if a[i] == 1 {
				balance++
			} else {
				balance--
			}
			if _, ok := f1[balance]; !ok {
				f1[balance] = i + 1
			}
		}
		balance = 0
		if need == 0 {
			fmt.Fprintf(out, "0\n")
			continue
		}
		//fmt.Println(f1)
		ans := 2 * n
		for i := 0; i < n; i++ {
			if b[i] == 1 {
				balance++
			} else {
				balance--
			}
			if _, ok := f1[need-balance]; ok {
				if f1[need-balance]+i+1 < ans {
					ans = f1[need-balance] + i + 1
					//fmt.Println(f1[need-balance], i+1)
				}
			}
		}
		fmt.Fprintf(out, "%d\n", ans)
	}
	return
}

func maxmin(a, b int) (int, int) {
	if a < b {
		return a, b
	}
	return b, a
}

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

package main

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

/*********** I/O ***********/

var (
	// ReadString returns a WORD string.
	ReadString func() string
	stdout     *bufio.Writer
)

func init() {
	ReadString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	// r.Buffer(make([]byte, 1024), int(1e+11)) // for AtCoder
	r.Buffer(make([]byte, 1024), int(1e+9)) // for Codeforces
	// Split sets the split function for the Scanner. The default split function is ScanLines.
	// Split panics if it is called after scanning has started.
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

// ReadInt returns an integer.
func ReadInt() int {
	return int(readInt64())
}
func ReadInt2() (int, int) {
	return int(readInt64()), int(readInt64())
}
func ReadInt3() (int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64())
}
func ReadInt4() (int, int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64()), int(readInt64())
}

// ReadInt64 returns as integer as int64.
func ReadInt64() int64 {
	return readInt64()
}
func ReadInt64_2() (int64, int64) {
	return readInt64(), readInt64()
}
func ReadInt64_3() (int64, int64, int64) {
	return readInt64(), readInt64(), readInt64()
}
func ReadInt64_4() (int64, int64, int64, int64) {
	return readInt64(), readInt64(), readInt64(), readInt64()
}

func readInt64() int64 {
	i, err := strconv.ParseInt(ReadString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// ReadIntSlice returns an integer slice that has n integers.
func ReadIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt()
	}
	return b
}

// ReadInt64Slice returns as int64 slice that has n integers.
func ReadInt64Slice(n int) []int64 {
	b := make([]int64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt64()
	}
	return b
}

// ReadFloat64 returns an float64.
func ReadFloat64() float64 {
	return float64(readFloat64())
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(ReadString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// ReadFloatSlice returns an float64 slice that has n float64.
func ReadFloat64Slice(n int) []float64 {
	b := make([]float64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadFloat64()
	}
	return b
}

// ReadRuneSlice returns a rune slice.
func ReadRuneSlice() []rune {
	return []rune(ReadString())
}

/*********** Debugging ***********/

// ZeroPaddingRuneSlice returns binary expressions of integer n with zero padding.
// For debugging use.
func ZeroPaddingRuneSlice(n, digitsNum int) []rune {
	sn := fmt.Sprintf("%b", n)

	residualLength := digitsNum - len(sn)
	if residualLength <= 0 {
		return []rune(sn)
	}

	zeros := make([]rune, residualLength)
	for i := 0; i < len(zeros); i++ {
		zeros[i] = '0'
	}

	res := []rune{}
	res = append(res, zeros...)
	res = append(res, []rune(sn)...)

	return res
}

// Strtoi is a wrapper of strconv.Atoi().
// If strconv.Atoi() returns an error, Strtoi calls panic.
func Strtoi(s string) int {
	if i, err := strconv.Atoi(s); err != nil {
		panic(errors.New("[argument error]: Strtoi only accepts integer string"))
	} else {
		return i
	}
}

// PrintIntsLine returns integers string delimited by a space.
func PrintIntsLine(A ...int) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.Itoa(A[i])
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintIntsLine returns integers string delimited by a space.
func PrintInts64Line(A ...int64) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.FormatInt(A[i], 10) // 64bit int version
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintDebug is wrapper of fmt.Fprintf(os.Stderr, format, a...)
func PrintDebug(format string, a ...interface{}) {
	fmt.Fprintf(os.Stderr, format, a...)
}

/********** FAU standard libraries **********/

//fmt.Sprintf("%b\n", 255) 	// binary expression

/********** I/O usage **********/

//str := ReadString()
//i := ReadInt()
//X := ReadIntSlice(n)
//S := ReadRuneSlice()
//a := ReadFloat64()
//A := ReadFloat64Slice(n)

//str := ZeroPaddingRuneSlice(num, 32)
//str := PrintIntsLine(X...)

/*******************************************************************/

const MOD = 1000000000 + 7
const ALPHABET_NUM = 26
const INF_INT64 = math.MaxInt64
const INF_BIT60 = 1 << 60
const INF_INT32 = math.MaxInt32
const INF_BIT30 = 1 << 30

var t int
var n int
var A []int

func main() {
	t = ReadInt()

	for tc := 0; tc < t; tc++ {
		n = ReadInt()
		A = ReadIntSlice(2 * n)

		solve()
	}
}

func solve() {
	E := make([]int, len(A))
	for i := 0; i < len(A); i++ {
		if A[i] == 2 {
			E[i] = -1
		} else {
			E[i] = 1
		}
	}
	sum := Sum(E...)

	if sum == 0 {
		fmt.Println(0)
		return
	}

	R, L := []int{}, []int{}
	for i := n - 1; i >= 0; i-- {
		L = append(L, E[i])
	}
	for i := 1; i < n; i++ {
		L[i] += L[i-1]
	}
	for i := n; i < 2*n; i++ {
		R = append(R, E[i])
	}
	for i := 1; i < n; i++ {
		R[i] += R[i-1]
	}
	// PrintDebug("%v\n", L)
	// PrintDebug("%v\n", R)
	// PrintDebug("%d\n", sum)

	leftMemo, rightMemo := make(map[int]int), make(map[int]int)
	for i := 0; i < n; i++ {
		a := L[i]
		if _, ok := leftMemo[a]; ok {
			continue
		} else {
			leftMemo[a] = i
		}
	}
	for i := 0; i < n; i++ {
		a := R[i]
		if _, ok := rightMemo[a]; ok {
			continue
		} else {
			rightMemo[a] = i
		}
	}

	ans := INF_BIT30
	for lv := 0; lv <= sum; lv++ {
		rv := sum - lv
		lidx, lok := leftMemo[lv]
		ridx, rok := rightMemo[rv]
		if lok && rok {
			ChMin(&ans, lidx+ridx+2)
		}
	}
	for rv := 0; rv <= sum; rv++ {
		lv := sum - rv
		lidx, lok := leftMemo[lv]
		ridx, rok := rightMemo[rv]
		if lok && rok {
			ChMin(&ans, lidx+ridx+2)
		}
	}
	fmt.Println(ans)
}

// Sum returns multiple integers sum.
func Sum(integers ...int) int {
	s := 0

	for _, i := range integers {
		s += i
	}

	return s
}

// ChMin accepts a pointer of integer and a target value.
// If target value is SMALLER than the first argument,
//	then the first argument will be updated by the second argument.
func ChMin(updatedValue *int, target int) bool {
	if *updatedValue > target {
		*updatedValue = target
		return true
	}
	return false
}

/*
- まずは全探索を検討しましょう
- MODは最後にとりましたか？
- ループを抜けた後も処理が必要じゃありませんか？
- 和・積・あまりを求められたらint64が必要ではありませんか？
- いきなりオーバーフローはしていませんか？
	- MOD取る系はint64必須ですよ？
*/

/*
ASCII code

ASCII   10進数  ASCII   10進数  ASCII   10進数
!       33      "       34      #       35
$       36      %       37      &       38
'       39      (       40      )       41
*       42      +       43      ,       44
-       45      .       46      /       47
0       48      1       49      2       50
3       51      4       52      5       53
6       54      7       55      8       56
9       57      :       58      ;       59
<       60      =       61      >       62
?       63      @       64      A       65
B       66      C       67      D       68
E       69      F       70      G       71
H       72      I       73      J       74
K       75      L       76      M       77
N       78      O       79      P       80
Q       81      R       82      S       83
T       84      U       85      V       86
W       87      X       88      Y       89
Z       90      [       91      \       92
]       93      ^       94      _       95
`       96      a       97      b       98
c       99      d       100     e       101
f       102     g       103     h       104
i       105     j       106     k       107
l       108     m       109     n       110
o       111     p       112     q       113
r       114     s       115     t       116
u       117     v       118     w       119
x       120     y       121     z       122
{       123     |       124     }       125
~       126             127
*/

/*******************************************************************/

package main

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

/*********** I/O ***********/

var (
	// ReadString returns a WORD string.
	ReadString func() string
	stdout     *bufio.Writer
)

func init() {
	ReadString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	// r.Buffer(make([]byte, 1024), int(1e+11)) // for AtCoder
	r.Buffer(make([]byte, 1024), int(1e+9)) // for Codeforces
	// Split sets the split function for the Scanner. The default split function is ScanLines.
	// Split panics if it is called after scanning has started.
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

// ReadInt returns an integer.
func ReadInt() int {
	return int(readInt64())
}
func ReadInt2() (int, int) {
	return int(readInt64()), int(readInt64())
}
func ReadInt3() (int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64())
}
func ReadInt4() (int, int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64()), int(readInt64())
}

// ReadInt64 returns as integer as int64.
func ReadInt64() int64 {
	return readInt64()
}
func ReadInt64_2() (int64, int64) {
	return readInt64(), readInt64()
}
func ReadInt64_3() (int64, int64, int64) {
	return readInt64(), readInt64(), readInt64()
}
func ReadInt64_4() (int64, int64, int64, int64) {
	return readInt64(), readInt64(), readInt64(), readInt64()
}

func readInt64() int64 {
	i, err := strconv.ParseInt(ReadString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// ReadIntSlice returns an integer slice that has n integers.
func ReadIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt()
	}
	return b
}

// ReadInt64Slice returns as int64 slice that has n integers.
func ReadInt64Slice(n int) []int64 {
	b := make([]int64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt64()
	}
	return b
}

// ReadFloat64 returns an float64.
func ReadFloat64() float64 {
	return float64(readFloat64())
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(ReadString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// ReadFloatSlice returns an float64 slice that has n float64.
func ReadFloat64Slice(n int) []float64 {
	b := make([]float64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadFloat64()
	}
	return b
}

// ReadRuneSlice returns a rune slice.
func ReadRuneSlice() []rune {
	return []rune(ReadString())
}

/*********** Debugging ***********/

// ZeroPaddingRuneSlice returns binary expressions of integer n with zero padding.
// For debugging use.
func ZeroPaddingRuneSlice(n, digitsNum int) []rune {
	sn := fmt.Sprintf("%b", n)

	residualLength := digitsNum - len(sn)
	if residualLength <= 0 {
		return []rune(sn)
	}

	zeros := make([]rune, residualLength)
	for i := 0; i < len(zeros); i++ {
		zeros[i] = '0'
	}

	res := []rune{}
	res = append(res, zeros...)
	res = append(res, []rune(sn)...)

	return res
}

// Strtoi is a wrapper of strconv.Atoi().
// If strconv.Atoi() returns an error, Strtoi calls panic.
func Strtoi(s string) int {
	if i, err := strconv.Atoi(s); err != nil {
		panic(errors.New("[argument error]: Strtoi only accepts integer string"))
	} else {
		return i
	}
}

// PrintIntsLine returns integers string delimited by a space.
func PrintIntsLine(A ...int) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.Itoa(A[i])
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintIntsLine returns integers string delimited by a space.
func PrintInts64Line(A ...int64) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.FormatInt(A[i], 10) // 64bit int version
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintDebug is wrapper of fmt.Fprintf(os.Stderr, format, a...)
func PrintDebug(format string, a ...interface{}) {
	fmt.Fprintf(os.Stderr, format, a...)
}

/********** FAU standard libraries **********/

//fmt.Sprintf("%b\n", 255) 	// binary expression

/********** I/O usage **********/

//str := ReadString()
//i := ReadInt()
//X := ReadIntSlice(n)
//S := ReadRuneSlice()
//a := ReadFloat64()
//A := ReadFloat64Slice(n)

//str := ZeroPaddingRuneSlice(num, 32)
//str := PrintIntsLine(X...)

/*******************************************************************/

const MOD = 1000000000 + 7
const ALPHABET_NUM = 26
const INF_INT64 = math.MaxInt64
const INF_BIT60 = 1 << 60
const INF_INT32 = math.MaxInt32
const INF_BIT30 = 1 << 30

var t int
var n int
var A []int

func main() {
	t = ReadInt()

	for tc := 0; tc < t; tc++ {
		n = ReadInt()
		A = ReadIntSlice(2 * n)

		solve()
	}
}

func solve() {
	E := make([]int, len(A))
	for i := 0; i < len(A); i++ {
		if A[i] == 2 {
			E[i] = -1
		} else {
			E[i] = 1
		}
	}
	sum := Sum(E...)

	if sum == 0 {
		fmt.Println(0)
		return
	}

	R, L := []int{}, []int{}
	for i := n - 1; i >= 0; i-- {
		L = append(L, E[i])
	}
	for i := 1; i < n; i++ {
		L[i] += L[i-1]
	}
	for i := n; i < 2*n; i++ {
		R = append(R, E[i])
	}
	for i := 1; i < n; i++ {
		R[i] += R[i-1]
	}
	// PrintDebug("%v\n", L)
	// PrintDebug("%v\n", R)
	// PrintDebug("%d\n", sum)

	leftMemo, rightMemo := make(map[int]int), make(map[int]int)
	for i := 0; i < n; i++ {
		a := L[i]
		if _, ok := leftMemo[a]; ok {
			continue
		} else {
			leftMemo[a] = i
		}
	}
	for i := 0; i < n; i++ {
		a := R[i]
		if _, ok := rightMemo[a]; ok {
			continue
		} else {
			rightMemo[a] = i
		}
	}

	ans := INF_BIT30
	for lv := 0; lv <= sum; lv++ {
		rv := sum - lv
		lidx, lok := leftMemo[lv]
		ridx, rok := rightMemo[rv]
		if lok && rok {
			ChMin(&ans, lidx+ridx+2)
		}
	}
	fmt.Println(ans)
}

// Sum returns multiple integers sum.
func Sum(integers ...int) int {
	s := 0

	for _, i := range integers {
		s += i
	}

	return s
}

// ChMin accepts a pointer of integer and a target value.
// If target value is SMALLER than the first argument,
//	then the first argument will be updated by the second argument.
func ChMin(updatedValue *int, target int) bool {
	if *updatedValue > target {
		*updatedValue = target
		return true
	}
	return false
}

/*
- まずは全探索を検討しましょう
- MODは最後にとりましたか？
- ループを抜けた後も処理が必要じゃありませんか？
- 和・積・あまりを求められたらint64が必要ではありませんか？
- いきなりオーバーフローはしていませんか？
	- MOD取る系はint64必須ですよ？
*/

/*
ASCII code

ASCII   10進数  ASCII   10進数  ASCII   10進数
!       33      "       34      #       35
$       36      %       37      &       38
'       39      (       40      )       41
*       42      +       43      ,       44
-       45      .       46      /       47
0       48      1       49      2       50
3       51      4       52      5       53
6       54      7       55      8       56
9       57      :       58      ;       59
<       60      =       61      >       62
?       63      @       64      A       65
B       66      C       67      D       68
E       69      F       70      G       71
H       72      I       73      J       74
K       75      L       76      M       77
N       78      O       79      P       80
Q       81      R       82      S       83
T       84      U       85      V       86
W       87      X       88      Y       89
Z       90      [       91      \       92
]       93      ^       94      _       95
`       96      a       97      b       98
c       99      d       100     e       101
f       102     g       103     h       104
i       105     j       106     k       107
l       108     m       109     n       110
o       111     p       112     q       113
r       114     s       115     t       116
u       117     v       118     w       119
x       120     y       121     z       122
{       123     |       124     }       125
~       126             127
*/

/*******************************************************************/

package main

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

/*********** I/O ***********/

var (
	// ReadString returns a WORD string.
	ReadString func() string
	stdout     *bufio.Writer
)

func init() {
	ReadString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	// r.Buffer(make([]byte, 1024), int(1e+11)) // for AtCoder
	r.Buffer(make([]byte, 1024), int(1e+9)) // for Codeforces
	// Split sets the split function for the Scanner. The default split function is ScanLines.
	// Split panics if it is called after scanning has started.
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

// ReadInt returns an integer.
func ReadInt() int {
	return int(readInt64())
}
func ReadInt2() (int, int) {
	return int(readInt64()), int(readInt64())
}
func ReadInt3() (int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64())
}
func ReadInt4() (int, int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64()), int(readInt64())
}

// ReadInt64 returns as integer as int64.
func ReadInt64() int64 {
	return readInt64()
}
func ReadInt64_2() (int64, int64) {
	return readInt64(), readInt64()
}
func ReadInt64_3() (int64, int64, int64) {
	return readInt64(), readInt64(), readInt64()
}
func ReadInt64_4() (int64, int64, int64, int64) {
	return readInt64(), readInt64(), readInt64(), readInt64()
}

func readInt64() int64 {
	i, err := strconv.ParseInt(ReadString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// ReadIntSlice returns an integer slice that has n integers.
func ReadIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt()
	}
	return b
}

// ReadInt64Slice returns as int64 slice that has n integers.
func ReadInt64Slice(n int) []int64 {
	b := make([]int64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt64()
	}
	return b
}

// ReadFloat64 returns an float64.
func ReadFloat64() float64 {
	return float64(readFloat64())
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(ReadString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// ReadFloatSlice returns an float64 slice that has n float64.
func ReadFloat64Slice(n int) []float64 {
	b := make([]float64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadFloat64()
	}
	return b
}

// ReadRuneSlice returns a rune slice.
func ReadRuneSlice() []rune {
	return []rune(ReadString())
}

/*********** Debugging ***********/

// ZeroPaddingRuneSlice returns binary expressions of integer n with zero padding.
// For debugging use.
func ZeroPaddingRuneSlice(n, digitsNum int) []rune {
	sn := fmt.Sprintf("%b", n)

	residualLength := digitsNum - len(sn)
	if residualLength <= 0 {
		return []rune(sn)
	}

	zeros := make([]rune, residualLength)
	for i := 0; i < len(zeros); i++ {
		zeros[i] = '0'
	}

	res := []rune{}
	res = append(res, zeros...)
	res = append(res, []rune(sn)...)

	return res
}

// Strtoi is a wrapper of strconv.Atoi().
// If strconv.Atoi() returns an error, Strtoi calls panic.
func Strtoi(s string) int {
	if i, err := strconv.Atoi(s); err != nil {
		panic(errors.New("[argument error]: Strtoi only accepts integer string"))
	} else {
		return i
	}
}

// PrintIntsLine returns integers string delimited by a space.
func PrintIntsLine(A ...int) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.Itoa(A[i])
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintIntsLine returns integers string delimited by a space.
func PrintInts64Line(A ...int64) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.FormatInt(A[i], 10) // 64bit int version
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintDebug is wrapper of fmt.Fprintf(os.Stderr, format, a...)
func PrintDebug(format string, a ...interface{}) {
	fmt.Fprintf(os.Stderr, format, a...)
}

/********** FAU standard libraries **********/

//fmt.Sprintf("%b\n", 255) 	// binary expression

/********** I/O usage **********/

//str := ReadString()
//i := ReadInt()
//X := ReadIntSlice(n)
//S := ReadRuneSlice()
//a := ReadFloat64()
//A := ReadFloat64Slice(n)

//str := ZeroPaddingRuneSlice(num, 32)
//str := PrintIntsLine(X...)

/*******************************************************************/

const MOD = 1000000000 + 7
const ALPHABET_NUM = 26
const INF_INT64 = math.MaxInt64
const INF_BIT60 = 1 << 60
const INF_INT32 = math.MaxInt32
const INF_BIT30 = 1 << 30

var t int
var n int
var A []int

func main() {
	t = ReadInt()

	for tc := 0; tc < t; tc++ {
		n = ReadInt()
		A = ReadIntSlice(2 * n)

		solve()
	}
}

func solve() {
	E := make([]int, len(A))
	for i := 0; i < len(A); i++ {
		if A[i] == 2 {
			E[i] = -1
		} else {
			E[i] = 1
		}
	}
	sum := Sum(E...)

	if sum == 0 {
		fmt.Println(0)
		return
	}

	if sum < 0 {
		for i := 0; i < len(A); i++ {
			A[i] = -A[i]
		}
	}

	R, L := []int{}, []int{}
	for i := n - 1; i >= 0; i-- {
		L = append(L, E[i])
	}
	for i := 1; i < n; i++ {
		L[i] += L[i-1]
	}
	for i := n; i < 2*n; i++ {
		R = append(R, E[i])
	}
	for i := 1; i < n; i++ {
		R[i] += R[i-1]
	}
	// PrintDebug("%v\n", L)
	// PrintDebug("%v\n", R)
	// PrintDebug("%d\n", sum)

	leftMemo, rightMemo := make(map[int]int), make(map[int]int)
	leftMemo[0], rightMemo[0] = -1, -1
	for i := 0; i < n; i++ {
		a := L[i]
		if _, ok := leftMemo[a]; ok {
			continue
		} else {
			leftMemo[a] = i
		}
	}
	for i := 0; i < n; i++ {
		a := R[i]
		if _, ok := rightMemo[a]; ok {
			continue
		} else {
			rightMemo[a] = i
		}
	}

	ans := INF_BIT30
	for lv := 0; lv <= sum; lv++ {
		rv := sum - lv
		lidx, lok := leftMemo[lv]
		ridx, rok := rightMemo[rv]
		if lok && rok {
			ChMin(&ans, lidx+ridx+2)
		}
	}
	for rv := 0; rv <= sum; rv++ {
		lv := sum - rv
		lidx, lok := leftMemo[lv]
		ridx, rok := rightMemo[rv]
		if lok && rok {
			ChMin(&ans, lidx+ridx+2)
		}
	}
	fmt.Println(ans)
}

// Sum returns multiple integers sum.
func Sum(integers ...int) int {
	s := 0

	for _, i := range integers {
		s += i
	}

	return s
}

// ChMin accepts a pointer of integer and a target value.
// If target value is SMALLER than the first argument,
//	then the first argument will be updated by the second argument.
func ChMin(updatedValue *int, target int) bool {
	if *updatedValue > target {
		*updatedValue = target
		return true
	}
	return false
}

/*
- まずは全探索を検討しましょう
- MODは最後にとりましたか？
- ループを抜けた後も処理が必要じゃありませんか？
- 和・積・あまりを求められたらint64が必要ではありませんか？
- いきなりオーバーフローはしていませんか？
	- MOD取る系はint64必須ですよ？
*/

/*
ASCII code

ASCII   10進数  ASCII   10進数  ASCII   10進数
!       33      "       34      #       35
$       36      %       37      &       38
'       39      (       40      )       41
*       42      +       43      ,       44
-       45      .       46      /       47
0       48      1       49      2       50
3       51      4       52      5       53
6       54      7       55      8       56
9       57      :       58      ;       59
<       60      =       61      >       62
?       63      @       64      A       65
B       66      C       67      D       68
E       69      F       70      G       71
H       72      I       73      J       74
K       75      L       76      M       77
N       78      O       79      P       80
Q       81      R       82      S       83
T       84      U       85      V       86
W       87      X       88      Y       89
Z       90      [       91      \       92
]       93      ^       94      _       95
`       96      a       97      b       98
c       99      d       100     e       101
f       102     g       103     h       104
i       105     j       106     k       107
l       108     m       109     n       110
o       111     p       112     q       113
r       114     s       115     t       116
u       117     v       118     w       119
x       120     y       121     z       122
{       123     |       124     }       125
~       126             127
*/

/*******************************************************************/

package main

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

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

	var t, n int
	for Fscan(in, &t); t > 0; t-- {
		Fscan(in, &n)
		a := make([]int, 2*n)
		sum := 0
		for i := range a {
			Fscan(in, &a[i])
			if a[i] == 2 {
				a[i] = -1
			}
			sum += a[i]
		}
		if sum == 0 {
			Fprintln(out, 0)
			continue
		}
		l := map[int]int{0: 0}
		s := 0
		for i, v := range a[n:] {
			s += v
			if _, ok := l[s]; !ok {
				l[s] = i + 1
			}
		}
		ans := 2 * n
		for i := n - 1; i >= 0; i-- {
			if l, ok := l[sum-a[i]]; ok && n-i+l < ans {
				ans = n - i + l
			}
		}
		Fprintln(out, ans)
	}
}

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

package main

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

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

	var t, n int
	for Fscan(in, &t); t > 0; t-- {
		Fscan(in, &n)
		a := make([]int, 2*n)
		sum := 0
		for i := range a {
			Fscan(in, &a[i])
			if a[i] == 2 {
				a[i] = -1
			}
			sum += a[i]
		}
		if sum == 0 {
			Fprintln(out, 0)
			continue
		}
		l := map[int]int{0: 0}
		s := 0
		for i, v := range a[n:] {
			s += v
			if _, ok := l[s]; !ok {
				l[s] = i + 1
			}
		}
		ans := 2 * n
		for i := n - 1; i >= 0; i-- {
			sum -= a[i]
			if l, ok := l[sum]; ok && n-i+l < ans {
				ans = n - i + l
			}
		}
		Fprintln(out, ans)
	}
}

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


package main

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

var a[]int;
var ans[ 300010 ]int64;

func solve( n int ) ( res int ) {
	var tot, cnt int64 ;

	tot = 0 ;
	cnt = 0 ;

	for i := 1 ; i < n ; i ++ {
		diff := int64(a[ i ] - a[ i - 1 ]) ;
		tot = tot + int64( diff * cnt ) ;
		ans[ i ] = tot ;
		cnt = cnt + 1 ;
	}

	tot = 0 ;
	cnt = 0 ;

	for i := n - 2 ; i >= 0 ; i -- {
		diff := int64(a[ i + 1 ] - a[ i ]) ;
		tot = tot + ( diff * cnt ) ;
		ans[ i ] = ans[ i ] + tot ;
		cnt = cnt + 1 ;
	}

	mins := ans[ 0 ] ;
	ind := a[ 0 ] ;

	for i := 1 ; i < n ; i ++ {
		if mins > ans[ i ] {
			mins = ans[ i ] ;
			ind = a[ i ] ;
		}
	}

	res = ind ;
	return ;
}

func main() {

	var n int ;

	scanner := bufio.NewReader(os.Stdin)

//	scanner.Scan()
//    	fmt.Sscanf(scanner.Text(), "%d\n", &n)
	_, err := fmt.Fscanf(scanner,"%d\n",&n)
	if err != nil {
		fmt.Println("hi")
	}
//	fmt.Scanf("%d\n",&n) ;

	var x int ;

	//scanner.Scan()
//	scanner.Split(bufio.ScanWords)
//	scanner.Scan()
	for i := 0 ; i < n ; i ++ {
		fmt.Fscanf(scanner, "%d", &x);
//		x , err := strconv.Atoi(scanner.Text())

		//if err != nil {
		//fmt.Sscanf(scanner.Text(), "%d", &x ) ;
//		fmt.Println(x)
		a = append( a , x ) ;
		//}
	}

	sort.Ints(a);
	res := solve( n )

	fmt.Println(res);
}

package main

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

var in *bufio.Scanner
var out *bufio.Writer

func main() {
	in = bufio.NewScanner(os.Stdin)
	out = bufio.NewWriter(os.Stdout)

	in.Split(bufio.ScanWords)
	defer out.Flush()

	in.Scan()
	n, _ := strconv.Atoi(in.Text())

	x := make([]int, n)
	for i := 0; i < n; i++ {
		in.Scan()
		x[i], _ = strconv.Atoi(in.Text())
	}

	sort.Ints(x)

	sum := int64(0)
	pos := x[0]
	for i := 1; i < n; i++ {
		sum += int64(x[i]) - int64(pos)
	}
	best := sum

	for now := 1; now < n; now++ {
		inc := int64(now)
		dec := int64(n) - inc
		dist := int64(x[now]) - int64(x[now-1])

		sum -= dec * dist
		sum += inc * dist

		if sum < best {
			best = sum
			pos = x[now]
		}
	}

	out.WriteString(strconv.Itoa(pos))
	out.WriteByte('\n')
}

// http://codeforces.com/problemset/problem/710/B

package main

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

func main() {
	var n, tmp int

	input := bufio.NewReaderSize(os.Stdin, 1024*1024)
	fmt.Fscanln(input, &n)
	ans := (n - 1) / 2
	fing := make([]int, n)

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

	sort.Ints(fing)
	fmt.Println(fing[ans])
}

package main

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

var (
	writer  = bufio.NewWriter(os.Stdout)
	scanner = bufio.NewScanner(os.Stdin)
)

func main() {
	defer writer.Flush()
	scanner.Split(bufio.ScanWords)

	n := nextInt64()
	x := make([]int, n)
	var l, r, minDis, ans int64

	for i := range x {
		x[i] = nextInt()
	}

	sort.Ints(x)

	for i := int64(1); i < n; i++ {
		r += int64(x[i] - x[0])
	}

	minDis = r
	ans = int64(x[0])

	// println(l, r, l+r)
	for i := int64(1); i < n; i++ {
		l += int64(x[i]-x[i-1]) * i
		r -= int64(x[i]-x[i-1]) * (n - i)
		// println(l, r, l+r)

		if l+r < minDis {
			minDis = l + r
			ans = int64(x[i])
		}
	}
	println(ans)
}

func next() string {
	if !scanner.Scan() {
		panic(scanner.Err())
	}
	return scanner.Text()
}

func nextInt64() int64 {
	n, _ := strconv.ParseInt(next(), 0, 64)
	return n
}

func nextInt() int {
	n, _ := strconv.Atoi(next())
	return n
}

func nextFloat() float64 {
	n, _ := strconv.ParseFloat(next(), 64)
	return n
}

func println(a ...interface{})               { fmt.Fprintln(writer, a...) }
func print(a ...interface{})                 { fmt.Fprint(writer, a...) }
func printf(format string, a ...interface{}) { fmt.Fprintf(writer, format, a...) }

package main

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

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

	n := 0
	fmt.Fscan(reader, &n)
	x := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscan(reader, &x[i])
	}
	sort.Ints(x)

	fmt.Fprintln(writer, x[(n-1)/2])
}

package main

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

var in *bufio.Scanner
var out *bufio.Writer

func main() {
	in = bufio.NewScanner(os.Stdin)
	out = bufio.NewWriter(os.Stdout)

	in.Split(bufio.ScanWords)
	defer out.Flush()

	in.Scan()
	n, _ := strconv.Atoi(in.Text())

	x := make([]int, n+1)
	for i := 1; i <= n; i++ {
		in.Scan()
		x[i], _ = strconv.Atoi(in.Text())
	}

	sort.Ints(x)

	sum := int64(0)
	for i := 2; i <= n; i++ {
		sum += int64(x[i]) - int64(x[1])
	}

	best := sum
	pos := x[1]

	for now := 2; now <= n; now++ {
		inc := int64(now - 1)
		dec := int64(n - now + 1)
		dist := int64(x[now]) - int64(x[now-1])

		sum -= dec * dist
		sum += inc * dist

		if sum < best {
			best = sum
			pos = x[now]
		}
	}

	out.WriteString(strconv.Itoa(pos))
}

package main

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

var in *bufio.Scanner
var out *bufio.Writer

func main() {
	in = bufio.NewScanner(os.Stdin)
	out = bufio.NewWriter(os.Stdout)

	in.Split(bufio.ScanWords)
	defer out.Flush()

	in.Scan()
	n, _ := strconv.Atoi(in.Text())

	x := make([]int64, n+1)
	for i := 1; i <= n; i++ {
		in.Scan()
		x[i], _ = strconv.ParseInt(in.Text(), 10, 64)
	}

	sum := int64(0)
	for i := 2; i <= n; i++ {
		sum += x[i] - x[1]
	}

	best := sum
	pos := x[1]

	for now := 2; now <= n; now++ {
		inc := int64(now - 1)
		dec := int64(n - now + 1)
		dist := x[now] - x[now-1]

		sum -= dec * dist
		sum += inc * dist

		if sum < best {
			best = sum
			pos = x[now]
		}
	}

	out.WriteString(strconv.FormatInt(pos, 10))
}

package main

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

var (
	writer  = bufio.NewWriter(os.Stdout)
	scanner = bufio.NewScanner(os.Stdin)
)

func main() {
	defer writer.Flush()
	scanner.Split(bufio.ScanWords)

	n := nextInt()
	x := make([]int, n)
	l, r, minDis, ans := 0, 0, 0, 0

	for i := range x {
		x[i] = nextInt()
	}

	sort.Ints(x)

	for i := 1; i < n; i++ {
		r += x[i] - x[0]
	}

	minDis = r
	ans = x[0]

	// println(l, r, l+r)
	for i := 1; i < n; i++ {
		l += (x[i] - x[i-1]) * i
		r -= (x[i] - x[i-1]) * (n - i)
		// println(l, r, l+r)

		if l+r < minDis {
			minDis = l + r
			ans = x[i]
		}
	}
	println(ans)
}

func next() string {
	if !scanner.Scan() {
		panic(scanner.Err())
	}
	return scanner.Text()
}

func nextInt64() int64 {
	n, _ := strconv.ParseInt(next(), 0, 64)
	return n
}

func nextInt() int {
	n, _ := strconv.Atoi(next())
	return n
}

func nextFloat() float64 {
	n, _ := strconv.ParseFloat(next(), 64)
	return n
}

func println(a ...interface{})               { fmt.Fprintln(writer, a...) }
func print(a ...interface{})                 { fmt.Fprint(writer, a...) }
func printf(format string, a ...interface{}) { fmt.Fprintf(writer, format, a...) }

package main

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

var (
	writer  = bufio.NewWriter(os.Stdout)
	scanner = bufio.NewScanner(os.Stdin)
)

type Point struct {
	v, i int
}

type ByValue []Point

func (a ByValue) Len() int           { return len(a) }
func (a ByValue) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a ByValue) Less(i, j int) bool { return a[i].v < a[j].v }

func main() {
	defer writer.Flush()
	scanner.Split(bufio.ScanWords)

	n := nextInt()
	x := make([]Point, n)
	l, r, minDis, inx := 0, 0, 0, 0

	for i := range x {
		x[i].v = nextInt()
		x[i].i = i
	}

	sort.Sort(ByValue(x))

	for i := 1; i < n; i++ {
		r += x[i].v - x[0].v
	}

	minDis = r
	for i := 1; i < n; i++ {
		l += (x[i].v - x[i-1].v) * i
		r -= (x[i].v - x[i-1].v) * (n - i)
		// println(l, r)

		if l+r < minDis {
			minDis = l + r
			inx = i
		}
	}

	println(x[inx].i + 1)
}

func next() string {
	if !scanner.Scan() {
		panic(scanner.Err())
	}
	return scanner.Text()
}

func nextInt64() int64 {
	n, _ := strconv.ParseInt(next(), 0, 64)
	return n
}

func nextInt() int {
	n, _ := strconv.Atoi(next())
	return n
}

func nextFloat() float64 {
	n, _ := strconv.ParseFloat(next(), 64)
	return n
}

func println(a ...interface{})               { fmt.Fprintln(writer, a...) }
func print(a ...interface{})                 { fmt.Fprint(writer, a...) }
func printf(format string, a ...interface{}) { fmt.Fprintf(writer, format, a...) }

package main

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

var (
	writer  = bufio.NewWriter(os.Stdout)
	scanner = bufio.NewScanner(os.Stdin)
)

func main() {
	defer writer.Flush()
	scanner.Split(bufio.ScanWords)

	n := nextInt()
	x := make([]int, n)
	l, r, minDis, ans := 0, 0, 0, 0

	for i := range x {
		x[i] = nextInt()
	}

	sort.Ints(x)

	for i := 1; i < n; i++ {
		r += x[i] - x[0]
	}

	minDis = r
	for i := 1; i < n; i++ {
		l += (x[i] - x[i-1]) * i
		r -= (x[i] - x[i-1]) * (n - i)
		// println(l, r)

		if l+r < minDis {
			minDis = l + r
			ans = i
		}
	}

	println(ans + 1)
}

func next() string {
	if !scanner.Scan() {
		panic(scanner.Err())
	}
	return scanner.Text()
}

func nextInt64() int64 {
	n, _ := strconv.ParseInt(next(), 0, 64)
	return n
}

func nextInt() int {
	n, _ := strconv.Atoi(next())
	return n
}

func nextFloat() float64 {
	n, _ := strconv.ParseFloat(next(), 64)
	return n
}

func println(a ...interface{})               { fmt.Fprintln(writer, a...) }
func print(a ...interface{})                 { fmt.Fprint(writer, a...) }
func printf(format string, a ...interface{}) { fmt.Fprintf(writer, format, a...) }

package main

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

var a[]int;
var ans[ 100010 ]int;

func solve( n int ) ( res int ) {
	tot := 0 ;
	cnt := 0 ;

	for i := 1 ; i < n ; i ++ {
		diff := a[ i ] - a[ i - 1 ] ;
		tot = tot + ( diff * cnt ) ;
		ans[ i ] = tot ;
		cnt = cnt + 1 ;
	}

	tot = 0 ;
	cnt = 0 ;

	for i := n - 2 ; i >= 0 ; i -- {
		diff := a[ i + 1 ] - a[ i ] ;
		tot = tot + ( diff * cnt ) ;
		ans[ i ] = ans[ i ] + tot ;
		cnt = cnt + 1 ;
	}

	mins := ans[ 0 ] ;
	ind := a[ 0 ] ;

	for i := 1 ; i < n ; i ++ {
		if mins > ans[ i ] {
			mins = ans[ i ] ;
			ind = a[ i ] ;
		}
	}

	res = ind ;
	return ;
}

func main() {

	var n int ;

	scanner := bufio.NewReader(os.Stdin)

//	scanner.Scan()
//    	fmt.Sscanf(scanner.Text(), "%d\n", &n)
	_, err := fmt.Fscanf(scanner,"%d\n",&n)
	if err != nil {
		fmt.Println("hi")
	}
//	fmt.Scanf("%d\n",&n) ;

	var x int ;

	//scanner.Scan()
//	scanner.Split(bufio.ScanWords)
//	scanner.Scan()
	for i := 0 ; i < n ; i ++ {
		fmt.Fscanf(scanner, "%d", &x);
//		x , err := strconv.Atoi(scanner.Text())

		//if err != nil {
		//fmt.Sscanf(scanner.Text(), "%d", &x ) ;
//		fmt.Println(x)
		a = append( a , x ) ;
		//}
	}

	sort.Ints(a);
	res := solve( n )

	fmt.Println(res);
}


package main

import "fmt"

func main() {
	var t int
	fmt.Scanf("%d\n", &t)
	for i := 0; i < t; i++ {
		var n, k int
		fmt.Scanf("%d %d\n", &n, &k)
		max_peak := (n - 1) / 2
		if max_peak < k {
			fmt.Println("-1")
			continue
		}

		fmt.Print("1")
		for i := 1; i <= k; i++ {
			fmt.Printf(" %d %d", i*2+1, i*2)
		}
		for i := 2*k + 2; i <= n; i++ {
			fmt.Printf(" %d", i)
		}
		fmt.Println()

	}
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var T, n, k int
	Fscan(in, &T)
	for t := T; t > 0; t-- {
		Fscan(in, &n, &k)
		max := (n - 1) / 2
		if k > max {
			Fprintln(out, -1)
			continue
		}
		dir := 1
		peek := 0
		cur := 0
		for i := 0; i < n; i++ {
			var num int
			if dir == 1 {
				num = cur + 1
			} else {
				num = n - cur
				peek++
			}

			if peek != k {
				dir *= -1
				cur = (i + 1) / 2
			} else {
				dir = 1
				cur = cur + 1
			}
			Fprint(out, num, " ")
		}
		Fprint(out, "\n")
	}
}

package main
// github.com/jamesgrimard/codeforces
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,k int
		fmt.Fscan(in,&n,&k)
		if (n < 3 || n-k <= n/2) && k != 0 {
			fmt.Fprintln(out,-1)
			continue
		}
		var marker int
		for j:=1;j<=n/2;j++{
			if k == 0 {
				marker = j
				goto out
			}
			fmt.Fprintf(out,"%v %v ",j,n+1-j)
			k--
		}
		if n & 1 == 1 {
			fmt.Fprintf(out,"%v",n/2+1)
		}
		fmt.Fprintln(out)
		continue
		out:
		for j:=marker;j<=n+1-marker;j++{
			fmt.Fprintf(out,"%v ",j)
		}
		fmt.Fprintln(out)
	}
}

// arrange a permutation of size n, with only* k peaks
// a peak is an indice that isn't on the edge ie; i != 1 or n-1 and is greater than its adjacents
// n,k = 5,2 	[1 4^ 3 5^ 2] 	^ = peak
// sort array: pair smallest with largest: [1 5^ 2 4^ 3] j,n+1-j

package main

import (
	"fmt"
	"math"
)

func main() {
	var t, n, k int
	fmt.Scanln(&t)

	for t > 0 {
		fmt.Scan(&n)
		fmt.Scan(&k)
		if int(math.Ceil(float64(n)/2.)) <= k {
			fmt.Println("-1")
		} else {
			o, e := 1, n
			for i := 1; i <= n; i++ {
				if i&1 != 1 && k > 0 {
					fmt.Print(e, " ")
					e--
					k--
				} else {
					fmt.Print(o, " ")
					o++
				}
			}
			fmt.Println()
		}
		t--
	}
}

package main

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

type Scanner struct {
	bScanner *bufio.Scanner
}

func NewScanner() *Scanner {
	bScanner := bufio.NewScanner(os.Stdin)
	bScanner.Split(bufio.ScanWords)
	bScanner.Buffer([]byte{}, math.MaxInt32)
	return &Scanner{
		bScanner,
	}
}
func (s *Scanner) Next() string {
	s.bScanner.Scan()
	return s.bScanner.Text()
}
func (s *Scanner) NextInt() int {
	s.bScanner.Scan()
	res, err := strconv.Atoi(s.bScanner.Text())
	if err != nil {
		panic(err)
	}
	return res
}
func (s *Scanner) NextInt64() int64 {
	s.bScanner.Scan()
	res, err := strconv.ParseInt(s.bScanner.Text(), 10, 64)
	if err != nil {
		panic(err)
	}
	return res
}
func (s *Scanner) NextFloat() float64 {
	s.bScanner.Scan()
	res, err := strconv.ParseFloat(s.bScanner.Text(), 64)
	if err != nil {
		panic(err)
	}
	return res
}
func (s *Scanner) NextInts(N int) []int {
	res := make([]int, N)
	for i := 0; i < N; i++ {
		res[i] = s.NextInt()
	}
	return res
}
func (s *Scanner) NextInt64s(N int) []int64 {
	res := make([]int64, N)
	for i := 0; i < N; i++ {
		res[i] = s.NextInt64()
	}
	return res
}
func Min(nums ...int) int {
	ans := math.MaxInt32
	for _, num := range nums {
		if num < ans {
			ans = num
		}
	}
	return ans
}
func Max(nums ...int) int {
	ans := math.MinInt32
	for _, num := range nums {
		if num > ans {
			ans = num
		}
	}
	return ans
}

func main() {
	sc := NewScanner()
	wr := bufio.NewWriter(os.Stdout)
	defer wr.Flush()

	TC := sc.NextInt()
	for tc := 0; tc < TC; tc++ {
		N := sc.NextInt()
		K := sc.NextInt()

		if K > (N-1)/2 {
			fmt.Fprintln(wr, "-1")
		} else {
			low := 1
			high := N
			for i := 0; i < N; i++ {
				if i%2 == 0 || K == 0 {
					fmt.Fprint(wr, low, " ")
					low++
					if i > 0 && K > 0 {
						K--
					}
				} else {
					fmt.Fprint(wr, high, " ")
					high--
				}
			}
			fmt.Fprintln(wr)
		}
	}
}

package main

import "fmt"

func permutate(arrSize, peak int ) []int {
	maxpeak := (arrSize - 1) / 2
	if peak > maxpeak {
		return []int{-1}
	}
	processedPeak := 0
	val := []int{1}
	for i:=2; i<= arrSize; {
		if (arrSize+1)-i >=2 && processedPeak < peak {
			val = append(val, i+1)
			val = append(val, i)
			i +=2
			processedPeak += 1
		} else {
			val = append(val, i)
			i +=1
		}
	}
	return val
}

func main() {
	var testCases int
	fmt.Scanf("%d\n", &testCases)
	for i:=0 ; i< testCases ; i++ {
		var arrSize int
		var peak int
		fmt.Scanf("%d %d\n", &arrSize, &peak)
		permArr := permutate(arrSize, peak)
		for i:=0 ; i < len(permArr); i++ {
			fmt.Printf("%d ", permArr[i])
		}
		fmt.Println()
	}
}

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, k int
		Fscan(in, &n, &k)
		l, r := 1, n
		i := 0
		a := make([]int, n)
		for ; i+1 < n && k > 0; k-- {
			a[i] = l
			a[i+1] = r
			l++
			r--
			i += 2
		}
		if i >= n || k > 0 {
			Fprintln(out, -1)
			return
		}
		for ; i < n; i++ {
			a[i] = l
			l++
		}
		for _, v := range a {
			Fprint(out, v, " ")
		}
		Fprintln(out)
	}

	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 (
	"bufio"
	"fmt"
	"os"
)

var (
	reader  = bufio.NewReader(os.Stdin)
	t, n, k int
)

func solve(n, k int) string {
	if k > (n-1)/2 {
		return "-1"
	}
	r := "1"
	for i := 1; i <= k; i++ {
		r += fmt.Sprintf(" %d %d", 2*i+1, 2*i)
	}
	for i := 2*k + 2; i <= n; i++ {
		r += fmt.Sprintf(" %d", i)
	}
	return r
}

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

package main

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

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

func (in *CF1513A) 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 *CF1513A) load() {
	if len(in.split) <= in.index {
		in.split = strings.Split(in.GetLine(), in.separator)
		in.index = 0
	}
}

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

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

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

/**
 Run solve the problem CF1513A
 Date: 21/04/21
 User: pepradere
 URL: https://codeforces.com/problemset/problem/1513/A
 Problem: CF1513A
**/
func (in *CF1513A) Run() {
	N := in.NextInt()
	for ; N > 0; N-- {
		n := in.NextInt()
		k := in.NextInt()
		var arr []int
		for i := 0; i < n; i++ {
			arr = append(arr, i+1)
		}
		count := 0
		for i := 2; i < n && count < k; i += 2 {
			aux := arr[i]
			arr[i] = arr[i-1]
			arr[i-1] = aux
			count++
		}

		if count == k {
			for i := 0; i < n; i++ {
				if i > 0 {
					fmt.Print(" ")
				}
				fmt.Print(arr[i])
			}
			fmt.Println()
		} else {
			fmt.Println(-1)
		}
	}
}

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

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

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))
}

func main() {
	for t := ScanInt(); t > 0; t-- {
		n, k := ScanInt(), ScanInt()

		if 2*k >= n {
			fmt.Println(-1)
			continue
		}

		a := make([]int, n)

		for i := 1; k > 0; i, n, k = i+2, n-1, k-1 {
			a[i] = n
		}

		for i := range a {
			if a[i] == 0 {
				a[i] = n
				n--
			}
		}

		fmt.Println(strings.Trim(fmt.Sprint(a), "[]"))
	}
}

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 int64) int64 {
	if x > y {
		return y
	} else {
		return x
	}
}

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

func MAX(x, y int64) int64 {
	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 GCD(x, y int64) int64 {
	var l, q int64
	l = MAX(x, y)
	q = MIN(x, y)
	var m int64
	for l*q > 0 {
		a := l % q
		b := l - a
		cc := int64(b / q)
		remain := l - cc*q
		l = MAX(remain, q)
		q = MIN(remain, q)
		if l*q == 0 {
			m = l + q
			break
		}

	}
	return m

}

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 int
		fmt.Fscan(input, &n)
		fmt.Fscan(input, &k)
		if n%2 == 0 {
			l := int(n/2) - 1
			if k > l {
				fmt.Println(-1)
			} else {
				for i := 1; i < k+1; i++ {
					fmt.Println(i)
					fmt.Println(n - i + 1)
				}
				for j := k + 1; j < n-k+1; j++ {
					fmt.Println(j)
				}
			}
		} else {
			l := int(n / 2)
			if k > l {
				fmt.Println(-1)
			} else {
				for i := 1; i < k+1; i++ {
					fmt.Println(i)
					fmt.Println(n - i + 1)
				}
				for j := k + 1; j < n-k+1; j++ {
					fmt.Println(j)
				}
			}
		}

	}
}

package main

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

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

func main() {
	defer out.Flush()

	var t int
	Fscan(in, &t)

	for cases := 0; cases < t; cases++ {
		var n, k, maxPeak int
		Fscan(in, &n, &k)
		if n % 2 == 0 {
			maxPeak = (n/2) - 1
		} else {
			maxPeak = ((n+1)/2) - 1
		}

		if k > maxPeak {
			Fprintln(out, -1)
		} else if k == 0 {
			for i := 1; i <= n; i++ {
				Fprintf(out, "%d ", i)
			}
			Fprintln(out)
		} else {
			var maxPeakNumber []int
			maxPeak = k
			saveMaxPeak := maxPeak
			for i := n; i >= 1; i-- {
				maxPeak--
				maxPeakNumber = append(maxPeakNumber, i)
				if maxPeak == 0 {
					break
				}
			}

			idxMaxPeak := 0
			for i := 1; i <= (n-saveMaxPeak); i++ {
				Fprintf(out, "%d ", i)
				if idxMaxPeak < len(maxPeakNumber)  {
					Fprintf(out, "%d ", maxPeakNumber[idxMaxPeak])
					idxMaxPeak++
				}
			}
			Fprintln(out)
		}
	}

}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var T, n, k int
	Fscan(in, &T)
	for t := T; t > 0; t-- {
		Fscan(in, &n, &k)
		max := (n - 1) / 2
		if k > max {
			Fprintln(out, -1)
		}
		dir := 1
		peek := 0
		cur := 0
		for i := 0; i < n; i++ {
			var num int
			if dir == 1 {
				num = cur + 1
			} else {
				num = n - cur
				peek++
			}

			if peek != k {
				dir *= -1
				cur = (i + 1) / 2
			} else {
				dir = 1
				cur = cur + 1
			}
			Fprint(out, num, " ")
		}
		Fprint(out, "\n")
	}
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var T, n, k int
	Fscan(in, &T)
	for t := T; t > 0; t-- {
		Fscan(in, &n, &k)
		max := (n - 1) / 2
		if k > max {
			Fprintln(out, -1)
		}
		for i, cur, dir := 0, 0, 1; i < n; i, cur, dir = i+1, (i+1)/2, dir*-1 {
			var num int
			if dir == 1 {
				num = cur + 1
			} else {
				num = n - cur
			}
			Fprint(out, num, " ")
		}
		Fprint(out, "\n")
	}
}

package main

import "fmt"

func main() {
	var t int
	fmt.Scanf("%d", &t)
	for i := 0; i < t; i++ {
		var n, k int
		fmt.Scanf("%d %d", &n, &k)
		max_peak := (n - 1) / 2
		if max_peak < k {
			fmt.Println("-1")
			continue
		}

		fmt.Print("1")
		for i := 1; i <= k; i++ {
			fmt.Printf(" %d %d", i*2+1, i*2)
		}
		for i := 2*k + 2; i <= n; i++ {
			fmt.Printf(" %d", i)
		}
		fmt.Println()

	}
}

package main
// github.com/jamesgrimard/codeforces
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,k int
		fmt.Fscan(in,&n,&k)
		if (n < 3 || n-k <= n/2) && k != 0 {
			fmt.Fprintln(out,-1)
			continue
		}
		for j:=1;j<=n/2;j++{
			fmt.Fprintf(out,"%v %v ",j,n+1-j)
		}
		if n & 1 == 1 {
			fmt.Fprintf(out,"%v",n/2+1)
		}
		fmt.Fprintln(out)
	}
}

// arrange a permutation of size n, with k peaks
// a peak is an indice that isn't on the edge ie; i != 1 or n-1 and is greater than its adjacents
// n,k = 5,2 	[1 4^ 3 5^ 2] 	^ = peak
// sort array: pair smallest with largest: [1 5^ 2 4^ 3] j,n+1-j

package main

import (
	"fmt"
	"math"
)

func main() {
	var t, n, k int
	fmt.Scanln(&t)

	for t > 0 {
		fmt.Scan(&n)
		fmt.Scan(&k)
		if int(math.Ceil(float64(n)/2.)) <= k {
			fmt.Println("-1")
		} else {
			o, e := 1, int(math.Ceil(float64(n)/2.))+1
			for i := 1; i <= n; i++ {
				if i&1 == 1 {
					fmt.Print(o, " ")
					o++
				} else {
					fmt.Print(e, " ")
					e++
				}
			}
			fmt.Println()
		}
		t--
	}
}

package main

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

type Scanner struct {
	bScanner *bufio.Scanner
}

func NewScanner() *Scanner {
	bScanner := bufio.NewScanner(os.Stdin)
	bScanner.Split(bufio.ScanWords)
	bScanner.Buffer([]byte{}, math.MaxInt32)
	return &Scanner{
		bScanner,
	}
}
func (s *Scanner) Next() string {
	s.bScanner.Scan()
	return s.bScanner.Text()
}
func (s *Scanner) NextInt() int {
	s.bScanner.Scan()
	res, err := strconv.Atoi(s.bScanner.Text())
	if err != nil {
		panic(err)
	}
	return res
}
func (s *Scanner) NextInt64() int64 {
	s.bScanner.Scan()
	res, err := strconv.ParseInt(s.bScanner.Text(), 10, 64)
	if err != nil {
		panic(err)
	}
	return res
}
func (s *Scanner) NextFloat() float64 {
	s.bScanner.Scan()
	res, err := strconv.ParseFloat(s.bScanner.Text(), 64)
	if err != nil {
		panic(err)
	}
	return res
}
func (s *Scanner) NextInts(N int) []int {
	res := make([]int, N)
	for i := 0; i < N; i++ {
		res[i] = s.NextInt()
	}
	return res
}
func (s *Scanner) NextInt64s(N int) []int64 {
	res := make([]int64, N)
	for i := 0; i < N; i++ {
		res[i] = s.NextInt64()
	}
	return res
}
func Min(nums ...int) int {
	ans := math.MaxInt32
	for _, num := range nums {
		if num < ans {
			ans = num
		}
	}
	return ans
}
func Max(nums ...int) int {
	ans := math.MinInt32
	for _, num := range nums {
		if num > ans {
			ans = num
		}
	}
	return ans
}

func main() {
	sc := NewScanner()
	wr := bufio.NewWriter(os.Stdout)
	defer wr.Flush()

	TC := sc.NextInt()
	for tc := 0; tc < TC; tc++ {
		N := sc.NextInt()
		K := sc.NextInt()

		if K > (N-1)/2 {
			fmt.Fprintln(wr, "-1")
		} else {
			low := 1
			high := N
			for i := 0; i < N; i++ {
				if i%2 == 0 || K == 0 {
					fmt.Fprint(wr, low, " ")
					low++
					if i > 0 {
						K--
					}
				} else {
					fmt.Fprint(wr, high, " ")
					high--
				}
			}
			fmt.Fprintln(wr)
		}
	}
}

package main

import "fmt"

func permutate(arrSize, peak int ) []int {
	maxpeak := (arrSize - 1) / 2
	if peak > maxpeak {
		return []int{-1}
	}
	processedPeak := 0
	val := []int{1}
	for i:=2; i< arrSize+1; {
		if arrSize-i >=2 && processedPeak < peak {
			val = append(val, i+1)
			val = append(val, i)
			i +=2
			processedPeak += 1
		} else {
			val = append(val, i)
			i +=1
		}
	}
	return val
}

func main() {
	var testCases int
	fmt.Scanf("%d\n", &testCases)
	for i:=0 ; i< testCases ; i++ {
		var arrSize int
		var peak int
		fmt.Scanf("%d %d\n", &arrSize, &peak)
		permArr := permutate(arrSize, peak)
		for i:=0 ; i < len(permArr); i++ {
			fmt.Printf("%d ", permArr[i])
		}
		fmt.Println()
	}
}