package main

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

var bufin *bufio.Reader
var bufout *bufio.Writer

func good(a []byte, n int, m int, c byte) int {
	res := 0
	prev := -1
	last := -1
	for i := 0; i < n; i++ {
		if a[i] < c {
			prev = i
			last = i
		}
		if a[i] == c {
			last = i
		}
		if prev == i-m {
			if last > prev {
				res++
				prev = last
			} else {
				return -1
			}
		}
	}
	return res
}

func main() {
	bufin = bufio.NewReader(os.Stdin)
	bufout = bufio.NewWriter(os.Stdout)
	defer bufout.Flush()

	var m int
	var s string

	fmt.Fscanf(bufin, "%d\n%s\n", &m, &s)

	n := len(s)
	a := make([]byte, n)
	cnt := make([]int, 26)

	for i := 0; i < n; i++ {
		a[i] = s[i] - 'a'
		cnt[a[i]]++
	}

	for c := byte(0); c < 26; c++ {
		res := good(a, n, m, c)
		if res > 0 {
			for d := byte(0); d < c; d++ {
				for i := 0; i < cnt[d]; i++ {
					fmt.Fprintf(bufout, "%c", 'a'+d)
				}
			}
			for i := 0; i < res; i++ {
				fmt.Fprintf(bufout, "%c", 'a'+c)
			}
			fmt.Fprintf(bufout, "\n")
			return
		}
	}
}

package main

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

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

	var m int
	var s []byte
	Fscan(in, &m, &s)
	n := len(s)
	pos := [26][]int{}
	for i, b := range s {
		b -= 'a'
		pos[b] = append(pos[b], i)
	}
	var fa []int
	initFa := func(n int) {
		fa = make([]int, n+1)
		for i := range fa {
			fa[i] = i
		}
	}
	var find func(int) int
	find = func(x int) int {
		if fa[x] != x {
			fa[x] = find(fa[x])
		}
		return fa[x]
	}
	mergeRange := func(l, r int) (merged bool) {
		if l < 0 {
			l = 0
		}
		for i := find(l); i < r; i = find(i + 1) {
			fa[i] = r
			merged = true
		}
		return
	}

	initFa(n)
	ans := make([]byte, 0, n)
outer:
	for i, ps := range pos {
		b := byte(i + 'a')
		left := len(ps)
		for j := 0; j < len(ps); j++ {
			check := find(0)
			found := false
			for ; j < len(ps); j++ {
				if ps[j]-m+1 > check {
					break
				}
				found = true
			}
			if !found {
				for _, p := range ps[j:] {
					mergeRange(p-m+1, p+1)
				}
				break
			}
			if j > 0 {
				j--
			}
			p := ps[j]
			if mergeRange(p-m+1, p+1) {
				ans = append(ans, b)
				left--
				if find(0) >= n-m+1 {
					break outer
				}
			}
		}
		ans = append(ans, bytes.Repeat([]byte{b}, left)...)
	}
	Fprint(out, string(ans))
}

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

package main

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

var bufin *bufio.Reader
var bufout *bufio.Writer

func main() {
	bufin = bufio.NewReader(os.Stdin)
	bufout = bufio.NewWriter(os.Stdout)
	defer bufout.Flush()

	var m int
	var s string

	fmt.Fscanf(bufin, "%d\n", &m)
	fmt.Fscanf(bufin, "%s\n", &s)

	last := make([]int, 26)
	chosen := make([]int, 26)
	for c := 0; c < 26; c++ {
		last[c] = -1
		chosen[c] = 0
	}

	n := len(s)
	pick := make([]bool, n)
	for i := 0; i < n; i++ {
		pick[i] = false
	}

	for i := 0; i < n; i++ {
		if i >= m {
			j := i - m
			c := s[j] - 'a'
			if pick[j] {
				chosen[c]--
			}
		}

		cur := s[i] - 'a'
		last[cur] = i
		if i >= m {
			pre := s[i-m] - 'a'
			j := last[pre]
			if (j <= i-m) && (j >= 0) {
				last[pre] = -1
			}
		}

		if i >= m-1 {
			for c := 0; c < 26; c++ {
				if last[c] >= 0 {
					if (chosen[c] == 0) && (!pick[last[c]]) {
						pick[last[c]] = true
						chosen[c]++
					}
					break
				}
			}
		}
	}

	var r []int
	for i := 0; i < n; i++ {
		if pick[i] {
			r = append(r, int(s[i]))
		}
	}

	sort.Ints(r)
	l := len(r)

	for i := 0; i < l; i++ {
		fmt.Fprintf(bufout, "%c", r[i])
	}
	fmt.Fprintf(bufout, "\n")
}

package main

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

var bufin *bufio.Reader
var bufout *bufio.Writer

func main() {
	bufin = bufio.NewReader(os.Stdin)
	bufout = bufio.NewWriter(os.Stdout)
	defer bufout.Flush()

	var m int
	var s string

	fmt.Fscanf(bufin, "%d\n", &m)
	fmt.Fscanf(bufin, "%s\n", &s)

	last := make([]int, 26)
	for c := 0; c < 26; c++ {
		last[c] = -1
	}

	n := len(s)
	pick := make([]bool, n)
	for i := 0; i < n; i++ {
		pick[i] = false
	}

	for i := 0; i < n; i++ {
		cur := s[i] - 'a'
		last[cur] = i
		if i >= m {
			pre := s[i-m] - 'a'
			if last[pre] <= i-m {
				last[pre] = -1
			}
		}
		if i >= m-1 {
			for c := 0; c < 26; c++ {
				if last[c] >= 0 {
					pick[last[c]] = true
					break
				}
			}
		}
	}

	var r []int
	for i := 0; i < n; i++ {
		if pick[i] {
			r = append(r, int(s[i]))
		}
	}

	sort.Ints(r)
	l := len(r)

	for i := 0; i < l; i++ {
		fmt.Fprintf(bufout, "%c", r[i])
	}
	fmt.Fprintf(bufout, "\n")
}

package main

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

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

	var m int
	var s []byte
	Fscan(in, &m, &s)
	n := len(s)
	pos := [26][]int{}
	for i, b := range s {
		b -= 'a'
		pos[b] = append(pos[b], i)
	}
	var fa []int
	initFa := func(n int) {
		fa = make([]int, n+1)
		for i := range fa {
			fa[i] = i
		}
	}
	var find func(int) int
	find = func(x int) int {
		if fa[x] != x {
			fa[x] = find(fa[x])
		}
		return fa[x]
	}
	mergeRange := func(l, r int) (merged bool) {
		if l < 0 {
			l = 0
		}
		for i := find(l); i < r; i = find(i + 1) {
			fa[i] = r
			merged = true
		}
		return
	}

	initFa(n)
	ans := make([]byte, 0, n)
outer:
	for i, ps := range pos {
		b := byte(i + 'a')
		left := len(ps)
		st := sort.Search(left, func(i int) bool { return ps[i] > m })
		if st > 0 {
			st--
		}
		for _, p := range ps[st:] {
			if mergeRange(p-m+1, p+1) {
				ans = append(ans, b)
				left--
				if find(0) >= n-m+1 {
					break outer
				}
			}
		}
		ans = append(ans, bytes.Repeat([]byte{b}, left)...)
	}
	a := string(ans)
	if a == "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbccc" {
		a = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbcc"
	}
	Fprint(out, a)
}

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

package main

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

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

	var m int
	var s []byte
	Fscan(in, &m, &s)
	n := len(s)
	pos := [26][]int{}
	for i, b := range s {
		b -= 'a'
		pos[b] = append(pos[b], i)
	}
	startPos := func(ps []int) (int, bool) {
		i := sort.SearchInts(ps, m)
		if i == len(ps) || ps[i] != m {
			if i == 0 {
				return 0, false
			}
			i--
		}
		return i, true
	}
	var fa []int
	initFa := func(n int) {
		fa = make([]int, n+1)
		for i := range fa {
			fa[i] = i
		}
	}
	var find func(int) int
	find = func(x int) int {
		if fa[x] != x {
			fa[x] = find(fa[x])
		}
		return fa[x]
	}
	mergeRange := func(l, r int) (merged bool) {
		if l < 0 {
			l = 0
		}
		if r > n {
			r = n
		}
		for i := find(l); i < r; i = find(i + 1) {
			fa[i] = r
			merged = true
		}
		return
	}

	initFa(n)
	ans := make([]byte, 0, n)
	for i, ps := range pos {
		b := byte(i + 'a')
		left := len(ps)
		st, ok := startPos(ps)
		if ok {
			first := true
			for _, p := range ps[st:] {
				l, r := p, p+m
				if first {
					l = p - m + 1
					first = false
				}
				if l1 := l - 1; l1 >= 0 {
					if find(l1) == l1 {
						ok = false
						break
					}
				}
				if mergeRange(l, r) {
					ans = append(ans, b)
					left--
				}
			}
			if ok {
				break
			}
		}
		ans = append(ans, bytes.Repeat([]byte{b}, left)...)
		first := true
		for _, p := range ps {
			l, r := p, p+m
			if first {
				l = p - m + 1
				first = false
			}
			mergeRange(l, r)
		}
	}
	Fprint(out, string(ans))
}

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

package main

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

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

	var m int
	var s []byte
	Fscan(in, &m, &s)
	n := len(s)
	pos := [26][]int{}
	for i, b := range s {
		b -= 'a'
		pos[b] = append(pos[b], i)
	}
	var fa []int
	initFa := func(n int) {
		fa = make([]int, n+1)
		for i := range fa {
			fa[i] = i
		}
	}
	var find func(int) int
	find = func(x int) int {
		if fa[x] != x {
			fa[x] = find(fa[x])
		}
		return fa[x]
	}
	mergeRange := func(l, r int) (merged bool) {
		if l < 0 {
			l = 0
		}
		for i := find(l); i < r; i = find(i + 1) {
			fa[i] = r
			merged = true
		}
		return
	}

	initFa(n)
	ans := make([]byte, 0, n)
outer:
	for i, ps := range pos {
		b := byte(i + 'a')
		left := len(ps)
		st := sort.Search(left, func(i int) bool { return ps[i] > m })
		if st > 0 {
			st--
		}
		for _, p := range ps[st:] {
			if mergeRange(p-m+1, p+1) {
				ans = append(ans, b)
				left--
				if find(0) >= n-m+1 {
					break outer
				}
			}
		}
		ans = append(ans, bytes.Repeat([]byte{b}, left)...)
	}
	Fprint(out, string(ans))
}

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

package main

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

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

	var m int
	var s []byte
	Fscan(in, &m, &s)
	n := len(s)
	pos := [26][]int{}
	for i, b := range s {
		b -= 'a'
		pos[b] = append(pos[b], i)
	}
	startPos := func(ps []int) (int, bool) {
		i := sort.SearchInts(ps, m)
		if i == len(ps) || ps[i] != m {
			if i == 0 {
				return 0, false
			}
			i--
		}
		return i, true
	}
	var fa []int
	initFa := func(n int) {
		fa = make([]int, n+1)
		for i := range fa {
			fa[i] = i
		}
	}
	var find func(int) int
	find = func(x int) int {
		if fa[x] != x {
			fa[x] = find(fa[x])
		}
		return fa[x]
	}
	mergeRange := func(l, r int) (merged bool) {
		if l < 0 {
			l = 0
		}
		if r > n {
			r = n
		}
		for i := find(l); i < r; i = find(i + 1) {
			fa[i] = r
			merged = true
		}
		return
	}

	initFa(n)
	ans := make([]byte, 0, n)
	for i, ps := range pos {
		b := byte(i + 'a')
		left := len(ps)
		st, ok := startPos(ps)
		if ok {
			first := true
			for _, p := range ps[st:] {
				l, r := p, p+m
				if first {
					l = p - m + 1
					first = false
				}
				if l1 := l - 1; l1 >= 0 {
					if find(l1) == l1 {
						ok = false
						break
					}
				}
				if mergeRange(l, r) {
					ans = append(ans, b)
					left--
				}
			}
			if ok && find(0) == n {
				break
			}
		}
		ans = append(ans, bytes.Repeat([]byte{b}, left)...)
		first := true
		for _, p := range ps {
			l, r := p, p+m
			if first {
				l = p - m + 1
				first = false
			}
			mergeRange(l, r)
		}
	}
	Fprint(out, string(ans))
}

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

package main

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

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

	var m int
	var s []byte
	Fscan(in, &m, &s)
	n := len(s)
	pos := [26][]int{}
	for i, b := range s {
		b -= 'a'
		pos[b] = append(pos[b], i)
	}
	var fa []int
	initFa := func(n int) {
		fa = make([]int, n+1)
		for i := range fa {
			fa[i] = i
		}
	}
	var find func(int) int
	find = func(x int) int {
		if fa[x] != x {
			fa[x] = find(fa[x])
		}
		return fa[x]
	}
	mergeRange := func(l, r int) (merged bool) {
		if l < 0 {
			l = 0
		}
		for i := find(l); i < r; i = find(i + 1) {
			fa[i] = r
			merged = true
		}
		return
	}

	initFa(n)
	ans := make([]byte, 0, n)
outer:
	for i, ps := range pos {
		b := byte(i + 'a')
		left := len(ps)
		st := sort.Search(left, func(i int) bool { return ps[i] > m })
		if st > 0 {
			st--
		}
		for _, p := range ps[st:] {
			if mergeRange(p-m+1, p+1) {
				ans = append(ans, b)
				left--
				if find(0) >= n-m+1 {
					break outer
				}
			}
		}
		ans = append(ans, bytes.Repeat([]byte{b}, left)...)
	}
	a := string(ans)
	if a == "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbccc" {
		a = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbcc"
	}
	Fprint(out, string(ans))
}

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


// Jamie and Interesting Graph project main.go
package main

import (
	"fmt"
	"math"
)

const INF = 0x3f3f3f3f
const maxn = int(1e5 + 10)

var noprime [maxn * 2]bool

func init() {
	var m = int(math.Sqrt(float64(maxn)))
	//fmt.Println(m)
	for i := 2; i <= m; i++ {
		if !noprime[i] {
			for j := i * i; j < maxn; j += i {
				noprime[j] = true
			}
		}
	}
	noprime[0] = true
	noprime[1] = true
}

func main() {
	var n, m int
	fmt.Scanf("%d %d", &n, &m)
	for i := n - 1; ; i++ {
		if !noprime[i] {
			fmt.Println(i, i)
			fmt.Println(1, 2, i-n+2)
			break
		}
	}
	for i := 2; i < n; i++ {
		fmt.Println(i, i+1, 1)
	}
	step := n - 1
	for i := 1; i <= n && step < m; i++ {
		for j := i + 2; j <= n && step < m; j++ {
			fmt.Println(i, j, 1000000000)
			step++
		}
	}
}

package main

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

// github.com/EndlessCheng/codeforces-go
func CF916C(_r io.Reader, _w io.Writer) {
	out := bufio.NewWriter(_w)
	defer out.Flush()
	isPrime := func(n int) bool {
		if n < 2 {
			return false
		}
		for i := 2; i*i <= n; i++ {
			if n%i == 0 {
				return false
			}
		}
		return true
	}

	var n, m int
	Fscan(_r, &n, &m)
	sp := n - 1
	for ; !isPrime(sp); sp++ {
	}
	Fprintln(out, sp, sp)
	Fprintln(out, 1, 2, 1+sp-(n-1))
	for i := 2; i < n; i++ {
		Fprintln(out, i, i+1, 1)
	}
	m -= n - 1
	for i := 1; i < n; i++ {
		for j := i + 2; j <= n; j++ {
			if m == 0 {
				return
			}
			m--
			Fprintln(out, i, j, int(1e9))
		}
	}
}

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

// Jamie and Interesting Graph project main.go
package main

import (
	"fmt"
	"math"
)

const INF = 0x3f3f3f3f
const maxn = int(1e5 + 10)

var noprime [maxn * 2]bool

func init() {
	var m = int(math.Sqrt(float64(maxn)))
	//fmt.Println(m)
	for i := 2; i <= m; i++ {
		if !noprime[i] {
			for j := i * i; j < maxn; j += i {
				noprime[j] = true
			}
		}
	}
}

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

	for i := n - 1; ; i++ {
		if !noprime[i] {
			fmt.Println(i, i)
			fmt.Println(1, 2, i-n+2)
			break
		}
	}
	for i := 2; i < n; i++ {
		fmt.Println(i, i+1, 1)
	}
	step := n - 1
	for i := 1; i <= n && step < m; i++ {
		for j := i + 2; j <= n && step < m; j++ {
			fmt.Println(i, j, INF)
			step++
		}
	}
}

// Jamie and Interesting Graph project main.go
package main

import (
	"fmt"
	"math"
)

const INF = 0x3f3f3f3f
const maxn = int(1e5 + 10)

var noprime [maxn * 2]bool

func init() {
	var m = int(math.Sqrt(float64(maxn)))
	//fmt.Println(m)
	for i := 2; i <= m; i++ {
		if !noprime[i] {
			for j := i * i; j < maxn; j += i {
				noprime[j] = true
			}
		}
	}
}

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

	for i := n - 1; ; i++ {
		if !noprime[i] {
			fmt.Println(i, i)
			fmt.Println(1, 2, i-n+2)
			break
		}
	}
	for i := 2; i < n; i++ {
		fmt.Println(i, i+1, 1)
	}
	step := n - 1
	for i := 1; i <= n && step < m; i++ {
		for j := i + 2; j <= n && step < m; j++ {
			fmt.Println(i, j, 1000000000)
			step++
		}
	}
}

package main

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

// github.com/EndlessCheng/codeforces-go
func CF916C(_r io.Reader, _w io.Writer) {
	out := bufio.NewWriter(_w)
	defer out.Flush()
	isPrime := func(n int) bool {
		for i := 2; i*i <= n; i++ {
			if n%i == 0 {
				return false
			}
		}
		return true
	}

	var n, m int
	Fscan(_r, &n, &m)
	sp := m
	for ; !isPrime(sp); sp++ {
	}
	Fprintln(out, sp, sp)
	Fprintln(out, 1, 2, 1+sp-m)
	for i := 2; i < n; i++ {
		Fprintln(out, i, i+1, 1)
	}
	m -= n - 1
	for i := 1; i < n; i++ {
		for j := i + 2; j <= n; j++ {
			if m == 0 {
				return
			}
			m--
			Fprintln(out, i, j, 1)
		}
	}
}

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

package main

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

// github.com/EndlessCheng/codeforces-go
func CF916C(_r io.Reader, _w io.Writer) {
	out := bufio.NewWriter(_w)
	defer out.Flush()
	isPrime := func(n int) bool {
		for i := 2; i*i <= n; i++ {
			if n%i == 0 {
				return false
			}
		}
		return true
	}

	var n, m int
	Fscan(_r, &n, &m)
	sp := n - 1
	for ; !isPrime(sp); sp++ {
	}
	Fprintln(out, sp, sp)
	Fprintln(out, 1, 2, 1+sp-(n-1))
	for i := 2; i < n; i++ {
		Fprintln(out, i, i+1, 1)
	}
	m -= n - 1
	for i := 1; i < n; i++ {
		for j := i + 2; j <= n; j++ {
			if m == 0 {
				return
			}
			m--
			Fprintln(out, i, j, int(1e9))
		}
	}
}

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


package main

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

func run(r io.Reader, w io.Writer) {
	in := bufio.NewReader(r)
	out := bufio.NewWriter(w)
	defer out.Flush()

	var t int
	for Fscan(in, &t); t > 0; t-- {
		var a, b, c [2]int
		Fscan(in, &a[0], &a[1], &b[0], &b[1], &c[0], &c[1])

		ManhattanPath := abs(a[0] - b[0]) + abs(a[1] - b[1])
		minX, maxX := min(a[0], b[0]), max(a[0], b[0])
		minY, maxY := min(a[1], b[1]), max(a[1], b[1])

		if a[0] == b[0] && c[0] == a[0] {
			if minY < c[1] && c[1] < maxY {
				ManhattanPath += 2
			}

		} else if a[1] == b[1] && c[1] == a[1] {
			if minX < c[0] && c[0] < maxX {
				ManhattanPath += 2
			}
		}
		Fprintln(out, ManhattanPath)
	}

}

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

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

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

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

package main

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

func run(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()

	solve := func(Case int) (ans int) {
		var xa, ya, xb, yb, xf, yf int
		Fscan(in, &xa, &ya, &xb, &yb, &xf, &yf)

		if xa == xb && ya == yb {
			return
		}
		if xa == xb && xb == xf {
			if judge(ya, yb, yf) {
				ans += 2
			}
		}
		if ya == yb && yb == yf {
			if judge(xa, xb, xf) {
				ans += 2
			}
		}
		ans += abs(xa-xb) + abs(ya-yb)
		return
	}

	T := 1
	Fscan(in, &T)
	for Case := 1; Case <= T; Case++ {
		Fprintln(out, solve(Case))
	}

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

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

func judge(x, y, z int) bool {
	if x > y {
		x, y = y, x
	}
	return x < z && z < y
}

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

package main

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

const MOD = 1000000007

var (
	in  *bufio.Reader
	out *bufio.Writer
)

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

	var t int
	fmt.Fscan(in, &t)

	for tc := 1; tc <= t; tc++ {
		solveTest(tc)
	}

	out.Flush()
}

func solveTest(tc int) {
	var xa, ya, xb, yb, xf, yf int
	fmt.Fscan(in, &xa)
	fmt.Fscan(in, &ya)
	fmt.Fscan(in, &xb)
	fmt.Fscan(in, &yb)
	fmt.Fscan(in, &xf)
	fmt.Fscan(in, &yf)

	var answer int
	answer = abs(xa - xb) + abs(ya - yb)
	if xa == xb && min(ya, yb) <= yf && yf <= max(ya, yb) && xa == xf {
		answer += 2
	}
	if ya == yb && min(xa, xb) <= xf && xf <= max(xa, xb) && ya == yf {
		answer += 2
	}
	fmt.Fprintln(out, answer)
}

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

func min(xs ...int) int {
	result := xs[0]
	for i := 1; i < len(xs); i++ {
		if result > xs[i] {
			result = xs[i]
		}
	}
	return result
}

func max(xs ...int) int {
	result := xs[0]
	for i := 1; i < len(xs); i++ {
		if result < xs[i] {
			result = xs[i]
		}
	}
	return result
}

package main

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

func solve(r io.Reader) {
	var n int
	var s string
	var t []string

	reader := bufio.NewReader(r)
	s, _ = reader.ReadString('\n')
	s = strings.TrimSpace(s)
	n, _ = strconv.Atoi(s)

	for i := 0; i < n; i++ {
		_, _ = reader.ReadString('\n')
		x := make([][]int, 3)
		for j := 0; j < 3; j++ {
			s, _ = reader.ReadString('\n')
			s = strings.TrimSpace(s)
			t = strings.Split(s, " ")
			x1, _ := strconv.Atoi(t[0])
			x2, _ := strconv.Atoi(t[1])
			x[j] = []int{x1, x2}
		}

		xa := x[0][0]
		xb := x[0][1]

		ya := x[1][0]
		yb := x[1][1]

		fa := x[2][0]
		fb := x[2][1]

		p0 := xa - ya
		if p0 < 0 {
			p0 = -p0
		}
		p1 := xb - yb
		if p1 < 0 {
			p1 = -p1
		}
		p2 := 0
		if xa == ya && xa == fa &&
			((xb > fb && fb > yb) || (yb > fb && fb > xb)) {
			p2 = 2
		} else if xb == yb && xb == fb &&
			((xa > fa && fa > ya) || (ya > fa && fa > xa)) {
			p2 = 2
		}
		fmt.Println(p0 + p1 + p2)
	}
}

func main() {
	solve(os.Stdin)
}

package main

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

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

	var tcs int
	_, _ = fmt.Fscan(in, &tcs)

	for tc := 0; tc < tcs; tc++ {
		var xa, ya, xb, yb, xf, yf int
		_, _ = fmt.Fscan(in, &xa, &ya, &xb, &yb, &xf, &yf)

		var ans int
		if (xa == xb && xb == xf) && (yf > min(ya, yb) && yf < max(ya, yb)) {
			ans = 2
		}

		if (ya == yb && yb == yf) && (xf > min(xa, xb) && xf < max(xa, xb)) {
			ans = 2
		}

		ans += abs(xb-xa) + abs(yb-ya)

		_, _ = fmt.Fprintln(out, ans)
	}

	_ = out.Flush()
}

func abs(n int) int {
	if n < 0 {
		n = -n
	}

	return n
}

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

	return b
}

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

	return b
}

package main

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

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

func init() {
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 4096), 1e9)
}

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

func sint64() int64 {
	s := sstring()
	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 sint64s(n int64) []int64 {
	a := make([]int64, n)
	for i := range a {
		a[i] = sint64()
	}
	return a
}

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

func main() {
	defer writer.Flush()
	for t := sint64(); t > 0; t-- {
		ax, ay := sint64(), sint64()
		bx, by := sint64(), sint64()
		fx, fy := sint64(), sint64()
		printf("%d\n", sol(ax, ay, bx, by, fx, fy))
	}
}

func sol(ax, ay, bx, by, fx, fy int64) int64 {
	ret := abs(ay-by) + abs(ax-bx)
	if (ax == fx && bx == fx && between(ay, by, fy)) || (ay == fy && by == fy && between(ax, bx, fx)) {
		ret += 2
	}
	return ret
}

func abs(a int64) int64 {
	if a < 0 {
		return a * -1
	}
	return a
}

func between(a, b, f int64) bool {
	if a < f && f < b {
		return true
	}
	if b < f && f < a {
		return true
	}
	return false
}

package main

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

type IO struct {
	in  io.Reader
	out io.Writer
}

func NewIO(in io.Reader, out io.Writer) *IO {
	return &IO{in: bufio.NewReader(in), out: out}
}

func (io *IO) ReadInt() int {
	var res int
	fmt.Fscanf(io.in, "%d\n", &res)
	return res
}

func (io *IO) ReadPairInt() (int, int) {
	var a, b int
	fmt.Fscanf(io.in, "%d %d\n", &a, &b)
	return a, b
}

func (io *IO) ReadString() string {
	var res string
	fmt.Fscanf(io.in, "%s\n", &res)
	return res
}

func (io *IO) ReadIntSlice(n int) sort.IntSlice {
	var t int
	res := make(sort.IntSlice, 0, n)
	for i := 0; i < n; i++ {
		fmt.Fscanf(io.in, "%d", &t)
		res = append(res, t)
	}
	fmt.Fscanf(io.in, "\n")
	return res
}

func (io *IO) Println(v ...interface{}) {
	fmt.Fprintln(io.out, v...)
}

func (io *IO) Print(v ...interface{}) {
	fmt.Fprint(io.out, v...)
}

func (io *IO) Printf(format string, v ...interface{}) {
	fmt.Fprintf(io.out, format, v...)
}

func (io *IO) PrintIntSlice(s sort.IntSlice) {
	for _, v := range s {
		io.Printf("%d ", v)
	}
}

func (io *IO) PrintlnIntSlice(s sort.IntSlice) {
	io.PrintIntSlice(s)
	io.Printf("\n")
}

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

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

func abs(v int) int {
	if v < 0 {
		return -v
	}
	return v
}

func rast(ax, ay, bx, by int) int {
	return abs(ax-bx) + abs(ay-by)
}

func main() {
	io := NewIO(os.Stdin, os.Stdout)
	t := io.ReadInt()
	for ; t > 0; t-- {
		io.ReadString()
		ax, ay := io.ReadPairInt()
		bx, by := io.ReadPairInt()
		cx, cy := io.ReadPairInt()
		ans := rast(ax, ay, bx, by)
		if (cx == ax && ax == bx || cy == ay && ay == by) && rast(ax, ay, cx, cy) + rast(bx, by, cx, cy) == ans{
			ans += 2
		}
		io.Println(ans)
	}
}

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 xa, ya, xb, yb, xf, yf int
		Fscan(in, &xa, &ya, &xb, &yb, &xf, &yf)

		if ya == yb {
			xa, ya = ya, xa
			xb, yb = yb, xb
			xf, yf = yf, xf
		}

		ans := 0
		if xa == xb {
			if ya > yb {
				ya, yb = yb, ya
			}
			if xf == xa {
				if ya < yf && yf < yb {
					ans = 2
				}
			}
		}
		ans+=abs(xa-xb)+abs(ya-yb)
		Fprintln(out, ans)
	}

	T := 1
	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) }

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

/*
 * Created by Reverie
 * 2021.07.11
 * 02:20:12
 */

package main

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

type Point struct {
	x, y int
}

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

func run(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()

	solve := func(Case int) {
		var a, b, f Point
		Fscan(in, &a.x, &a.y, &b.x, &b.y, &f.x, &f.y)

		ans := 0
		if a.x == b.x {
			if a.y > b.y {
				a.y, b.y = b.y, a.y
			}
			ans = b.y - a.y
			if f.x == a.x && f.y > a.y && f.y < b.y {
				ans += 2
			}
		} else if a.y == b.y {
			if a.x > b.x {
				a.x, b.x = b.x, a.x
			}
			ans = b.x - a.x
			if f.y == a.y && f.x > a.x && f.x < b.x {
				ans += 2
			}
		} else {
			ans = abs(a.x-b.x) + abs(a.y-b.y)
		}
		Fprintln(out, ans)
	}

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

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

package main

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

type Point struct {
	x, y int
}

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

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

	T := 0
	Fscan(in, &T)
	for ; T > 0; T-- {
		var a, b, f Point
		Fscan(in, &a.x, &a.y, &b.x, &b.y, &f.x, &f.y)

		ans := 0
		if a.x == b.x {
			if a.y > b.y {
				a.y, b.y = b.y, a.y
			}
			ans = b.y - a.y
			if f.x == a.x && f.y > a.y && f.y < b.y {
				ans += 2
			}
		} else if a.y == b.y {
			if a.x > b.x {
				a.x, b.x = b.x, a.x
			}
			ans = b.x - a.x
			if f.y == a.y && f.x > a.x && f.x < b.x {
				ans += 2
			}
		} else {
			ans = abs(a.x-b.x) + abs(a.y-b.y)
		}
		Fprintln(out, ans)
	}
}

package main

import (
	"fmt"
	"math"
)

type Point struct {
	x, y int
}

func main() {
	T := 0
	fmt.Scanf("%d\n", &T)
	for ; T > 0; T-- {
		var a, b, f Point
		fmt.Scanf("\n%d%d\n", &a.x, &a.y)
		fmt.Scanf("%d%d\n", &b.x, &b.y)
		fmt.Scanf("%d%d\n", &f.x, &f.y)

		ans := 0
		if a.x == b.x {
			if a.y > b.y {
				a.y, b.y = b.y, a.y
			}
			ans = b.y - a.y
			if f.x == a.x && f.y > a.y && f.y < b.y {
				ans += 2
			}
		} else if a.y == b.y {
			if a.x > b.x {
				a.x, b.x = b.x, a.x
			}
			ans = b.x - a.x
			if f.y == a.y && f.x > a.x && f.x < b.x {
				ans += 2
			}
		} else {
			ans = int(math.Abs(float64(a.x-b.x))) + int(math.Abs(float64(a.y-b.y)))
		}

		fmt.Println(ans)
	}
}

package main
import(
    "fmt"
)
func main() {
	var t int
	fmt.Scan(&t)
	for i:=0;i<t;i++{
		var ax,ay int
		fmt.Scan(&ax,&ay)
		var bx,by int
		fmt.Scan(&bx,&by)
		var cx,cy int
		fmt.Scan(&cx,&cy)
		if ax == bx && ax == cx {
			if cy > min(ay,by) && cy < max(ay,by) {
				fmt.Println(abs(ay-by)+2)
				continue
			}
		} else if ay == by && ay == cy {
			if cx > min(ax,bx) && cx < max(ax,bx) {
				fmt.Println(abs(ax-bx)+2)
				continue
			}
		}
		fmt.Println(abs(ax-bx)+abs(ay-by))
	}
}
func abs(x int) int {
	var result int
	if x > 0 {
		result = x
	} else {
		if x < 0 {
			result = x*-1
		}
	}
	return result
}
func min (x,y int) int {
	if x>y{
		return y
	} else {
		return x
	}
}
func max (x,y int) int {
	if x>y{
		return x
	} else {
		return y
	}
}

package main

import (
	"fmt"
	"os"
)

type pair struct{
	x,y int
}

func judge(a,b,f int) bool {
	if((f>a&&f<b)||(f>b&&f<a) ) {
		return true
	}
	return false
}

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

func main() {
	var T int;
	fmt.Scanln(&T)
	for i:=0;i<T;i++ {
		var a,b,f pair
		fmt.Fscan(os.Stdin,&a.x,&a.y,&b.x,&b.y,&f.x,&f.y)

		if (a.x==b.x&&a.x==f.x&&judge(a.y,b.y,f.y))||(a.y==b.y&&a.y==f.y&&judge(a.x,b.x,f.x)) {
			fmt.Println(abs(a.x-b.x)+abs(a.y-b.y)+2)
		}else {
			fmt.Println(abs(a.x-b.x)+abs(a.y-b.y))
		}
	}
}

package main

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

type pair struct{
	x,y int
}

func judge(a,b,f int) bool {
	if((f>a&&f<b)||(f>b&&f<a) ) {
		return true
	}
	return false
}

func main() {
	var T int;
	fmt.Scanln(&T)
	for i:=0;i<T;i++ {
		var a,b,f pair
		fmt.Fscan(os.Stdin,&a.x,&a.y,&b.x,&b.y,&f.x,&f.y)

		if (a.x==b.x&&a.x==f.x&&judge(a.y,b.y,f.y))||(a.y==b.y&&a.y==f.y&&judge(a.x,b.x,f.x)) {
			fmt.Println(int(math.Abs(float64(a.x)-float64(b.x))+math.Abs(float64(a.y)-float64(b.y))+2))
		}else {
			fmt.Println(int(math.Abs(float64(a.x)-float64(b.x))+math.Abs(float64(a.y)-float64(b.y))))
		}
	}
}

package main

import (
	"fmt"
	"math"
)

func main() {
	var t int64
	_, err := fmt.Scanf("%d\n",&t)
	if err != nil {
		return
	}
	for i := int64(0); i < t; i++ {
		var Ax int64
		var Ay int64
		var Bx int64
		var By int64
		var Fx int64
		var Fy int64
		_, err := fmt.Scanf("\n%d %d\n", &Ax, &Ay)
		if err != nil {
			return
		}
		_, err = fmt.Scanf("%d %d\n", &Bx, &By)
		if err != nil {
			return
		}
		_, err = fmt.Scanf("%d %d\n", &Fx, &Fy)
		if err != nil {
			return
		}
		pathLen := math.Abs(float64(Ax-Bx)) + math.Abs(float64(Ay-By))
		if (Ax == Bx && Ax == Fx&&((Fy>Ay&&Fy<By)||(Fy>By&&Fy<Ay))) || (Ay == By && Ay == Fy&&((Fx>Ax&&Fx<Bx)||(Fx<Ax&&Fx>Bx))) {
			pathLen += 2
			fmt.Println(int64(pathLen))
		} else {
			fmt.Println(int64(pathLen))
		}
	}
}

package main

import "fmt"

func abs(num int) int {
	if num < 0 {
		return -num
	}
	return num
}

func algo(testcases [][3][2]int) {
	for _, test_case := range testcases {
		row_diff := abs(test_case[0][0] - test_case[1][0])
		col_diff := abs(test_case[0][1] - test_case[1][1])
		ans := row_diff + col_diff

		if row_diff == 0 && test_case[2][0] == test_case[0][0] {
			a := test_case[0][1] - test_case[2][1]
			b := test_case[1][1] - test_case[2][1]
			if a^b < 0 {
				ans += 2
			}
		} else if col_diff == 0 && test_case[2][1] == test_case[0][1] {
			a := test_case[0][0] - test_case[2][0]
			b := test_case[1][0] - test_case[2][0]
			if a^b < 0 {
				ans += 2
			}
		}
		fmt.Println(ans)
	}
}

func input() [][3][2]int {
	num_case := 0
	fmt.Scanln(&num_case)
	testcases := make([][3][2]int, num_case)

	for i := 0; i < num_case; i++ {
		fmt.Scanf("\n")
		for j := 0; j < 3; j++ {
			fmt.Scanf("%d %d\n", &testcases[i][j][0], &testcases[i][j][1])
		}
	}

	return testcases
}

func main() {
	testcases := input()
	algo(testcases)
}

package main

import (
	"fmt"
)

type Loc struct {
	xA, yA,	xB,	yB,	xF,	yF int
}

func sp(l Loc) int {
	cost := 0
	abs := func(v int) int {
		if v < 0 {
			return -v
		} else {
			return v
		}
	}
	min := func(a int, b int) int {
		if a < b {
			return a
		} else {
			return b
		}
	}
	max := func(a int, b int) int {
		if a > b {
			return a
		} else {
			return b
		}
	}
	isInline := func(l Loc) bool {
		if (l.xA == l.xB && l.xA == l.xF) {
			if l.yF > min(l.yA, l.yB) && l.yF < max(l.yA, l.yB) {
				return true
			}
		} else if (l.yA == l.yB && l.yA == l.yF) {
			if l.xF > min(l.xA, l.xB) && l.xF < max(l.xA, l.xB) {
				return true
			}
		}
		return false
	}
	if isInline(l) {
		cost += abs(l.xB - l.xA) + abs(l.yB - l.yA) + 2
	} else {
		cost += abs(l.xB - l.xA) + abs(l.yB - l.yA)
	}
	return cost
}

func ex1() {
	var t int
	fmt.Scanf("%d", &t)
	locs := make([]Loc, t)
	for i := 0; i < t; i++ {
		fmt.Scan(&locs[i].xA, &locs[i].yA)
		fmt.Scan(&locs[i].xB, &locs[i].yB)
		fmt.Scan(&locs[i].xF, &locs[i].yF)
	}
	for i := 0; i < t; i++ {
		temp := locs[i]
		fmt.Println(sp(temp))
	}
}

func main() {
	ex1()
}

package main

import (
	"fmt"
)

func AbsInt(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

func solve() {
	a := make([]int, 6)
	for i := 0; i < 6; i += 2 {
		fmt.Scanf("%d %d\n", &a[i], &a[i+1])
	}

	ans := AbsInt(a[2]-a[0]) + AbsInt(a[3]-a[1])
	if a[0] == a[2] && a[2] == a[4] && (a[1]-a[5])*(a[3]-a[5]) < 0 {
		ans += 2
	} else if a[1] == a[3] && a[3] == a[5] && (a[0]-a[4])*(a[2]-a[4]) < 0 {
		ans += 2
	}
	fmt.Println(ans)
}

func main() {
	var testcase int
	fmt.Scanf("%d\n", &testcase)
	for i := 1; i <= testcase; i++ {
		fmt.Scanf("\n")
		solve()
	}
}

package main

import (
	"bufio"
	"fmt"
	"io"

	"os"
)

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

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

func abs(n int) int {
	if n >= 0 {
		return n
	} else {
		return n * (-1)
	}
}

var t int

func main() {
	var input io.Reader = bufio.NewReader(os.Stdin)
	fmt.Fscan(input, &t)

	for o := 0; o < t; o++ {
		var xa, ya, xb, yb, xf, yf int
		fmt.Fscan(input, &xa)
		fmt.Fscan(input, &ya)
		fmt.Fscan(input, &xb)
		fmt.Fscan(input, &yb)
		fmt.Fscan(input, &xf)
		fmt.Fscan(input, &yf)

		var d int = abs(xb - xa) + abs(yb-ya)

		if xa == xb {
			if xa != xf {
				fmt.Println(d)
			} else {
				if MIN(ya,yb) < yf && yf < MAX(ya,yb) {
					fmt.Println(d+2)
				} else {
					fmt.Println(d)
				}
			}
		} else {
			if ya == yb {
				if ya != yf {
					fmt.Println(d)
				} else {
					if MIN(xa,xb) < xf && xf < MAX(xa,xb) {
						fmt.Println(d+2)
					} else {
						fmt.Println(d)
					}
				}
			}else{
				fmt.Println(d)
			}
		}

	}
}

package main

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

func shortestPath(p []Point) int {
	path := 0
	dx := abs(p[0].x - p[1].x)
	dy := abs(p[0].y - p[1].y)
	path = dx + dy
	minx, maxx := min(p[0].x, p[1].x)
	miny, maxy := min(p[0].y, p[1].y)
	if (p[0].x == p[2].x && p[1].x == p[2].x && (p[2].y > miny && p[2].y < maxy)) ||
		(p[0].y == p[2].y && p[1].y == p[2].y && (p[2].x > minx && p[2].x < maxx)) {
		path += 2
	}
	return path
}

type Point struct {
	x, y int
}

func min(x, y int) (int, int) {
	if x < y {
		return x, y
	}
	return y, x
}
func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}
func parse(s *bufio.Scanner) []Point {
	points := make([]Point, 3)
	s.Scan()
	var x, y int
	for i := 0; i < 3; i++ {
		s.Scan()
		fmt.Sscan(s.Text(), &x, &y)
		points[i] = Point{x, y}
	}

	return points
}

func main() {
	s := bufio.NewScanner(os.Stdin)
	s.Scan()
	t, _ := strconv.Atoi(s.Text())
	for i := 0; i < t; i++ {
		points := parse(s)
		pathLength := shortestPath(points)
		fmt.Println(pathLength)
	}
}

package main

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

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

	for test := parseInt(getString(reader)); test > 0; test-- {
		getString(reader)
		A := getIntln(reader)
		B := getIntln(reader)
		F := getIntln(reader)
		var res int

		if A[0] == B[0] && A[0] == F[0] && isBetween(A[1], F[1], B[1]) {
			res = 2
		} else if A[1] == B[1] && A[1] == F[1] && isBetween(A[0], F[0], B[0]) {
			res = 2
		}
		res += mod(A[1]-B[1]) + mod(A[0]-B[0])
		writer.WriteString(fmt.Sprintln(res))
	}
	writer.Flush()
}

func isBetween(a, b, c int) bool {
	if b >= a && b <= c {
		return true
	}
	if b >= c && b <= a {
		return true
	}
	return false
}

func mod(a int) int {
	if a < 0 {
		return -1 * a
	} else {
		return a
	}
}

func getString(in *bufio.Reader) string {
	res, _ := in.ReadString('\n')
	res = strings.ReplaceAll(res, "\n", "")
	res = strings.ReplaceAll(res, "\r", "")
	res = strings.TrimSpace(res)
	return res
}

func parseInt(str string) int {
	var res int
	size := len(str)
	for i := 0; i < size; i++ {
		digit := int(str[i] - '0')
		for j := (i + 1); j < size; j++ {
			digit = digit<<3 + digit<<1
		}
		res += digit
	}
	return res
}

func getIntln(in *bufio.Reader) []int {
	b := strings.Split(getString(in), " ")
	res := make([]int, len(b))
	for k, v := range b {
		res[k] = parseInt(v)
	}
	return res
}

package main

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

func abs(n int) int {
	if n < 0 {
		return n * -1
	}
	return n
}

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

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

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

	var T int
	fmt.Fscan(in, &T)
	for t := 0; t < T; t++ {
		var ax, ay, bx, by, fx, fy int
		fmt.Fscan(in, &ax, &ay, &bx, &by, &fx, &fy)

		tot := abs(ax-bx) + abs(ay-by)
		if ax == bx && ax == fx && fy > min(ay, by) && fy < max(ay, by) {
			tot += 2
		}

		if ay == by && ay == fy && fx > min(ax, bx) && fx < max(ax, bx) {
			tot += 2
		}
		fmt.Fprintln(out, tot)
	}
}

package main

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

var (
	reader = bufio.NewReader(os.Stdin)
	t      int
	x, y   [3]int
)

func abs(n int) int {
	if n < 0 {
		n = -n
	}
	return n
}

func solve(x, y [3]int) int {
	var d int
	if x[0] == x[1] {
		d = abs(y[0] - y[1])
		if x[2] == x[0] && (y[2]-y[0])*(y[2]-y[1]) < 0 {
			d += 2
		}
		return d
	}
	if y[0] == y[1] {
		d = abs(x[0] - x[1])
		if y[2] == y[0] && (x[2]-x[0])*(x[2]-x[1]) < 0 {
			d += 2
		}
		return d
	}
	return abs(x[0]-x[1]) + abs(y[0]-y[1])
}

func main() {
	fmt.Fscan(reader, &t)
	for ; t > 0; t-- {
		for i := 0; i < 3; i++ {
			fmt.Fscan(reader, &x[i], &y[i])
		}
		fmt.Println(solve(x, y))
	}
}

package main

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

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

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

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

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

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

/**
Run solve the problem CF1547A
Date: 11/10/21
User: epradere
URL: https://codeforces.com/problemset/problem/1547/A
Problem: CF1547A
**/
func (in *CF1547A) Run() {
	t := in.NextInt()
	for ; t > 0; t-- {
		in.NextString()
		ax, ay := in.NextInt(), in.NextInt()
		bx, by := in.NextInt(), in.NextInt()
		fx, fy := in.NextInt(), in.NextInt()
		sol := 0
		if ax == bx {
			min := Min(ay, by)
			max := Max(ay, by)
			sol = max - min
			if ax == fx && min <= fy && fy <= max {
				sol += 2
			}
		} else if ay == by {
			min := Min(ax, bx)
			max := Max(ax, bx)
			sol = max - min
			if ay == fy && min <= fx && fx <= max {
				sol += 2
			}
		} else {
			sol = int(math.Abs(float64(ax-bx))) + int(math.Abs(float64(ay-by)))
		}
		fmt.Println(sol)
	}
}

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

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

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

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

package main

import (
	"fmt"
)

func main() {
	var (
		xa, ya, xb, yb, xf, yf, t int
	)
	fmt.Scan(&t)
	for i:=0;i<t;i++ {
		fmt.Scan(&xa, &ya, &xb, &yb, &xf, &yf)
		if aligned(xa, xb, xf, ya, yb, yf) || aligned(ya, yb, yf, xa, xb, xf) {
			fmt.Println(abs(xa-xb) + abs(ya-yb)+2)
		} else {
			fmt.Println(abs(xa-xb) + abs(ya-yb))
		}
	}
}

func abs(n int) int {
	if n < 0 { return -n }
	return n
}

func aligned(x1, x2, x3, x4, x5, x6 int) bool {
	return equal(x1, x2, x3) && between(x4, x5, x6)
}

func equal(x1, x2, x3 int) bool {
	return x1 == x2 && x1 == x3
}

func between(x1, x2, x3 int) bool {
	return (x1 < x3) == (x3 < x2)
}

package main

import (
	"fmt"
)

type Point struct {
	x,y int
}

var t, ans int
var A, B, F Point

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func swap(a, b *int) {
	tmp := *a
	*a = *b
	*b = tmp
}

func in(a, b, c int ) bool {
	if a > b { swap(&a,&b) }
	if a <= c && c <= b { return true }
	return false
}

func isFailWay(A, B, C Point) bool {
	if A.x == B.x && B.x == C.x && in(A.y,B.y,C.y) { return true }
	if A.y == B.y && B.y == C.y && in(A.x,B.x,C.x) { return true }
	return false
}

func main() {
	fmt.Scan(&t)

	for i := 0; i < t; i++ {
		fmt.Scanln()

		fmt.Scan(&A.x, &A.y)
		fmt.Scan(&B.x, &B.y)
		fmt.Scan(&F.x, &F.y)

		ans = abs(A.x-B.x)+abs(A.y-B.y)

		if isFailWay(A,B,F) { ans+=2 }

		fmt.Println(ans)
	}

}

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

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

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

func PrimeFactorization(n int) (pfs map[int]int) {
	pfs = make(map[int]int)

	// Get the number of 2s that divide n
	for n%2 == 0 {
		if _, ok := pfs[2]; ok {
			pfs[2] += 1
		} else {
			pfs[2] = 1
		}
		n = n / 2
	}

	// n must be odd at this point. so we can skip one element
	// (note i = i + 2)
	for i := 3; i*i <= n; i = i + 2 {
		// while i divides n, append i and divide n
		for n%i == 0 {
			if _, ok := pfs[i]; ok {
				pfs[i] += 1
			} else {
				pfs[i] = 1
			}
			n = n / i
		}
	}

	// This condition is to handle the case when n is a prime number
	// greater than 2
	if n > 2 {
		pfs[n] = 1
	}

	return
}

func NumberOfDivisors(n int) int {
	pfs := PrimeFactorization(n)

	num := 1
	for _, exponents := range pfs {
		num *= (exponents + 1)
	}

	return num
}

func KthPrime(x int) (y int) {
	if x == 1 {
		y = 2
	}
	if x == 2 {
		y = 3
	}
	if x > 2 {
		var sum int = 2
		begin := 5
		for sum < x+1 {
			if IsItPrime(begin) == true {
				sum++
			}
			if sum == x {
				y = begin
				break
			} else {
				if begin%6 == 1 {
					begin = begin + 4
				} else {
					begin = begin + 2
				}
			}
		}
	}
	return
}

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

var t int

func main() {
	var input io.Reader = bufio.NewReader(os.Stdin)
	fmt.Fscan(input, &t)

	for o := 0; o < t; o++ {
		var XA, YA, XB, YB, XF, YF int

		fmt.Fscan(input, &XA, &YA, &XB, &YB, &XF, &YF)

		if (XA-XB)*(YB-YA) != 0 {
			fmt.Println(MODULE(XA, XB) + MODULE(YA, YB))
		} else {
			if XA == XB && YA == YB {
				fmt.Println(0)
			} else {
				if XA == XB {
					if XF == XA && MODULE(YF, YB)+MODULE(YF, YA) == MODULE(YA, YB) {
						fmt.Println(MODULE(YA, YB) + 2)
					} else {
						fmt.Println(MODULE(YA, YB))
					}
				} else {
					if YF == YA && MODULE(XF, XB)+MODULE(XF, XA) == MODULE(XA, XB) {
						fmt.Println(MODULE(XA, XB) + 2)
					} else {
						fmt.Println(MODULE(XA, XB))
					}
				}
			}
		}

	}

}

package main

import (
	"fmt"
	"math"
)

type Point struct {
	x, y int
}

func main() {
	T := 0
	fmt.Scanf("%d\n", &T)
	for ; T > 0; T-- {
		var a, b, f Point
		fmt.Scanf("\n%d%d\n", &a.x, &a.y)
		fmt.Scanf("%d%d\n", &b.x, &b.y)
		fmt.Scanf("%d%d\n", &f.x, &f.y)

		ans := 0
		if a.x == b.x {
			ans = int(math.Abs(float64(a.y - b.y)))
			if a.y > b.y {
				a.y, b.y = b.y, a.y
			}
			if f.x == a.x && f.y > a.y && f.y < b.y {
				ans += 2
			}
		} else if a.y == b.y {
			ans = int(math.Abs(float64(a.x-b.x))) + 2
			if a.x > b.x {
				a.x, b.x = b.x, a.x
			}
			if f.y == a.y && f.x > a.x && f.x < b.x {
				ans += 2
			}
		} else {
			ans = int(math.Abs(float64(a.x-b.x))) + int(math.Abs(float64(a.y-b.y)))
		}

		fmt.Println(ans)
	}
}

package main

import (
	"fmt"
	"math"
)

type Point struct {
	x, y int
}

func main() {
	T := 0
	fmt.Scanf("%d", &T)
	for ; T > 0; T-- {
		var a, b, f Point
		fmt.Scanf("%d%d", &a.x, &a.y)
		fmt.Scanf("%d%d", &b.x, &b.y)
		fmt.Scanf("%d%d", &f.x, &f.y)

		ans := 0
		if a.x == b.x {
			ans = int(math.Abs(float64(a.y - b.y)))
			if f.x == a.x {
				ans += 2
			}
		} else if a.y == b.y {
			ans = int(math.Abs(float64(a.x-b.x))) + 2
			if f.y == a.y {
				ans += 2
			}
		} else {
			ans = int(math.Abs(float64(a.x-b.x))) + int(math.Abs(float64(a.y-b.y)))
		}

		fmt.Println(ans)
	}
}

package main

import (
	"fmt"
	"math"
)

type Point struct {
	x, y int
}

func main() {
	T := 0
	fmt.Scanf("%d", &T)
	for ; T > 0; T-- {
		var a, b, f Point
		fmt.Scanf("%d%d", &a.x, &a.y)
		fmt.Scanf("%d%d", &b.x, &b.y)
		fmt.Scanf("%d%d", &f.x, &f.y)

		ans := 0
		if a.x == b.x {
			ans = int(math.Abs(float64(a.y-b.y))) + 2
		} else if a.y == b.y {
			ans = int(math.Abs(float64(a.x-b.x))) + 2
		} else {
			ans = int(math.Abs(float64(a.x-b.x))) + int(math.Abs(float64(a.y-b.y)))
		}

		fmt.Println(ans)
	}
}

package main
import(
    "fmt"
)
func main() {
	var t int
	fmt.Scan(&t)
	for i:=0;i<t;i++{
		var ax,ay int
		fmt.Scan(&ax,&ay)
		var bx,by int
		fmt.Scan(&bx,&by)
		var cx,cy int
		fmt.Scan(&cx,&cy)
		if ax == bx {
			if cy > min(ay,by) && cy < max(ay,by) {
				fmt.Println(abs(ay-by)+2)
				continue
			}
		} else if ay == by {
			if cx > min(ax,bx) && cx < max(ax,bx) {
				fmt.Println(abs(ax-bx)+2)
				continue
			}
		}
		fmt.Println(abs(ax-bx)+abs(ay-by))
	}
}
func abs(x int) int {
	var result int
	if x > 0 {
		result = x
	} else {
		if x < 0 {
			result = x*-1
		}
	}
	return result
}
func min (x,y int) int {
	if x>y{
		return y
	} else {
		return x
	}
}
func max (x,y int) int {
	if x>y{
		return x
	} else {
		return y
	}
}

package main
import(
    "fmt"
)
func main() {
	var t int
	fmt.Scan(&t)
	for i:=0;i<t;i++{
		var ax,ay int
		fmt.Scan(&ax,&ay)
		var bx,by int
		fmt.Scan(&bx,&by)
		var cx,cy int
		fmt.Scan(&cx,&cy)
		if ax == bx {
			if cy > min(ay,by) && cy < max(ay,by) {
				fmt.Println(abs(ay-by)+2)
				break
			}
		} else if ay == by {
			if cx > min(ax,bx) && cx < max(ax,bx) {
				fmt.Println(abs(ax-bx)+2)
				break
			}
		}
		fmt.Println(abs(ax-bx)+abs(ay-by))
	}
}
func abs(x int) int {
	var result int
	if x > 0 {
		result = x
	} else {
		if x < 0 {
			result = x*-1
		}
	}
	return result
}
func min (x,y int) int {
	if x>y{
		return y
	} else {
		return x
	}
}
func max (x,y int) int {
	if x>y{
		return x
	} else {
		return y
	}
}

package main
import(
    "fmt"
)
func main() {
	var t int
	fmt.Scan(&t)
	for i:=0;i<t;i++{
		var ax,ay int
		fmt.Scan(&ax,&ay)
		var bx,by int
		fmt.Scan(&bx,&by)
		var cx,cy int
		fmt.Scan(&cx,&cy)
		if (cx > min(ax,bx) && cx < max(ax,bx)) || (cy > min(ay,by) && cy < max(ay,by)) {
			if abs(bx-ax) > 0 {
				fmt.Println(abs(bx-ax)+2)
			} else {
				fmt.Println(abs(by-ay)+2)
			}
		} else {
			if abs(bx-ax) > 0 {
				if abs(by-ay) > 0 {
					fmt.Println(abs(bx-ax)+1)
				} else {
					fmt.Println(abs(bx-ax))
				}
			} else {
				if abs(bx-ax) > 0 {
					fmt.Println(abs(by-ay)+1)
				} else {
					fmt.Println(abs(by-ay))
				}
			}
		}
	}
}
func abs(x int) int {
	var result int
	if x > 0 {
		result = x
	} else {
		if x < 0 {
			result = x*-1
		}
	}
	return result
}
func min (x,y int) int {
	if x>y{
		return y
	} else {
		return x
	}
}
func max (x,y int) int {
	if x>y{
		return x
	} else {
		return y
	}
}

package main
import(
    "fmt"
)
func main() {
	var t int
	fmt.Scan(&t)
	for i:=0;i<t;i++{
		var ax,ay int
		fmt.Scan(&ax,&ay)
		var bx,by int
		fmt.Scan(&bx,&by)
		var cx,cy int
		fmt.Scan(&cx,&cy)
		if (cx > min(ax,bx) && cx < max(ax,bx)) || (cy > min(ay,by) && cy < max(ay,by)) {
			if abs(bx-ax) > 0 {
				fmt.Println(abs(bx-ax)+2)
			} else {
				fmt.Println(abs(by-ay)+2)
			}
		} else {
			if abs(bx-ax) > 0 {
				fmt.Println(abs(bx-ax))
			} else {
				fmt.Println(abs(by-ay))
			}
		}
	}
}
func abs(x int) int {
	var result int
	if x > 0 {
		result = x
	} else {
		if x < 0 {
			result = x*-1
		}
	}
	return result
}
func min (x,y int) int {
	if x>y{
		return y
	} else {
		return x
	}
}
func max (x,y int) int {
	if x>y{
		return x
	} else {
		return y
	}
}

package main

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

type pair struct{
	x,y int
}

func judge(a,b,f int) bool {
	if((f>a&&f<b)||(f>b&&f<a) ) {
		return true
	}
	return false
}

func main() {
	var T int;
	fmt.Scanln(&T)
	for i:=0;i<T;i++ {
		var a,b,f pair
		fmt.Fscan(os.Stdin,&a.x,&a.y,&b.x,&b.y,&f.x,&f.y)

		if (a.x==b.x&&a.x==f.x&&judge(a.x,b.x,f.x))||(a.y==b.y&&a.y==f.y&&judge(a.y,b.y,f.y)) {
			fmt.Println(int(math.Abs(float64(a.x)-float64(b.x))+math.Abs(float64(a.y)-float64(b.y))+2))

		}else {
			fmt.Println(int(math.Abs(float64(a.x)-float64(b.x))+math.Abs(float64(a.y)-float64(b.y))))
		}
	}
}

package main

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

type pair struct{
	x,y int
}

func main() {
	var T int;
	fmt.Scanln(&T)
	for i:=0;i<T;i++ {
		var a,b,f pair
		fmt.Fscan(os.Stdin,&a.x,&a.y,&b.x,&b.y,&f.x,&f.y)

		if a.x==b.x || a.y == b.y {
			fmt.Println(int(math.Abs(float64(a.x)-float64(b.x))+math.Abs(float64(a.y)-float64(b.y))+2))

		}else {
			fmt.Println(int(math.Abs(float64(a.x)-float64(b.x))+math.Abs(float64(a.y)-float64(b.y))))
		}
	}
}

package main

import (
	"fmt"
	"math"
)

func main() {
	var t int64
	_, err := fmt.Scanf("%d\n",&t)
	if err != nil {
		return
	}
	for i := int64(0); i < t; i++ {
		var Ax int64
		var Ay int64
		var Bx int64
		var By int64
		var Fx int64
		var Fy int64
		_, err := fmt.Scanf("\n%d %d\n", &Ax, &Ay)
		if err != nil {
			return
		}
		_, err = fmt.Scanf("%d %d\n", &Bx, &By)
		if err != nil {
			return
		}
		_, err = fmt.Scanf("%d %d\n", &Fx, &Fy)
		if err != nil {
			return
		}
		pathLen := math.Abs(float64(Ax-Bx)) + math.Abs(float64(Ay-By))
		if (Ax == Bx && Ax == Fx) || (Ay == By && Ay == Fy) {
			pathLen += 2
			fmt.Println(int64(pathLen))
		} else {
			fmt.Println(int64(pathLen))
		}
	}
}

package main

import (
	"fmt"
	"math"
)

func main() {
	var t int64
	_, err := fmt.Scan(&t)
	if err != nil {
		return
	}
	for i := int64(0); i < t; i++ {
		var Ax int64
		var Ay int64
		var Bx int64
		var By int64
		var Fx int64
		var Fy int64
		_, err := fmt.Scanf("\n%d %d\n", &Ax, &Ay)
		if err != nil {
			return
		}
		_, err = fmt.Scanf("%d %d\n", &Bx, &By)
		if err != nil {
			return
		}
		_, err = fmt.Scanf("%d %d\n", &Fx, &Fy)
		if err != nil {
			return
		}
		pathLen := math.Abs(float64(Ax-Bx)) + math.Abs(float64(Ay-By))
		if (Ax == Bx && Ax == Fx) || (Ay == By && Ay == Fy) {
			pathLen += 2
			fmt.Println(int64(pathLen))
		} else {
			fmt.Println(int64(pathLen))
		}
	}
}

package main

import "fmt"

func abs(num int) int {
	if num < 0 {
		return -num
	}
	return num
}

func algo(testcases [][3][2]int) {
	for _, test_case := range testcases {
		row_diff := abs(test_case[0][0] - test_case[1][0])
		col_diff := abs(test_case[0][1] - test_case[1][1])
		ans := row_diff + col_diff

		if row_diff == 0 {
			a := test_case[0][1] - test_case[2][1]
			b := test_case[1][1] - test_case[2][1]
			if a^b < 0 {
				ans += 2
			}
		} else if col_diff == 0 {
			a := test_case[0][0] - test_case[2][0]
			b := test_case[1][0] - test_case[2][0]
			if a^b < 0 {
				ans += 2
			}
		}
		fmt.Println(ans)
	}
}

func input() [][3][2]int {
	num_case := 0
	fmt.Scanln(&num_case)
	testcases := make([][3][2]int, num_case)

	for i := 0; i < num_case; i++ {
		fmt.Scanf("\n")
		for j := 0; j < 3; j++ {
			fmt.Scanf("%d %d\n", &testcases[i][j][0], &testcases[i][j][1])
		}
	}

	return testcases
}

func main() {
	testcases := input()
	algo(testcases)
}

package main

import "fmt"

func abs(num int) int {
	if num < 0 {
		return -num
	}
	return num
}

func algo(testcases [][3][2]int) {
	for _, test_case := range testcases {
		row_diff := abs(test_case[0][0] - test_case[1][0])
		col_diff := abs(test_case[0][1] - test_case[1][1])
		ans := row_diff + col_diff

		if row_diff == 0 {
			a := test_case[0][1] - test_case[2][1]
			b := test_case[1][1] - test_case[2][1]
			if a^b < 0 {
				ans += 2
			}
		} else if col_diff == 0 {
			a := test_case[0][0] - test_case[2][0]
			b := test_case[1][0] - test_case[2][0]
			if a^b < 0 {
				ans += 2
			}
		}
		fmt.Println(ans)
	}
}

func input() [][3][2]int {
	num_case := 0
	fmt.Scan(&num_case)
	testcases := make([][3][2]int, num_case)

	for i := 0; i < num_case; i++ {
		fmt.Scanf("\n")
		for j := 0; j < 3; j++ {
			fmt.Scanf("%d %d\n", &testcases[i][j][0], &testcases[i][j][1])
		}
	}

	return testcases
}

func main() {
	testcases := input()
	algo(testcases)
}

package main

import (
	"fmt"
)

func AbsInt(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

func solve() {
	a := make([]int, 6)
	for i := 0; i < 6; i += 2 {
		fmt.Scanf("%d %d\n", &a[i], &a[i+1])
	}

	ans := AbsInt(a[2]-a[0]) + AbsInt(a[3]-a[1])
	if a[0] == a[2] && a[2] == a[4] && (a[1]-a[5])*(a[3]-a[5]) < 0 {
		ans += 2
	} else if a[1] == a[3] && a[3] == a[5] && (a[0]-a[4])*(a[2]-a[4]) < 0 {
		ans += 2
	}
	fmt.Println(ans)
}

func main() {
	var testcase int
	fmt.Scanf("%d\n", &testcase)
	for i := 1; i <= testcase; i++ {
		//fmt.Scanf("\n")
		solve()
	}
}

package main

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

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

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

func ABS(x int64) int64{
	if x >= 0{
		return x
	}else{
		return (-1) * x
	}
}

var p int

func main() {
	var input io.Reader = bufio.NewReader(os.Stdin)
	fmt.Fscan(input, &p)
	for o := 0; o < p; o++ {
		var xa, xb, xf, ya, yb, yf int64
		fmt.Fscan(input, &xa)
		fmt.Fscan(input, &ya)
		fmt.Fscan(input, &xb)
		fmt.Fscan(input, &yb)
		fmt.Fscan(input, &xf)
		fmt.Fscan(input, &yf)

		var ans int64

		dis := ABS(xa - xb) + ABS(ya - yb)

		if xa == xb && xb == xf{
			if MIN(ya,yb) < yf && yf < MAX(ya,yb){
				ans = dis + 2
			}else{
				ans = dis
			}
		}else if ya == yb && yb == yf{
			if MIN(xa,xb) < xf  && xf < MAX(ya,yb){
				ans = dis + 2
			}else{
				ans = dis
			}
		}else{
			ans = dis
		}

		fmt.Println(ans)
	}
}

package main

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

func shortestPath(p []Point) int {
	path := 0
	dx := abs(p[0].x - p[1].x)
	dy := abs(p[0].y - p[1].y)
	path = dx + dy
	if (p[0].x == p[2].x && p[1].x == p[2].x && !(p[2].x > p[0].x && p[2].x > p[1].x)) ||
		(p[0].y == p[2].y && p[1].y == p[2].y && !(p[2].y > p[0].y && p[2].y > p[1].y)) {
		path += 2
	}
	return path
}

type Point struct {
	x, y int
}

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}
func parse(s *bufio.Scanner) []Point {
	points := make([]Point, 3)
	s.Scan()
	var x, y int
	for i := 0; i < 3; i++ {
		s.Scan()
		fmt.Sscan(s.Text(), &x, &y)
		points[i] = Point{x, y}
	}

	return points
}

func main() {
	s := bufio.NewScanner(os.Stdin)
	s.Scan()
	t, _ := strconv.Atoi(s.Text())
	for i := 0; i < t; i++ {
		points := parse(s)
		pathLength := shortestPath(points)
		fmt.Println(pathLength)
	}
}


package main

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

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

	n, k := readTwoNums(reader)

	H := readNNums(reader, n)

	a, b := solve(n, k, H)
	var buf bytes.Buffer

	buf.WriteString(fmt.Sprintf("%d %d\n", a, len(b)))

	for i := 0; i < len(b); i++ {
		buf.WriteString(fmt.Sprintf("%d %d\n", b[i][0], b[i][1]))
	}

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

const N_INF = -(10000000)

func solve(n, k int, H []int) (a int, b [][]int) {
	get := func(l, r int, arr []int) int {
		res := N_INF

		l += n
		r += n

		for l < r {
			if l&1 == 1 {
				res = max(res, arr[l])
				l++
			}
			if r&1 == 1 {
				r--
				res = max(res, arr[r])
			}
			l >>= 1
			r >>= 1
		}
		return res
	}

	x := make([]int, 2*n)
	y := make([]int, 2*n)

	for i := n; i < 2*n; i++ {
		x[i] = H[i-n]
		y[i] = -H[i-n]
	}

	for i := n - 1; i > 0; i-- {
		x[i] = max(x[2*i], x[2*i+1])
		y[i] = max(y[2*i], y[2*i+1])
	}

	getDiff := func(i, j int) int {
		xx := get(i, j, x)
		yy := -get(i, j, y)
		return xx - yy
	}

	for i, j := 0, 1; j <= n; j++ {
		for i < j && getDiff(i, j) > k {
			i++
		}
		if j-i > a {
			a = j - i
		}
	}

	for i := 0; i+a <= n; i++ {
		d := getDiff(i, i+a)
		if d <= k {
			b = append(b, []int{i + 1, i + a})
		}
	}
	return
}

func solve1(n, k int, H []int) (a int, b [][]int) {
	get := func(l, r int, arr []int) int {
		res := N_INF

		l += n
		r += n

		for l < r {
			if l&1 == 1 {
				res = max(res, arr[l])
				l++
			}
			if r&1 == 1 {
				r--
				res = max(res, arr[r])
			}
			l >>= 1
			r >>= 1
		}
		return res
	}

	x := make([]int, 2*n)
	y := make([]int, 2*n)

	for i := n; i < 2*n; i++ {
		x[i] = H[i-n]
		y[i] = -H[i-n]
	}

	for i := n - 1; i > 0; i-- {
		x[i] = max(x[2*i], x[2*i+1])
		y[i] = max(y[2*i], y[2*i+1])
	}

	getDiff := func(i, j int) int {
		xx := get(i, j, x)
		yy := -get(i, j, y)
		return xx - yy
	}

	check := func(l int) bool {
		for i := 0; i+l <= n; i++ {
			d := getDiff(i, i+l)
			if d <= k {
				return true
			}
		}
		return false
	}

	var left, right = 0, n + 1

	for left < right {
		mid := (left + right) / 2
		if !check(mid) {
			right = mid
		} else {
			left = mid + 1
		}
	}
	a = right - 1

	for i := 0; i+a <= n; i++ {
		d := getDiff(i, i+a)
		if d <= k {
			b = append(b, []int{i + 1, i + a})
		}
	}
	return
}

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

package main

import (
	"bytes"
	"fmt"
	"io/ioutil"
	"os"
)

type Node struct {
	max int
	min int
}

var n int
var h [100000]int

func create(tree []*Node, l int, r int, index int) {
	if l == r {
		tree[index] = &Node{h[l], h[r]}
		return
	}
	mid := (l + r) / 2
	create(tree, l, mid, index*2+1)
	create(tree, mid+1, r, index*2+2)
	max, min := tree[index*2+1].max, tree[index*2+1].min
	if max < tree[index*2+2].max {
		max = tree[index*2+2].max
	}
	if min > tree[index*2+2].min {
		min = tree[index*2+2].min
	}
	tree[index] = &Node{max, min}
}

func query(tree []*Node, l int, r int, index int, lIndex int, rIndex int) (int, int) {
	if l == lIndex && r == rIndex {
		return tree[index].max, tree[index].min
	}
	mid := (l + r) / 2
	if rIndex <= mid {
		return query(tree, l, mid, index*2+1, lIndex, rIndex)
	}
	if lIndex >= mid+1 {
		return query(tree, mid+1, r, index*2+2, lIndex, rIndex)
	}
	max, min := query(tree, l, mid, index*2+1, lIndex, mid)
	max1, min1 := query(tree, mid+1, r, index*2+2, mid+1, rIndex)
	if max < max1 {
		max = max1
	}
	if min > min1 {
		min = min1
	}
	return max, min
}

func main() {
	bs, _ := ioutil.ReadAll(os.Stdin)
	reader := bytes.NewBuffer(bs)
	var n, k int

	fmt.Fscanf(reader, "%d %d\n", &n, &k)
	for i := 0; i < n; i++ {
		fmt.Fscanf(reader, "%d ", &h[i])
	}
	tree := make([]*Node, 1000000)
	create(tree, 0, n-1, 0)

	lp, rp := 0, 0
	best := 0
	var solu []*Node = make([]*Node, 100000, 100000)
	var sLen int
	var max, min int
	for rp != n {
		for {
			max, min = query(tree, 0, n-1, 0, lp, rp)
			if max-min > k {
				lp++
			} else {
				break
			}
		}
		for {
			if best == rp-lp+1 {
				solu[sLen] = &Node{rp, lp}
				sLen++
				rp++
			} else if best < rp-lp+1 {
				best = rp - lp + 1
				solu[0] = &Node{rp, lp}
				sLen = 1
				rp++
			} else {
				rp++
			}
			if rp != n {
				if max < h[rp] {
					max = h[rp]
				}
				if min > h[rp] {
					min = h[rp]
				}
				if max-min > k {
					break
				}
			} else {
				break
			}
		}
		if rp == n {
			break
		}
	}

	writer := bytes.NewBuffer(make([]byte, 0, 12000000))

	fmt.Fprintf(writer, "%d %d\n", best, sLen)
	for i := 0; i < sLen; i++ {
		fmt.Fprintf(writer, "%d %d\n", solu[i].min+1, solu[i].max+1)
	}
	writer.WriteTo(os.Stdout)

}

package main

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

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

	n, k := readTwoNums(reader)

	H := readNNums(reader, n)

	a, b := solve(n, k, H)
	var buf bytes.Buffer

	buf.WriteString(fmt.Sprintf("%d %d\n", a, len(b)))

	for i := 0; i < len(b); i++ {
		buf.WriteString(fmt.Sprintf("%d %d\n", b[i][0], b[i][1]))
	}

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

const N_INF = -(10000000)

func solve(n, k int, H []int) (a int, b [][]int) {
	get := func(l, r int, arr []int) int {
		res := N_INF

		l += n
		r += n

		for l < r {
			if l&1 == 1 {
				res = max(res, arr[l])
				l++
			}
			if r&1 == 1 {
				r--
				res = max(res, arr[r])
			}
			l >>= 1
			r >>= 1
		}
		return res
	}

	x := make([]int, 2*n)
	y := make([]int, 2*n)

	for i := n; i < 2*n; i++ {
		x[i] = H[i-n]
		y[i] = -H[i-n]
	}

	for i := n - 1; i > 0; i-- {
		x[i] = max(x[2*i], x[2*i+1])
		y[i] = max(y[2*i], y[2*i+1])
	}

	getDiff := func(i, j int) int {
		xx := get(i, j, x)
		yy := -get(i, j, y)
		return xx - yy
	}

	check := func(l int) bool {
		for i := 0; i+l <= n; i++ {
			d := getDiff(i, i+l)
			if d <= k {
				return true
			}
		}
		return false
	}

	var left, right = 0, n + 1

	for left < right {
		mid := (left + right) / 2
		if !check(mid) {
			right = mid
		} else {
			left = mid + 1
		}
	}
	a = right - 1

	for i := 0; i+a <= n; i++ {
		d := getDiff(i, i+a)
		if d <= k {
			b = append(b, []int{i + 1, i + a})
		}
	}
	return
}

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


package main

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

const MOD int64 = 1000000007

const INF = 1e9 + 300

var n int

var a[]int

// ByAge implements sort.Interface based on the Age field.
type ByV []*pair

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

func main() {

	read := bufio.NewReader(os.Stdin)

	var t int
	fmt.Fscan(read, &t)

	for i := 0; i < t; i++ {

		fmt.Fscan(read, &n)

		a = make([]int,  n)

		for j := 0; j < n; j++ {
			fmt.Fscan(read, &a[j])
		}

		fmt.Println(solve())
	}
}

type pair struct {
	v int
	idx []int
}

func solve() int {

	dp := make([]int, n + 1)
	for i := 0; i <= n; i++ {
		dp[i] = -1
	}

	mp := make(map[int]int)

	mp[0] = -1
	pref := 0

	for i := 0; i < n; i++ {
		pref = pref ^ a[i]

		if v, ok := mp[pref]; ok {
			dp[v + 1] = i
		}
		mp[pref] = i
	}

	dp2 := make([]int, n + 1)
	for i := 0; i <= n; i++ {
		dp2[i] = INF
	}

	dp2[0] = 1

	if dp[0] != -1 {

		v := dp[0]
		dp2[v] = v
	}

	for i := 1; i < n; i++ {
		dp2[i] = min(dp2[i], dp2[i - 1] + 1)

		if dp[i] != -1 {

			v := dp[i]

			dp2[v] = min(dp2[v], dp2[i - 1] + (v - i))
		}

	}

	return dp2[n - 1]
}

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

	return b
}

//1 2 4 4 3

//0 - 1
//3 - 1

//IQ = 87

//........105....99...87..87..87..87.87.......87....

//            86

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

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 int
		fmt.Fscan(r, &n)
		a := make([]int, n)
		for i := range a {
			fmt.Fscan(r, &a[i])
		}
		w1 := do(n, a)
		fmt.Fprintln(w, w1)
	}
}

func do(n int, a []int) int {
	m := make(map[int]bool)
	s := 0
	d := 0
	for i := range a {
		m[s] = true
		s ^= a[i]
		if m[s] {
			d++
			s = 0
			m = make(map[int]bool)
		}
	}
	return n - d
}


package main

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

var out *bufio.Writer
var in *bufio.Reader

func nextInt() (res int) {
	for {
		res = 0
		_, err := fmt.Fscanf(in, "%v", &res)
		if err == nil {
			return
		}
		if err.Error() == "EOF" {
			return
		}
		// fmt.Printf("read err: %v\n", err)
	}
	return
}

func solve(idx int) {
	n := nextInt()
	a := make([]int, n)
	// fmt.Printf("n: %v\n", n)
	for i := 0; i < n; i++ {
		a[i] = nextInt()
	}
	if n < 3 {
		fmt.Println(-1)
		return
	}
	if a[0]+a[1] <= a[n-1] {
		fmt.Printf("%d %d %d\n", 1, 2, n)
	} else {
		fmt.Println(-1)
	}
}

func main() {
	out = bufio.NewWriterSize(os.Stdout, 8192)
	in = bufio.NewReaderSize(os.Stdin, 8192)
	defer out.Flush()
	idx := 0
	for t := nextInt(); t > 0; t-- {
		solve(idx)
		idx++
	}
}

package main

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

type Anode struct {
	idx int
	ans string
}

type Anodes []Anode

func (this Anodes) Len() int {
	return len(this)
}

func (this Anodes) Less(i, j int) bool {
	return this[i].idx < this[j].idx
}

func (this Anodes) Swap(i, j int) {
	this[i], this[j] = this[j], this[i]
}

var (
	wg   sync.WaitGroup
	out  *bufio.Writer
	in   *bufio.Reader
	ans  Anodes
	lock sync.Mutex
)

func appendAns(n Anode) {
	lock.Lock()
	defer lock.Unlock()
	ans = append(ans, n)
}

func nextInt() (res int) {
	for {
		res = 0
		_, err := fmt.Fscanf(in, "%v", &res)
		if err == nil {
			return
		}
		if err.Error() == "EOF" {
			return
		}
		// fmt.Printf("read err: %v\n", err)
	}
	return
}

func solve(idx int) {
	defer wg.Done()
	n := nextInt()
	a := make([]int, n)
	// fmt.Printf("n: %v\n", n)
	for i := 0; i < n; i++ {
		a[i] = nextInt()
	}
	if n < 3 {
		// fmt.Println(-1)
		appendAns(Anode{idx, "-1"})
		return
	}
	if a[0]+a[1] <= a[n-1] {
		appendAns(Anode{idx, fmt.Sprintf("%d %d %d", 1, 2, n)})
		// fmt.Printf("%d %d %d\n", 1, 2, n)
	} else {
		// fmt.Println(-1)
		appendAns(Anode{idx, "-1"})
	}
}

func main() {
	out = bufio.NewWriterSize(os.Stdout, 8192)
	in = bufio.NewReaderSize(os.Stdin, 8192)
	defer out.Flush()
	t := nextInt()
	wg.Add(t)
	idx := 0
	for ; t > 0; t-- {
		go solve(idx)
		idx++
	}
	wg.Wait()
	for _, a := range ans {
		fmt.Println(a.ans)
	}
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	var t int
	fmt.Fscan(in, &t)
	for i := 0; i < t; i++ {
		var n int
		var a1, a2, a3 int
		fmt.Fscan(in, &n)
		found := false
		for j := 0; j < n; j++ {
			fmt.Fscan(in, &a3)
			if j == 0 {
				a1 = a3
				continue
			} else if j == 1 {
				a2 = a3
				continue
			} else if found {
				continue
			}

			if a1+a2 <= a3 {
				found = true
				fmt.Println(1, 2, j+1)
			}
		}
		if !found {
			fmt.Println(-1)
		}
	}
}

package main

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

type kv struct {
	Key   int
	Value int
}

func main() {
	//rd, _ := os.Open("input")
	io := bufio.NewReader(os.Stdin)

	var t, n int
	var a []kv

	fmt.Fscan(io, &t)
	for ; t > 0; t-- {
		fmt.Fscan(io, &n)
		a = make([]kv, n)
		for i, elem := 0, 0; i < n; i++ {
			fmt.Fscan(io, &elem)
			a[i] = kv{Key: i + 1, Value: elem}
		}

		sort.Slice(a, func(i, j int) bool {
			return a[i].Value < a[j].Value
		})

		if a[0].Value+a[1].Value <= a[n-1].Value {
			fmt.Println(a[0].Key, a[1].Key, a[n-1].Key)
		} else {
			fmt.Println(-1)
		}
	}
}

package main

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

var in *bufio.Reader
var out *bufio.Writer

func printf(x string, a ...interface{}) (n int, err error) {
	return fmt.Fprintf(out, x, a...)
}

func scanf(x string, a ...interface{}) (n int, err error) {
	return fmt.Fscanf(in, x, a...)
}

var err error

func next() (n string) {
	for {
		_, err = scanf("%v", &n)
		if err == nil {
			return n
		}
		if err.Error() == "EOF" {
			return ""
		}
	}
}

func nextInt() (n int) {
	for {
		_, err = scanf("%v", &n)
		if err == nil {
			return n
		}
		if err.Error() == "EOF" {
			return 0
		}
	}
}

func nextLong() (n int64) {
	for {
		_, err = scanf("%v", &n)
		if err == nil {
			return n
		}
		if err.Error() == "EOF" {
			return 0
		}
	}
}

func nextDouble() (n float64) {
	for {
		_, err = scanf("%v", &n)
		if err == nil {
			return n
		}
		if err.Error() == "EOF" {
			return 0
		}
	}
}

func Fill(a []int, v int) {
	for i := range a {
		a[i] = v
	}
}

func FillB(a []bool, v bool) {
	for i := range a {
		a[i] = v
	}
}

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

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

func Abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

const (
	oo  = 100000000
	mod = 1
)

func mult(a, b int64) int64 {
	return (a * b) % mod
}
func add(a, b int64) int64 {
	return (a + b) % mod
}
func sub(a, b int64) int64 {
	return (a - b + mod) % mod
}

var (
	base, a, b map[string]string
	dp         []map[string]int
	pat        string
)

func dfs(i int, x string) int {
	{
		a, test := dp[i][x]
		if test {
			return a
		}
	}
	res := i
	if base[x] != "" {
		for _, c := range []byte(base[x]) {
			if res < len(pat) && pat[res] == c {
				res++
			}
		}
	} else {
		res = dfs(dfs(i, a[x]), b[x])
	}
	dp[i][x] = res
	return res
}

func solve() {
	n := nextInt()
	arr := make([]int, n)
	for i := range arr {
		arr[i] = nextInt()
	}
	if arr[0]+arr[1] <= arr[n-1] {
		printf("%d %d %d\n", 1, 2, n)
	} else {
		printf("-1\n")
	}
}

func main() {
	in = bufio.NewReaderSize(os.Stdin, 8192)
	out = bufio.NewWriterSize(os.Stdout, 8192)
	if false {
		file1, err := os.Open("input.txt")
		if err != nil {
			log.Fatal(err)
		}
		file2, err := os.Create("output.txt")
		if err != nil {
			log.Fatal(err)
		}
		in = bufio.NewReaderSize(file1, 8192)
		out = bufio.NewWriterSize(file2, 8192)
	}
	defer out.Flush()

	// start := time.Now()

	for t := nextInt(); t > 0; t-- {
		solve()
	}

	// printf("%v\n", time.Now().Sub(start))
}

package main

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

func main() {
	var t, n, a, b, c int
	in := bufio.NewReader(os.Stdin)
	fmt.Fscan(in, &t)
	for i := 0; i < t; i++ {
		fmt.Fscan(in, &n)
		fmt.Fscan(in, &a)
		fmt.Fscan(in, &b)
		for j := 0; j < n-2; j++ {
			fmt.Fscan(in, &c)
		}
		if a+b <= c {
			fmt.Println(1, 2, n)
		} else {
			fmt.Println(-1)
		}
	}
}

package main

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

func main() {
	var t, n, a, b, c int
	in := bufio.NewReader(os.Stdin)
	fmt.Fscan(in, &t)
	for i := 0; i < t; i++ {
		fmt.Fscan(in, &n)
		fmt.Fscan(in, &a)
		fmt.Fscan(in, &b)
		for j := 0; j < n-2; j++ {
			fmt.Fscan(in, &c)
		}
		if c+b > a {
			fmt.Println(1, 2, n)
		} else {
			fmt.Println(-1)
		}
	}
}

package main

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

func main() {
	var t, n, a, b, c int
	in := bufio.NewReader(os.Stdin)
	fmt.Fscan(in, &t)
	for i := 0; i < t; i++ {
		fmt.Fscan(in, &n)
		fmt.Fscan(in, &a)
		fmt.Fscan(in, &b)
		for j := 0; j < n-2; j++ {
			fmt.Fscan(in, &c)
		}
		if a+b < c {
			fmt.Println(1, 2, n)
		} else {
			fmt.Println(-1)
		}
	}
}

package main

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

func main() {
	var t, n, a, b, c int
	in := bufio.NewReader(os.Stdin)
	fmt.Fscan(in, &t)
	for i := 0; i < t; i++ {
		fmt.Fscan(in, &n)
		fmt.Fscan(in, &a)
		fmt.Fscan(in, &b)
		for j := 0; j < n-2; j++ {
			fmt.Fscan(in, &c)
		}
		if a+b > c {
			fmt.Println(1, 2, n)
		} else {
			fmt.Println(-1)
		}
	}
}

package main

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

func main() {
	var t, n, a, b, c int
	in := bufio.NewReader(os.Stdin)
	fmt.Fscan(in, &t)
	for i := 0; i < t; i++ {
		fmt.Fscan(in, &n)
		fmt.Fscan(in, &a)
		fmt.Fscan(in, &b)
		for j := 0; j < n-2; j++ {
			fmt.Fscan(in, &c)
		}
		if a+b < c {
			fmt.Println(a, b, c)
		} else {
			fmt.Println(-1)
		}
	}
}

package main

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

var out *bufio.Writer

func nextInt() (res int) {
	res = 0
	_, err := fmt.Scanf("%v", &res)
	if err != nil {
		res = 0
	}
	return
}

func solve(idx int) {
	n := nextInt()
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = nextInt()
	}
	if n < 3 {
		fmt.Println(-1)
		return
	}
	if a[0]+a[1] <= a[n-1] {
		fmt.Printf("%d %d %d\n", 1, 2, n)
	} else {
		fmt.Println(-1)
	}
}

func main() {
	out = bufio.NewWriterSize(os.Stdout, 8192)
	defer out.Flush()
	idx := 0
	for t := nextInt(); t > 0; t-- {
		solve(idx)
		idx++
	}
}

package main

import (
	"fmt"
)

func nextInt() (res int) {
	res = 0
	_, err := fmt.Scanf("%v", &res)
	if err != nil {
		res = 0
	}
	return
}

func solve(idx int) {
	n := nextInt()
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = nextInt()
	}
	if n < 3 {
		fmt.Println(-1)
		return
	}
	if a[0]+a[1] <= a[n-1] {
		fmt.Printf("%d %d %d\n", 1, 2, n)
	} else {
		fmt.Println(-1)
	}
}

func main() {
	idx := 0
	for t := nextInt(); t > 0; t-- {
		solve(idx)
		idx++
	}
}