package main

import "fmt"

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

	for i := 0; i < t; i++ {
		var n, a int
		fmt.Scan(&n)
		fmt.Scan(&a)
		currentLength := 1
		maxLength := 1
		currentLengthElem := a
		for j := 1; j < n; j++ {
			fmt.Scan(&a)
			if a == currentLengthElem {
				currentLength++
			} else {
				if currentLength > maxLength {
					maxLength = currentLength
				}
				currentLengthElem = a
				currentLength = 1
			}
		}

		if currentLength > maxLength {
			maxLength = currentLength
		}
		fmt.Println(maxLength)
	}
}

package main

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

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

		fmt.Println(ans + 1)
	}
}

// func main() {
// 	in := bufio.NewReader(os.Stdin)
// 	var t, n, a int
// 	fmt.Fscan(in, &t)
// 	for i := 0; i < t; i++ {
// 		fmt.Fscan(in, &n)
// 		bucket := make([]int, n)
// 		for j := 0; j < n; j++ {
// 			fmt.Fscan(in, &a)
// 			bucket[a-1]++
// 		}
// 		ans := 0
// 		for j := 0; j < n; j++ {
// 			if ans < bucket[j] {
// 				ans = bucket[j]
// 			}
// 		}

// 		fmt.Println(ans)
// 	}
// }

package main

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

// func main() {
// 	in := bufio.NewReader(os.Stdin)
// 	var t, n, a, la int
// 	fmt.Fscan(in, &t)
// 	for i := 0; i < t; i++ {
// 		fmt.Fscan(in, &n)
// 		count := 0
// 		ans := 0
// 		for j := 0; j < n; j++ {
// 			fmt.Fscan(in, &a)
// 			if a == la {
// 				count++
// 			} else {
// 				if count > ans {
// 					ans = count
// 				}
// 				la = a
// 				count = 0
// 			}
// 		}
// 		if count > ans {
// 			ans = count
// 		}

// 		fmt.Println(ans + 1)
// 	}
// }

func main() {
	in := bufio.NewReader(os.Stdin)
	var t, n, a int
	fmt.Fscan(in, &t)
	for i := 0; i < t; i++ {
		fmt.Fscan(in, &n)
		bucket := make([]int, n)
		for j := 0; j < n; j++ {
			fmt.Fscan(in, &a)
			bucket[a-1]++
		}
		ans := 0
		for j := 0; j < n; j++ {
			if ans < bucket[j] {
				ans = bucket[j]
			}
		}

		fmt.Println(ans)
	}
}

package main

import (
	"fmt"
)

func main() {
	var arr [100]int
	var t int
	fmt.Scanf("%v\n", &t)
	for ; t > 0; t-- {
		var n int
		fmt.Scanf("%v\n", &n)

		for i := 0; i < n-1; i++ {
			fmt.Scanf("%v", &arr[i])
		}
		fmt.Scanf("%v\n", &arr[n-1])

		ans, count, curr := 0, 0, 0
		for i := 0; i < n; i++ {
			if arr[i] != curr {
				curr = arr[i]

				if count > ans {
					ans = count
				}
				count = 0
			}

			count++
		}

		if count > ans {
			ans = count
		}

		fmt.Println(ans)
	}
}

package main

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

func main() {
	scan := bufio.NewScanner(os.Stdin)
	scan.Scan()
	t, _ := strconv.Atoi(scan.Text())
	var arr []int

	for i := 0; i < t; i++ {
		scan.Scan()
		n, _ := strconv.Atoi(scan.Text())
		scan.Scan()
		data := regexp.MustCompile(" ").Split(scan.Text(), -1)
		sort.Strings(data)
		max, count, placeHolder := 0, 0, ""

		if n > 1 {
			for j := 0; j < n; j++ {
				if placeHolder == data[j] {
					count++
				} else {
					placeHolder = data[j]
					count = 1
				}
				if count > max {
					max = count
				}

			}
		}
		if max > 0 {
			arr = append(arr, max)
		} else {
			arr = append(arr, 1)
		}
	}

	for _, min := range arr {
		fmt.Println(min)
	}
}

package main

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

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

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

func main() {
	defer writer.Flush()

	t := 1
	scan(&t)

	for T := 0; T < t; T++ {
		n := 0
		scan(&n)

		a := make([]int, n)
		for i := 0; i < n; i++ {
			scan(&a[i])
		}

		solve(a)
	}
}

func solve(a []int) {
	ans := 1
	cnt := make(map[int]int)
	for _, x := range a {
		cnt[x]++
		ans = IntMax(cnt[x], ans)
	}
	printf("%d\n", ans)
}

// IntMax returns maximum of received int numbers
func IntMax(nums ...int) int {
	cand := nums[0]
	for _, num := range nums {
		if cand < num {
			cand = num
		}
	}
	return cand
}

package main

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

func main() {
	a:=bufio.NewReader(os.Stdin)
	l, _ :=a.ReadString('\n')
	l=strings.Trim(strings.Trim(l,"\n"),"\r")
	ln, _ :=strconv.Atoi(l)
	for i:=0; i<ln;i++{
		s,_:=a.ReadString('\n')
		las, _ := strconv.Atoi(strings.Trim(strings.Trim(s, "\n"), "\r"))
		str,_:=a.ReadString('\n')
		str = strings.Trim(strings.Trim(str, "\n"), "\r")
		mstr := make([]int, las)
		mstra := strings.Split(str," ")
		for j:=0; j<las; j++{
			mstr[j], _ = strconv.Atoi(mstra[j])
		}
		fmt.Printf("%d\n",fn(mstr))
	}
}

func fn(a []int) (res int){
	if len(a) == 1{
		return 1
	}

	m:=make(map[int]int)
	max := 1
	for i:=0; i<len(a); i++{
		_, ok := m[a[i]]
		if ok{
			m[a[i]]++
			if m[a[i]] > max{
				max = m[a[i]]
			}
		}else{
			m[a[i]] = 1
		}
	}
	return max
}

package main

import (
	"fmt"
)

/* Generated by powerful Codeforces Tool
 * You can download the binary file in here https://github.com/xalanq/cf-tool (Windows, macOS, Linux)
 * Author: kyicy
 * Time: 2021-01-28 22:37:17
**/

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

	nums := make([]int, 100)

	for t > 0 {
		t--

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

		var max, cur int
		for i := 0; i < n; i++ {
			if i != n-1 {
				fmt.Scanf("%d", &nums[i])

			} else {
				fmt.Scanf("%d\n", &nums[i])

			}
			if i == 0 {
				max = 1
				cur = 1
				continue
			}

			if nums[i] == nums[i-1] {
				cur += 1
			}

			if nums[i] != nums[i-1] || i == n-1 {
				if cur > max {
					max = cur
				}
				cur = 1
				continue
			}
		}

		fmt.Println(max)

	}
}

package main
import(
    "fmt"
    "bufio"
    "os"
)
func main() {
	in:= bufio.NewReader(os.Stdin)
	out:= bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in,&t)
	for i:=0;i<t;i++{
		var n int
		fmt.Fscan(in,&n)
		counter:=0
		mode:=0
		recent:=0
		for j:=0;j<n;j++{
			var x int
			fmt.Fscan(in,&x)
			if j == 0 {
				recent=x
				counter++
			} else {
				if x == recent {
					counter++
				} else {
					if counter > mode {
						mode = counter
					}
					counter=1
					recent= x
				}
			}
		}
		fmt.Fprintln(out,max(mode,counter))
	}
}
func max(a,b int) int {
	if a >= b {
		return a
	}
	return b
}

package main

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

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

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

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

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

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

/**
 Run solve the problem CF1478A
 Date: 13/04/21
 User: pepradere
 URL: https://codeforces.com/problemset/problem/1478/A
 Problem: CF1478A
**/
func (in *CF1478A) Run() {
	T := in.NextInt()
	for ; T > 0; T-- {
		N := in.NextInt()
		m := make(map[int]int)
		max := 0
		for ; N > 0; N-- {
			val := in.NextInt()
			d, ok := m[val]
			if !ok {
				m[val] = 1
			} else {
				m[val] = d + 1
			}
			d = m[val]
			max = int(math.Max(float64(d), float64(max)))
		}

		fmt.Println(max)
	}
}

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

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

package main

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

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

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

	for ; t > 0; t-- {
		fmt.Fscan(in, &n)
		a := make([]int, n)
		min := 1
		for i := 0; i < n; i++ {
			fmt.Fscan(in, &a[i])
			cur := 1
			for j := 0; j < i; j++ {
				if a[j] == a[i] {
					cur++
				}
			}
			if cur > min {
				min = cur
			}
		}
		fmt.Println(min)
	}
}

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 := scanInt()

		prev, prevCount := 0, 0
		maxCount := 0

		for i := 0; i < n; i++ {
			a := scanInt()

			if a == prev {
				prevCount++
			} else {
				prev, prevCount = a, 1
			}

			if prevCount > maxCount {
				maxCount = prevCount
			}
		}

		if prevCount > maxCount {
			maxCount = prevCount
		}

		fmt.Println(maxCount)
	}
}

package main

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

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

	tc := readNum(reader)

	var buf bytes.Buffer

	for tc > 0 {
		tc--
		n := readNum(reader)
		A := readNNums(reader, n)
		res := solve(A)
		buf.WriteString(fmt.Sprintf("%d\n", res))
	}

	fmt.Print(buf.String())
}

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

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

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

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

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

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

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

	return i
}

func solve(A []int) int {
	n := len(A)
	var res int
	for i := 0; i < n; {
		j := i
		for i < n && A[i] == A[j] {
			i++
		}
		res = max(res, i-j)
	}
	return res
}

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

package main

import "fmt"

func main(){
  var tt int
  fmt.Scan(&tt)
  for t:=0;t<tt;t++ {
    var n int
    ans:=0
    fmt.Scan(&n)
    m:=make(map[int]int)
    for i:=0;i<n;i++{
      var j int
      fmt.Scan(&j)
      m[j]++
      if m[j]>ans{
        ans=m[j]
      }
    }
    fmt.Println(ans)
  }
}

package main

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

func main() {
	problemA()
	//problemB()

}

func problemA()  {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	cases := 0
	Fscan(in, &cases)
	max:= func(x int, y int) int {
		if x>y{
			return x
		}else {
			return y
		}
	}
	for ; cases > 0; cases-- {
		var length int
		Fscan(in,&length)
		var prev int
		Fscan(in,&prev)
		count:=1
		lcount := 1
		for i := 1; i < length; i++ {
			var element int
			Fscan(in,&element)
			if prev == element {
				lcount++
			}else {
				count = max(lcount,count);
				lcount = 1
			}
			prev = element
		}
		count = max(lcount,count);
		Fprintln(out,count)
	}

}

package main

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

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

	var t int
	fmt.Fscan(r, &t)
	for i := 0; i < t; i++ {
		var n int
		fmt.Fscan(r, &n)
		a := make([]int, n+1)
		for j := 0; j < n; j++ {
			var t int
			fmt.Fscan(r, &t)
			a[t]++
		}
		var max int
		for _, x := range a {
			if x > max {
				max = x
			}
		}
		fmt.Fprintln(w, max)
	}
}

package main

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

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

func main() {

	defer out.Flush()

	fmt.Fscan(in, &t)

	for ; t > 0; t-- {

		fmt.Fscan(in, &n)
		a := make([]int, n)

		for i := range a {
			fmt.Fscan(in, &a[i])
		}

		fmt.Fprintln(out, solve(a))

	}

}

func solve(a []int) int {

	count := 1
	max := 1

	for i := 1; i < len(a); i++ {

		if a[i] == a[i-1] {
			count++

			if i == len(a)-1 {
				if count > max {
					max = count
				}
			}

		} else {
			if count > max {
				max = count
			}
			count = 1
		}

	}

	return max

}

package main

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

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

func scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		log.Fatal(err)
	}
}

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

func printf(f string, a ...interface{}) {
	if _, err := fmt.Fprintf(writer, f, a...); err != nil {
		log.Fatal(err)
	}
}

func solve() {
	var n int
	scan(&n)
	last, cnt := -1, 0
	ans := 1
	for i := 0; i < n; i++ {
		var x int
		scan(&x)
		if x == last {
			cnt += 1
		} else {
			last = x
			cnt = 1
		}
		if cnt > ans {
			ans = cnt
		}
	}
	printf("%d\n", ans)
	//writer.Flush()
}

func main() {
	defer writer.Flush()

	testCases := 0
	scan(&testCases)
	for i := 0; i < testCases; i++ {
		solve()
	}
}

package main

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

func main() {

	var tcs int
	in := bufio.NewReader(os.Stdin)
	_, _ = fmt.Fscan(in, &tcs)

	for tc := 0; tc < tcs; tc++ {
		var n int
		var a [200]int

		_, _ = fmt.Fscan(in, &n)
		for i := 0; i < n; i++ {
			var temp int
			_, _ = fmt.Fscan(in, &temp)
			a[temp]++
		}

		ans := 1
		for i := 0; i < 200; i++ {
			if a[i] > ans {
				ans = a[i]
			}
		}
		fmt.Println(ans)
	}
}

package main

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

// github.com/EndlessCheng/codeforces-go
func CF1478A(_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, n)
		for i := range a {
			Fscan(in, &a[i])
		}
		mx := 0
		for i := 0; i < n; {
			st := i
			for ; i < n && a[i] == a[st]; i++ {
			}
			if i-st > mx {
				mx = i - st
			}
		}
		Fprintln(out, mx)
	}
}

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

package main

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

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

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

		fmt.Fscan(input, &n)

		ArrayOfAIIII := make([]int, n)

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

		}

		ArrayOfAIIII = append(ArrayOfAIIII, 10000)
		ARRAY := make([]int, 0)
		ini := 0
		for i := 1; i < n+1; i++ {

			if ArrayOfAIIII[i] > ArrayOfAIIII[i-1] {
				ARRAY = append(ARRAY, i-ini)
				ini = i
			}
		}

		sort.Ints(ARRAY)
		fmt.Println(ARRAY[len(ARRAY)-1])

	}

}

package main

import (
	"bufio"
	"fmt"
	"os"
    "sort"
)
var (
    input = bufio.NewReader(os.Stdin)
    output = bufio.NewWriter(os.Stdout)
)

func assert(test bool) {
    if !test {panic("assertion!")}
}

// (c) Dmitriy Blokhin (sv.dblokhin@gmail.com)
// TODO***
// - read the statement carefully
// - get solution before coding
// - check the boundaries (int/int64)
func main() {
    var t int
	fmt.Fscan(input, &t)
    for t > 0 {
        t--
        solve()
    }
    output.Flush()
}

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

func solve() {
    var (
        n int
    )
    fmt.Fscan(input, &n)
    a := make([]int, n)
    for i := 0; i < n; i++ {
        fmt.Fscan(input, &a[i])
    }

    sort.Ints(a)
    cnt := 1;
    ma := 0
    for i := 1; i < n; i++ {
        if a[i] == a[i - 1] {
            cnt++
        } else {
            ma = max(ma, cnt)
            cnt = 1
        }
    }
    ma = max(ma, cnt)
    fmt.Fprintln(output, ma)
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	var t, n, a, la int
	fmt.Fscan(in, &t)
	for i := 0; i < t; i++ {
		fmt.Fscan(in, &n)
		count := 0
		ans := 0
		for j := 0; j < n; j++ {
			fmt.Fscan(in, &a)
			if a == la {
				count++
			} else {
				if count > ans {
					ans = count
				}
				la = a
				count = 0
			}
		}
		if count > ans {
			ans = count
		}

		fmt.Println(ans + 1)
	}
}

package main

import (
	"fmt"
)

func main() {
	var arr [100]int
	var t int
	fmt.Scanf("%v\n", &t)
	for ; t > 0; t-- {
		var n int
		fmt.Scanf("%v\n", &n)

		for i := 0; i < n-1; i++ {
			fmt.Scanf("%v ", &arr[i])
		}
		fmt.Scanf("%v\n", &arr[n-1])

		ans, count, curr := 0, 0, 0
		for i := 0; i < n; i++ {
			if arr[i] != curr {
				curr = arr[i]

				if count > ans {
					ans = count
				}
				count = 0
			}

			count++
		}

		if count > ans {
			ans = count
		}

		fmt.Println(ans)
	}
}

package main

import (
	"fmt"
)

func main() {
	var arr [100]int
	var t int
	fmt.Scanf("%v\n", &t)
	for ; t > 0; t-- {
		var n int
		fmt.Scanf("%v\n", &n)

		for i := 0; i < n; i++ {
			fmt.Scanf("%v", &arr[i])
		}

		ans, count, curr := 0, 0, 0
		for i := 0; i < n; i++ {
			if arr[i] != curr {
				curr = arr[i]

				if count > ans {
					ans = count
				}
				count = 0
			}

			count++
		}

		if count > ans {
			ans = count
		}

		fmt.Println(ans)
	}
}

package main

import (
	"fmt"
)

func main() {
	var arr [100]int
	var t int
	fmt.Scanf("%v", &t)
	for ; t > 0; t-- {
		var n int
		fmt.Scanf("%v", &n)

		for i := 0; i < n; i++ {
			fmt.Scanf("%v", &arr[i])
		}

		ans, count, curr := 0, 0, 0
		for i := 0; i < n; i++ {
			if arr[i] != curr {
				curr = arr[i]

				if count > ans {
					ans = count
				}
				count = 0
			}

			count++
		}

		if count > ans {
			ans = count
		}

		fmt.Println(ans)
	}
}

package main

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

func divisible(w int) (b bool) {
	b = false

	for i := 2; i <= 100; i += 2 {
		for j := 2; j <= 100; j += 2 {
			if (i + j) == w {
				b = true
				break
			}
		}
	}
	return
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	w, _ := strconv.Atoi(scanner.Text())

	if divisible(w) {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}

package main

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

func main() {
	a:=bufio.NewReader(os.Stdin)
	l, _ :=a.ReadString('\n')
	l=strings.Trim(strings.Trim(l,"\n"),"\r")
	ln, _ :=strconv.Atoi(l)
	for i:=0; i<ln;i++{
		s,_:=a.ReadString('\n')
		las, _ := strconv.Atoi(strings.Trim(strings.Trim(s, "\n"), "\r"))
		str,_:=a.ReadString('\n')
		str = strings.Trim(strings.Trim(str, "\n"), "\r")
		mstr := make([]int, las)
		mstra := strings.Split(str," ")
		for j:=0; j<las; j++{
			mstr[j], _ = strconv.Atoi(mstra[j])
		}
		fmt.Printf("%s\n",fn(mstr))
	}
}

func fn(a []int) (res int){
	if len(a) == 1{
		return 1
	}

	m:=make(map[int]int)
	max := 1
	for i:=0; i<len(a); i++{
		_, ok := m[a[i]]
		if ok{
			m[a[i]]++
			if m[a[i]] > max{
				max = m[a[i]]
			}
		}else{
			m[a[i]] = 1
		}
	}
	return max
}

package main

import (
	"fmt"
)

/* Generated by powerful Codeforces Tool
 * You can download the binary file in here https://github.com/xalanq/cf-tool (Windows, macOS, Linux)
 * Author: kyicy
 * Time: 2021-01-28 22:37:17
**/

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

	nums := make([]int,100)

	for t > 0 {
		t--

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

		var max, cur int
		for i := 0; i < n; i++ {
			fmt.Scanf("%d", &nums[i])
			if (i == 0) {
				max = 1
				cur = 1
				continue
			}

			if nums[i] == nums[i-1] {
				cur+=1
			}

			if nums[i] != nums[i-1] || i == n-1{
				if cur > max {
					max = cur
				}
				cur = 1
				continue
			}
		}

		fmt.Println(max)

	}
}


package main

import (
	"bufio"
	"os"
	"runtime"
	"strconv"
)

/* solution */

func solve() {
	t := readInt()
	for i := 0; i < t; i++ {
		solveOne()
	}
}

func solveOne() {

	n, a, b := readInt64(), readInt64(), readInt64()
	s := read()

	var k int64
	for k = int64(2); 2*a > (k-1)*b; k++ {
	}

	arr := make([]int64, 0)
	cnt := int64(1)
	for i := int64(0); i < n-1; i++ {
		if s[i] != s[i+1] {
			arr = append(arr, cnt)
			cnt = 1
		} else {
			cnt++
		}
	}
	arr = append(arr, cnt)

	if len(arr) == 1 {
		printInt64(n*a + (n+1)*b)
		return
	}

	ans := n*a + (n+1)*2*b + 2*a - arr[0]*b - arr[len(arr)-1]*b

	for i := 2; i < len(arr)-2; i += 2 {
		if arr[i] >= k {
			ans += 2*a - (arr[i]-1)*b
		}
	}

	printInt64(ans)

}

/* stubs */

func main() {

	var f *os.File
	if runtime.GOROOT() == "C:\\Soft\\Go" {
		f, _ = os.Open("input.txt")
		defer f.Close()
	} else {
		f = os.Stdin
	}

	writer = bufio.NewWriter(os.Stdout)
	defer writer.Flush()

	reader = bufio.NewScanner(f)

	const maxCapacity = 2*100000 + 5
	buf := make([]byte, maxCapacity)
	reader.Buffer(buf, maxCapacity)

	reader.Split(bufio.ScanWords)

	solve()

}

var reader *bufio.Scanner
var writer *bufio.Writer

func read() string {
	reader.Scan()
	return reader.Text()
}

func readInt() int {
	reader.Scan()
	ret, _ := strconv.Atoi(reader.Text())
	return ret
}

func readInt64() int64 {
	reader.Scan()
	ret, _ := strconv.ParseInt(reader.Text(), 10, 64)
	return ret
}

func print(s string) {
	writer.WriteString(s)
	writer.WriteString("\n")
}

func printInt(i int) {
	print(strconv.Itoa(i))
}

func printInt64(i int64) {
	print(strconv.FormatInt(i, 10))
}

// To execute Go code, please declare a func main() in a package "main"

package main

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

func getNumsFromOneLine(ir *bufio.Reader) []int {
  stream, _ := ir.ReadString('\n')
  // Trims the stream and then splits
  trimmedStream := strings.TrimSpace(stream)
  splitArr := strings.Split(trimmedStream, " ")
  // convert strings to integers and store them in a slice
  nums := make([]int, len(splitArr))
  for index, val := range splitArr {
    nums[index], _ = strconv.Atoi(val)
  }
  return nums
}

func main() {
  ir := bufio.NewReader(os.Stdin)
  t := getNumsFromOneLine(ir)[0]

  //   dp[n][2] (0: 在中间 1:上面)

  //   dp[n][0] = min(dp[n-1][0] + 1个红色 + 1个黑色, dp[n - 1][1] + 2个红色 + 1个黑色)   --- 注意这种情况只针对字符串值为0的情况
  //   dp[n][1] = min(dp[n-1][1] + 1个红色 + 2个黑色，dp[n - 1][0] + 2个红色 + 2个黑色)
  for i := 0; i < t; i++ {
    nab := getNumsFromOneLine(ir)
    n, a, b := nab[0], int64(nab[1]), int64(nab[2])
    s, _ := ir.ReadString('\n')
    dp := make([][2]int64, n+1)
    dp[0][0] = b
    dp[0][1] = 1000000000000000000
    for j := 1; j <= n; j++ {
      if s[j-1] == '0' {
        dp[j][0] = dp[j-1][0] + a + b
        if dp[j-1][1] + 2 * a + b < dp[j][0] {
          dp[j][0] = dp[j-1][1] + 2 * a + b
        }

        dp[j][1] = dp[j-1][0] + 2*a + 2*b
        if dp[j-1][1] + a + 2 * b < dp[j][1] {
          dp[j][1] = dp[j-1][1] + a + 2 * b
        }
      } else {

        dp[j][1] = dp[j-1][1] + a + b * 2
        // if dp[j-1][0] + 2 * a + 2 * b < dp[j][1] {
        //   dp[j][1] = dp[j-1][0] + 2 * a + 2 * b
        // }

        dp[j][0] = 1000000000000000000
      }

    }
    fmt.Println(dp[n][0])
  }

}

package main

import (
	"bufio"
	"os"
	"runtime"
	"strconv"
)

/* solution */

func solve() {
	t := readInt()
	for i := 0; i < t; i++ {
		solveOne()
	}
}

func solveOne() {

	n, a, b := readInt64(), readInt64(), readInt64()
	s := read()

	var k int64
	for k = int64(2); 2*a > (k-1)*b; k++ {
	}

	arr := make([]int64, 0)
	cnt := int64(1)
	for i := int64(0); i < n-1; i++ {
		if s[i] != s[i+1] {
			arr = append(arr, cnt)
			cnt = 1
		} else {
			cnt++
		}
	}
	arr = append(arr, cnt)

	if len(arr) == 1 {
		printInt64(n*a + (n+1)*b)
		return
	}

	ans := n*a + (n+1)*2*b + 2*a - arr[0]*b - arr[len(arr)-1]*b

	for i := 2; i < len(arr)-2; i++ {
		if arr[i] >= k {
			ans += 2*a - (arr[i]-1)*b
		}
	}

	printInt64(ans)

}

/* stubs */

func main() {

	var f *os.File
	if runtime.GOROOT() == "C:\\Soft\\Go" {
		f, _ = os.Open("input.txt")
		defer f.Close()
	} else {
		f = os.Stdin
	}

	writer = bufio.NewWriter(os.Stdout)
	defer writer.Flush()

	reader = bufio.NewScanner(f)

	const maxCapacity = 2*100000 + 5
	buf := make([]byte, maxCapacity)
	reader.Buffer(buf, maxCapacity)

	reader.Split(bufio.ScanWords)

	solve()

}

var reader *bufio.Scanner
var writer *bufio.Writer

func read() string {
	reader.Scan()
	return reader.Text()
}

func readInt() int {
	reader.Scan()
	ret, _ := strconv.Atoi(reader.Text())
	return ret
}

func readInt64() int64 {
	reader.Scan()
	ret, _ := strconv.ParseInt(reader.Text(), 10, 64)
	return ret
}

func print(s string) {
	writer.WriteString(s)
	writer.WriteString("\n")
}

func printInt(i int) {
	print(strconv.Itoa(i))
}

func printInt64(i int64) {
	print(strconv.FormatInt(i, 10))
}


package main

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

var (
	reader = bufio.NewReader(os.Stdin)
	t, n   int
	s      []int
)

func solve(n int, s []int) string {
	var smap = make(map[int][]int)
	for i, x := range s {
		smap[x] = append(smap[x], i+1)
	}
	for i := range smap {
		if len(smap[i]) == 1 {
			return "-1"
		}
	}
	var rs = make([]string, n)
	for _, chain := range smap {
		var l = len(chain)
		for i := 0; i < l; i++ {
			rs[chain[i]-1] = fmt.Sprintf("%d", chain[(i+1)%l])
		}
	}
	return strings.Join(rs, " ")
}

func main() {
	fmt.Fscan(reader, &t)
	for ; t > 0; t-- {
		fmt.Fscan(reader, &n)
		s = make([]int, n)
		for i := 0; i < n; i++ {
			fmt.Fscan(reader, &s[i])
		}
		fmt.Println(solve(n, s))
	}
}

// 00
package main

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

func write(f *bufio.Writer, a ...interface{}) {
	f.Write([]byte(fmt.Sprint(a...)))
}

func main() {
	var T int
	reader := bufio.NewReader(os.Stdin)
	f := bufio.NewWriter(os.Stdout)
	defer f.Flush()
	fmt.Fscan(reader, &T)
	for t := 1; t <= T; t++ {
		var n int
		fmt.Fscan(reader, &n)
		s := make([]int, n)
		m := make(map[int]int)
		for i := 0; i < n; i++ {
			fmt.Fscan(reader, &s[i])
			m[s[i]]++
		}

		ok := true
		for _, v := range m {
			if v == 1 {
				ok = false
				break
			}
		}
		if ok {
			keys := make([]int, len(m))
			i := 0
			for k := range m {
				keys[i] = k
				i++
			}
			sort.Ints(keys)

			start := 1
			for _, kk := range keys {
				v := m[kk]
				write(f, start+v-1, " ")
				for k := start; k < start+v-1; k++ {
					write(f, k, " ")
				}
				start += v
			}
			// print line
			write(f, "\n")

		} else {
			write(f, -1, "\n")
		}
	}
}

// 00
package main

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

type Anything interface {
	int64 | float64 | int | string | float32
}

func write[K Anything](f *bufio.Writer, a K) {
	f.Write([]byte(fmt.Sprint(a)))
}

func main() {
	var T int
	reader := bufio.NewReader(os.Stdin)
	f := bufio.NewWriter(os.Stdout)
	defer f.Flush()
	fmt.Fscan(reader, &T)
	for t := 1; t <= T; t++ {
		var n int
		fmt.Fscan(reader, &n)
		s := make([]int, n)
		m := make(map[int]int)
		for i := 0; i < n; i++ {
			fmt.Fscan(reader, &s[i])
			m[s[i]]++
		}

		ok := true
		for _, v := range m {
			if v == 1 {
				ok = false
				break
			}
		}
		if ok {
			keys := make([]int, len(m))
			i := 0
			for k := range m {
				keys[i] = k
				i++
			}
			sort.Ints(keys)

			start := 1
			for _, kk := range keys {
				v := m[kk]
				write(f, start+v-1)
				write(f, " ")
				for k := start; k < start+v-1; k++ {
					write(f, k)
					write(f, " ")
				}
				start += v
			}
			// print line
			write(f, "\n")

		} else {
			write(f, -1)
			write(f, "\n")
		}
	}
}

package main

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

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

func slove() {
	var n int
	fmt.Fscan(r, &n)
	nums := make([]int, n)
	for i:=0;i<n;i++ {
		fmt.Fscan(r, &nums[i])
	}
	if n == 1 {
		fmt.Fprintln(w, -1)
		return
	}
	last := nums[0] - 1
	flag := false
	l := make([]int, 0)
	j := 0
	for i := range nums {
		if nums[i] != last {
			if flag {
				fmt.Fprintln(w, -1)
				return
			}
			l = append(l, i - j)
			last = nums[i]
			j = i
			flag = true
		} else {
			flag = false
		}
	}
	l = append(l, n - j)
	if j + 1 == n {
		fmt.Fprintln(w, -1)
		return
	}
	l = l[1:]
	start := 0
	ans := make([]int, n)
	for i := range ans {
		ans[i] = i + 1
	}
	for i := range l {
		t := ans[start]
		for j:=start;j<start+l[i]-1;j++ {
			ans[j] = ans[j+1]
		}
		ans[start+l[i]-1] = t
		start += l[i]
	}
	for i := range ans {
		fmt.Fprint(w, ans[i])
		if i != n - 1 {
			fmt.Fprint(w, " ")
		} else {
			fmt.Fprint(w, "\n")
		}
	}
}

func main() {
	defer w.Flush()
	var n int
	fmt.Fscan(r, &n)
	for i:=1;i<=n;i++ {
		slove()
	}
}

package main

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

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

	var testCases int
	Fscan(in, &testCases)

	for c := 0; c < testCases; c++ {
		var n int
		Fscan(in, &n)

		nums := make([]Pair, n)
		for i := 0; i < n; i++ {
			Fscan(in, &nums[i].shoe)
			nums[i].idx = i + 1
		}

		res := solve(nums)
		if res == nil {
			Fprintln(out, -1)
			continue
		}

		for i := 0; i < n; i++ {
			Fprint(out, res[i])
			if i < n {
				Fprint(out, " ")
			}
		}
		Fprintln(out)
	}

}

type Pair struct {
	idx  int
	shoe int
}

func solve(nums []Pair) []int {
	sort.Slice(nums, func(i, j int) bool {
		if nums[i].shoe == nums[j].shoe {
			return nums[i].idx < nums[j].idx
		}
		return nums[i].shoe < nums[j].shoe
	})

	n := len(nums)
	res := make([]int, n)

	for i := n - 1; i >= 0; {
		j := i - 1
		for ; j >= 0; j-- {
			if nums[j].shoe != nums[i].shoe {
				break
			}
		}

		if j+1 >= i {
			return nil
		}

		l := j + 1
		r := i
		if (r-l+1)%2 == 1 {
			res[l] = nums[r].idx
			nums[r].idx = nums[l].idx
			nums[r].shoe = nums[l].shoe
			l++
		}
		for l <= r {
			res[l] = nums[r].idx
			res[r] = nums[l].idx
			l++
			r--
		}
		i = j
	}
	return res
}

package main

import (
	"bufio"
	"container/heap"
	. "fmt"
	"math"
	"os"
)

type Int int64

const (
	INF = 3e5 + 10
	L0  = Int(0)
	L1  = Int(1)
)

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

	var T int
	Fscan(in, &T)

	for tt := 0; tt < T; tt++ {
		var n int
		Fscan(in, &n)

		a := make([]int, n)
		ans := make([]int, n)

		for i := 0; i < n; i++ {
			Fscan(in, &a[i])
		}

		if n == 1 {
			Fprintln(out, -1)
			continue
		}

		flag := false

		last := a[0]
		first := 0
		p := 0
		cnt := 1
		for i := 1; i < n; i++ {
			if a[i] == last {
				ans[i] = p
				p = i
				cnt++
				if i == n-1 {
					flag = true
					ans[first] = i
				}
			} else {
				if cnt == 1 {
					break
				}
				ans[first] = i - 1
				last = a[i]
				p = i
				first = i
				cnt = 1
			}
		}
		if !flag {
			Fprintln(out, -1)
		} else {
			for i := 0; i < n; i++ {
				Fprint(out, ans[i]+1, " ")
			}
			Fprintln(out, "")
		}
	}

}

func MakeGrid(h, w int) [][]Int {
	index := make([][]Int, h)
	data := make([]Int, h*w)
	for i := 0; i < h; i++ {
		index[i] = data[i*w : (i+1)*w]
	}
	return index
}

func Abs(x Int) Int {
	if x > 0 {
		return x
	}
	return -x
}

func Min(nums ...Int) Int {
	return nums[MinIdx(nums...)]
}

func MinIdx(nums ...Int) Int {
	maxNumIdx := L0
	for i, num := range nums {
		if num < nums[maxNumIdx] {
			maxNumIdx = Int(i)
		}
	}
	return maxNumIdx
}

func Max(nums ...Int) Int {
	return nums[MaxIdx(nums...)]
}

func MaxIdx(nums ...Int) Int {
	maxNumIdx := L0
	for i, num := range nums {
		if num > nums[maxNumIdx] {
			maxNumIdx = Int(i)
		}
	}
	return maxNumIdx
}

var (
	mod  Int
	fmod func(Int) Int = doNothing
)

// SetMod sets the mod. It must be called first.
func SetMod(newMod Int) {
	mod = newMod
	fmod = dynamicMod
}

func dynamicMod(m Int) Int {
	m %= mod
	if m < 0 {
		return m + mod
	}
	return m
}

func doNothing(m Int) Int {
	return m
}

// Mod returns m % mod.
func (m Int) Mod() Int {
	return fmod(m)
}

// Inv returns modular multiplicative inverse
func (m Int) Inv() Int {
	return m.Pow(Int(0).Sub(2))
}

// Pow returns m^n
func (m Int) Pow(n Int) Int {
	p := Int(1)
	for n > 0 {
		if n&1 == 1 {
			p.MulAs(m)
		}
		m.MulAs(m)
		n >>= 1
	}
	return p
}

// Add returns m+x
func (m Int) Add(x Int) Int {
	return (m + x).Mod()
}

// Sub returns m-x
func (m Int) Sub(x Int) Int {
	return (m - x).Mod()
}

// Mul returns m*x
func (m Int) Mul(x Int) Int {
	return (m * x).Mod()
}

// Div returns m/x
func (m Int) Div(x Int) Int {
	return m.Mul(x.Inv())
}

// AddAs assigns *m + x to *m and returns m
func (m *Int) AddAs(x Int) *Int {
	*m = m.Add(x)
	return m
}

// SubAs assigns *m - x to *m and returns m
func (m *Int) SubAs(x Int) *Int {
	*m = m.Sub(x)
	return m
}

// MulAs assigns *m * x to *m and returns m
func (m *Int) MulAs(x Int) *Int {
	*m = m.Mul(x)
	return m
}

// DivAs assigns *m / x to *m and returns m
func (m *Int) DivAs(x Int) *Int {
	*m = m.Div(x)
	return m
}

func (m *Int) MaxAs(x ...Int) *Int {
	*m = Max(append(x, *m)...)
	return m
}

func (m *Int) MinAs(x ...Int) *Int {
	*m = Min(append(x, *m)...)
	return m
}

type Void struct{}

var void Void

type HashSet struct {
	ma map[Int]Void
}

func NewHashSet() *HashSet {
	return &HashSet{
		ma: make(map[Int]Void),
	}
}

func (s *HashSet) add(x Int) bool {
	_, exists := s.ma[x]
	if !exists {
		s.ma[x] = void
		return true
	} else {
		return false
	}
}

func (s *HashSet) del(x Int) {
	delete(s.ma, x)
}

func (s *HashSet) exist(x Int) bool {
	_, exists := s.ma[x]
	return exists
}

// An Item is something we manage in a priority queue.
type Item struct {
	value    Int // The value of the item; arbitrary.
	priority Int // The priority of the item in the queue.
	indices  Int
	// The index is needed by update and is maintained by the heap.Interface methods.
	index int // The index of the item in the heap.
}

// A PriorityQueue implements heap.Interface and holds Items.
type PriorityQueue []*Item

func NewItem(value, priority Int) *Item {
	return &Item{
		value:    value,
		priority: priority,
		index:    -1,
	}

}

func (pq PriorityQueue) Len() int { return len(pq) }

func (pq PriorityQueue) Less(i, j int) bool {
	// We want Pop to give us the highest, not lowest, priority so we use greater than here.
	return pq[i].priority < pq[j].priority
}

func (pq PriorityQueue) Swap(i, j int) {
	pq[i], pq[j] = pq[j], pq[i]
	pq[i].index = i
	pq[j].index = j
}

func (pq *PriorityQueue) Push(x interface{}) {
	n := len(*pq)
	item := x.(*Item)
	item.index = n
	*pq = append(*pq, item)
}

func (pq *PriorityQueue) Pop() interface{} {
	old := *pq
	n := len(old)
	item := old[n-1]
	old[n-1] = nil  // avoid memory leak
	item.index = -1 // for safety
	*pq = old[0 : n-1]
	return item
}

// update modifies the priority and value of an Item in the queue.
func (pq *PriorityQueue) update(item *Item, value Int, priority Int) {
	item.value = value
	item.priority = priority
	heap.Fix(pq, item.index)
}

type SegTree struct {
	st []Segment
}

type Segment struct {
	l, r, val, add, minIndex Int
}

func newSegTree(n Int) SegTree {
	segTree := SegTree{make([]Segment, n<<2)}
	segTree.Build(1, 1, n)
	return segTree
}

func (segTree SegTree) Build(x, l, r Int) {
	segTree.st[x].l = l
	segTree.st[x].r = r
	if l == r {
		segTree.st[x].minIndex = l
		return
	}
	mid := (l + r) >> 1
	segTree.Build(x<<1, l, mid)
	segTree.Build(x<<1|1, mid+1, r)
}

func (segTree SegTree) push(x Int) {
	if segTree.st[x].add != 0 {
		segTree.modifyOne(x<<1, segTree.st[x].add)
		segTree.modifyOne(x<<1|1, segTree.st[x].add)
		segTree.st[x].add = 0
	}
}

func (segTree SegTree) update(x Int) {
	if segTree.st[x<<1].val < segTree.st[x<<1|1].val {
		segTree.st[x].val = segTree.st[x<<1].val
		segTree.st[x].minIndex = segTree.st[x<<1].minIndex
	} else {
		segTree.st[x].val = segTree.st[x<<1|1].val
		segTree.st[x].minIndex = segTree.st[x<<1|1].minIndex
	}
}

func (segTree SegTree) modifyOne(x, add Int) {
	segTree.st[x].val += add
	if segTree.st[x].l != segTree.st[x].r {
		segTree.st[x].add += add
	}
}

func (segTree SegTree) Modify(x, l, r, add Int) {
	if segTree.st[x].l >= l && segTree.st[x].r <= r {
		segTree.modifyOne(x, add)
		return
	}
	segTree.push(x)
	mid := (segTree.st[x].l + segTree.st[x].r) >> 1
	if mid >= l {
		segTree.Modify(x<<1, l, r, add)
	}
	if mid < r {
		segTree.Modify(x<<1|1, l, r, add)
	}
	segTree.update(x)
}

func updateRes(cRes, cIndex, res, index Int) (Int, Int) {
	if cRes > res {
		return res, index
	}
	return cRes, cIndex
}

func (segTree SegTree) Query(x, l, r Int) (Int, Int) {
	res := Int(math.MaxInt64)
	resInd := -L1
	if segTree.st[x].l >= l && segTree.st[x].r <= r {
		res, resInd = updateRes(res, resInd, segTree.st[x].val, segTree.st[x].minIndex)
		return res, resInd
	}
	mid := (segTree.st[x].l + segTree.st[x].r) >> 1
	if mid >= l {
		sonRes, sonInd := segTree.Query(x<<1, l, r)
		res, resInd = updateRes(res, resInd, sonRes, sonInd)
	}
	if mid < r {
		sonRes, sonInd := segTree.Query(x<<1|1, l, r)
		res, resInd = updateRes(res, resInd, sonRes, sonInd)
	}
	return res, resInd
}

type Graph struct {
	nodeSize Int
	edges    []Edge
	head     []Int
	dis      []Int
	vis      []bool
	nCnt     Int
	ans      []Int
}

type Edge struct {
	u, v, c, indices, next Int
}

func NewGraph(nodeSize Int) *Graph {
	return &Graph{
		nodeSize: nodeSize,
		edges:    make([]Edge, (2e5+10)<<2),
		head:     make([]Int, nodeSize+100),
		dis:      make([]Int, nodeSize+100),
		vis:      make([]bool, nodeSize+100),
		nCnt:     L1,
		ans:      make([]Int, nodeSize),
	}
}

func (g *Graph) addEdge(u Int, v Int, cost Int, indices Int) {
	g.nCnt++
	g.edges[g.nCnt] = Edge{u, v, cost, indices, g.head[u]}
	g.head[u] = g.nCnt
}

func (g *Graph) Dijkstra(begin Int) {
	for i := L1; i <= g.nodeSize; i++ {
		g.dis[i] = math.MaxInt64
	}
	pq := make(PriorityQueue, 0)
	heap.Init(&pq)

	g.dis[begin] = 0
	heap.Push(&pq, &Item{begin, 0, -1, -1})

	id := L0

	for len(pq) > 0 {
		it := heap.Pop(&pq).(*Item)
		u := it.value
		if g.vis[u] {
			continue
		}
		g.vis[u] = true

		if it.indices != -1 && id < g.nodeSize-1 {
			g.ans[id] = it.indices
			id++
		}

		for i := g.head[u]; i != 0; i = g.edges[i].next {
			v := g.edges[i].v
			if g.dis[v] > g.dis[u]+g.edges[i].c {
				g.dis[v] = g.dis[u] + g.edges[i].c

				heap.Push(&pq, &Item{v, g.dis[v], g.edges[i].indices, -1})
			}
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)
var wrtr = bufio.NewWriterSize(os.Stdout, 10_000_000)
var rdr = bufio.NewScanner(os.Stdin)
func gs() string  { rdr.Scan(); return rdr.Text() }
func gi() int     { i,e := strconv.Atoi(gs()); if e != nil {panic(e)}; return i }
func gi2() (int,int) { return gi(),gi() }
func gi3() (int,int,int) { return gi(),gi(),gi() }
func gi4() (int,int,int,int) { return gi(),gi(),gi(),gi() }
func gis(n int) []int  { res := make([]int,n); for i:=0;i<n;i++ { res[i] = gi() }; return res }
func gf() float64 { f,e := strconv.ParseFloat(gs(),64); if e != nil {panic(e)}; return f }
func gbs() []byte { return []byte(gs()) }
func gfs(n int) []float64  { res := make([]float64,n); for i:=0;i<n;i++ { res[i] = gf() }; return res }
func gss(n int) []string  { res := make([]string,n); for i:=0;i<n;i++ { res[i] = gs() }; return res }
func ia(m int) []int { return make([]int,m) }
func iai(m int,v int) []int { a := make([]int,m); for i:=0;i<m;i++ { a[i] = v }; return a }
func twodi(n int,m int,v int) [][]int {
	r := make([][]int,n); for i:=0;i<n;i++ { x := make([]int,m); for j:=0;j<m;j++ { x[j] = v }; r[i] = x }; return r
}
func fill2(m int) ([]int,[]int) { a,b := ia(m),ia(m); for i:=0;i<m;i++ {a[i],b[i] = gi(),gi()}; return a,b }
func fill3(m int) ([]int,[]int,[]int) { a,b,c := ia(m),ia(m),ia(m); for i:=0;i<m;i++ {a[i],b[i],c[i] = gi(),gi(),gi()}; return a,b,c }
func fill4(m int) ([]int,[]int,[]int,[]int) { a,b,c,d := ia(m),ia(m),ia(m),ia(m); for i:=0;i<m;i++ {a[i],b[i],c[i],d[i] = gi(),gi(),gi(),gi()}; return a,b,c,d }
func abs(a int) int { if a < 0 { return -a }; return a }
func rev(a []int) { i,j := 0,len(a)-1; for i < j { a[i],a[j] = a[j],a[i]; i++; j-- } }
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 tern(cond bool, a int, b int) int { if cond { return a }; return b }
func terns(cond bool, a string, b string) string { if cond { return a }; return b }
func maxarr(a []int) int { ans := a[0]; for _,aa := range(a) { if aa > ans { ans = aa } }; return ans }
func minarr(a []int) int { ans := a[0]; for _,aa := range(a) { if aa < ans { ans = aa } }; return ans }
func sumarr(a []int) int { ans := 0; for _,aa := range(a) { ans += aa }; return ans }
func zeroarr(a []int) { for i:=0; i<len(a); i++ { a[i] = 0 } }
func powmod(a,e,mod int) int { res, m := 1, a; for e > 0 { if e&1 != 0 { res = res * m % mod }; m = m * m % mod; e >>= 1 }; return res }
func powint(a,e int) int { res, m := 1, a; for e > 0 { if e&1 != 0 { res = res * m }; m = m * m; e >>= 1 }; return res }
func gcd(a,b int) int { for b != 0 { t:=b; b=a%b; a=t }; return a }
func gcdExtended(a,b int) (int,int,int) { if a == 0 { return b,0,1 }; gcd,x1,y1 := gcdExtended(b%a,a); return gcd, y1-(b/a)*x1,x1 }
func modinv(a,m int) (int,bool) { g,x,_ := gcdExtended(a,m); if g != 1 { return 0,false }; return (x % m + m) % m,true  }
func makefact(n int,mod int) ([]int,[]int) {
	fact,factinv := make([]int,n+1),make([]int,n+1)
	fact[0] = 1; for i:=1;i<=n;i++ { fact[i] = fact[i-1] * i % mod }
	factinv[n] = powmod(fact[n],mod-2,mod); for i:=n-1;i>=0;i-- { factinv[i] = factinv[i+1] * (i+1) % mod }
	return fact,factinv
}
func vecintstring(a []int) string { astr := make([]string,len(a)); for i,a := range a { astr[i] = strconv.Itoa(a) }; return strings.Join(astr," ") }
func main() {
	//f1, _ := os.Create("cpu.prof"); pprof.StartCPUProfile(f1); defer pprof.StopCPUProfile()
	defer wrtr.Flush()
	infn := ""; if infn == "" && len(os.Args) > 1 {	infn = os.Args[1] }
	if infn != "" {	f, e := os.Open(infn); if e != nil { panic(e) }; rdr = bufio.NewScanner(f) }
	rdr.Split(bufio.ScanWords); rdr.Buffer(make([]byte,1024),1_000_000_000)
	// PROGRAM STARTS HERE
	T := gi()
	for tt:=1;tt<=T;tt++ {
		N := gi(); S := gis(N)
		good := true; next := 1; idx := 0; P := ia(N)
		for idx < N {
			s := S[idx]
			idx2 := idx; for idx2+1<N && S[idx2+1] == s { idx2++ }
			if idx2 == idx { good = false; break }
			P[idx2] = next; next++
			for i:=idx;i<idx2;i++ { P[i] = next; next++ }
			idx = idx2+1
		}
		if !good { fmt.Fprintln(wrtr,-1) } else { fmt.Fprintln(wrtr,vecintstring(P)) }
	}
}

package main

import (
	"bufio"
	"container/heap"
	"fmt"
	"os"
)

///////// red black tree //////////////

type Comparator func(a, b interface{}) int

type color bool

const (
	black, red color = true, false
)

type RBTree struct {
	Root       *RBNode
	size       int
	Comparator Comparator
}

type RBNode struct {
	Key    interface{}
	Value  interface{}
	color  color
	Left   *RBNode
	Right  *RBNode
	Parent *RBNode
}

func NewRBTree(comparator Comparator) *RBTree {
	return &RBTree{Comparator: comparator}
}

func (tree *RBTree) Put(key interface{}, value interface{}) {
	var insertedRBNode *RBNode
	if tree.Root == nil {
		tree.Comparator(key, key)
		tree.Root = &RBNode{Key: key, Value: value, color: red}
		insertedRBNode = tree.Root
	} else {
		node := tree.Root
		loop := true
		for loop {
			compare := tree.Comparator(key, node.Key)
			switch {
			case compare == 0:
				node.Key = key
				node.Value = value
				return
			case compare < 0:
				if node.Left == nil {
					node.Left = &RBNode{Key: key, Value: value, color: red}
					insertedRBNode = node.Left
					loop = false
				} else {
					node = node.Left
				}
			case compare > 0:
				if node.Right == nil {
					node.Right = &RBNode{Key: key, Value: value, color: red}
					insertedRBNode = node.Right
					loop = false
				} else {
					node = node.Right
				}
			}
		}
		insertedRBNode.Parent = node
	}
	tree.insertCase1(insertedRBNode)
	tree.size++
}

func (tree *RBTree) Begin() *RBNode {
	if tree.Root == nil {
		return nil
	}

	node := tree.Root
	for node.Left != nil {
		node = node.Left
	}
	return node
}

func (tree *RBTree) Last() *RBNode {
	if tree.Root == nil {
		return nil
	}

	node := tree.Root
	for node.Right != nil {
		node = node.Right
	}
	return node
}

func (tree *RBTree) Get(key interface{}) (value interface{}, found bool) {
	node := tree.lookup(key)
	if node != nil {
		return node.Value, true
	}
	return nil, false
}

func (tree *RBTree) GetRBNode(key interface{}) *RBNode {
	return tree.lookup(key)
}

func (tree *RBTree) Remove(key interface{}) {
	var child *RBNode
	node := tree.lookup(key)
	if node == nil {
		return
	}
	if node.Left != nil && node.Right != nil {
		pred := node.Left.maximumRBNode()
		node.Key = pred.Key
		node.Value = pred.Value
		node = pred
	}
	if node.Left == nil || node.Right == nil {
		if node.Right == nil {
			child = node.Left
		} else {
			child = node.Right
		}
		if node.color == black {
			node.color = nodeColor(child)
			tree.deleteCase1(node)
		}
		tree.replaceRBNode(node, child)
		if node.Parent == nil && child != nil {
			child.color = black
		}
	}
	tree.size--
}

func (tree *RBTree) Empty() bool {
	return tree.size == 0
}

func (tree *RBTree) Size() int {
	return tree.size
}

func (node *RBNode) Size() int {
	if node == nil {
		return 0
	}
	size := 1
	if node.Left != nil {
		size += node.Left.Size()
	}
	if node.Right != nil {
		size += node.Right.Size()
	}
	return size
}

func (tree *RBTree) Keys() []interface{} {
	keys := []interface{}{}
	var dfs func(node *RBNode)
	dfs = func(node *RBNode) {
		if node == nil {
			return
		}
		dfs(node.Left)
		keys = append(keys, node.Key)
		dfs(node.Right)
	}

	dfs(tree.Root)
	return keys
}

func (tree *RBTree) Values() []interface{} {
	values := []interface{}{}
	var dfs func(node *RBNode)
	dfs = func(node *RBNode) {
		if node == nil {
			return
		}
		dfs(node.Left)
		values = append(values, node.Value)
		dfs(node.Right)
	}

	dfs(tree.Root)
	return values
}

func (tree *RBTree) Left() *RBNode {
	var parent *RBNode
	current := tree.Root
	for current != nil {
		parent = current
		current = current.Left
	}
	return parent
}

func (tree *RBTree) Right() *RBNode {
	var parent *RBNode
	current := tree.Root
	for current != nil {
		parent = current
		current = current.Right
	}
	return parent
}

func (tree *RBTree) Floor(key interface{}) (floor *RBNode, found bool) {
	found = false
	node := tree.Root
	for node != nil {
		compare := tree.Comparator(key, node.Key)
		switch {
		case compare == 0:
			return node, true
		case compare < 0:
			node = node.Left
		case compare > 0:
			floor, found = node, true
			node = node.Right
		}
	}
	if found {
		return floor, true
	}
	return nil, false
}

func (tree *RBTree) Ceiling(key interface{}) (ceiling *RBNode, found bool) {
	found = false
	node := tree.Root
	for node != nil {
		compare := tree.Comparator(key, node.Key)
		switch {
		case compare == 0:
			return node, true
		case compare < 0:
			ceiling, found = node, true
			node = node.Left
		case compare > 0:
			node = node.Right
		}
	}
	if found {
		return ceiling, true
	}
	return nil, false
}

func (tree *RBTree) Clear() {
	tree.Root = nil
	tree.size = 0
}

func (tree *RBTree) String() string {
	str := "RedBlackRBTree\n"
	if !tree.Empty() {
		output(tree.Root, "", true, &str)
	}
	return str
}

func (node *RBNode) String() string {
	return fmt.Sprintf("%v", node.Key)
}

func output(node *RBNode, prefix string, isTail bool, str *string) {
	if node.Right != nil {
		newPrefix := prefix
		if isTail {
			newPrefix += "│   "
		} else {
			newPrefix += "    "
		}
		output(node.Right, newPrefix, false, str)
	}
	*str += prefix
	if isTail {
		*str += "└── "
	} else {
		*str += "┌── "
	}
	*str += node.String() + "\n"
	if node.Left != nil {
		newPrefix := prefix
		if isTail {
			newPrefix += "    "
		} else {
			newPrefix += "│   "
		}
		output(node.Left, newPrefix, true, str)
	}
}

func (tree *RBTree) lookup(key interface{}) *RBNode {
	node := tree.Root
	for node != nil {
		compare := tree.Comparator(key, node.Key)
		switch {
		case compare == 0:
			return node
		case compare < 0:
			node = node.Left
		case compare > 0:
			node = node.Right
		}
	}
	return nil
}

func (node *RBNode) grandparent() *RBNode {
	if node != nil && node.Parent != nil {
		return node.Parent.Parent
	}
	return nil
}

func (node *RBNode) uncle() *RBNode {
	if node == nil || node.Parent == nil || node.Parent.Parent == nil {
		return nil
	}
	return node.Parent.sibling()
}

func (node *RBNode) sibling() *RBNode {
	if node == nil || node.Parent == nil {
		return nil
	}
	if node == node.Parent.Left {
		return node.Parent.Right
	}
	return node.Parent.Left
}

func (tree *RBTree) rotateLeft(node *RBNode) {
	right := node.Right
	tree.replaceRBNode(node, right)
	node.Right = right.Left
	if right.Left != nil {
		right.Left.Parent = node
	}
	right.Left = node
	node.Parent = right
}

func (tree *RBTree) rotateRight(node *RBNode) {
	left := node.Left
	tree.replaceRBNode(node, left)
	node.Left = left.Right
	if left.Right != nil {
		left.Right.Parent = node
	}
	left.Right = node
	node.Parent = left
}

func (tree *RBTree) replaceRBNode(old *RBNode, new *RBNode) {
	if old.Parent == nil {
		tree.Root = new
	} else {
		if old == old.Parent.Left {
			old.Parent.Left = new
		} else {
			old.Parent.Right = new
		}
	}
	if new != nil {
		new.Parent = old.Parent
	}
}

func (tree *RBTree) insertCase1(node *RBNode) {
	if node.Parent == nil {
		node.color = black
	} else {
		tree.insertCase2(node)
	}
}

func (tree *RBTree) insertCase2(node *RBNode) {
	if nodeColor(node.Parent) == black {
		return
	}
	tree.insertCase3(node)
}

func (tree *RBTree) insertCase3(node *RBNode) {
	uncle := node.uncle()
	if nodeColor(uncle) == red {
		node.Parent.color = black
		uncle.color = black
		node.grandparent().color = red
		tree.insertCase1(node.grandparent())
	} else {
		tree.insertCase4(node)
	}
}

func (tree *RBTree) insertCase4(node *RBNode) {
	grandparent := node.grandparent()
	if node == node.Parent.Right && node.Parent == grandparent.Left {
		tree.rotateLeft(node.Parent)
		node = node.Left
	} else if node == node.Parent.Left && node.Parent == grandparent.Right {
		tree.rotateRight(node.Parent)
		node = node.Right
	}
	tree.insertCase5(node)
}

func (tree *RBTree) insertCase5(node *RBNode) {
	node.Parent.color = black
	grandparent := node.grandparent()
	grandparent.color = red
	if node == node.Parent.Left && node.Parent == grandparent.Left {
		tree.rotateRight(grandparent)
	} else if node == node.Parent.Right && node.Parent == grandparent.Right {
		tree.rotateLeft(grandparent)
	}
}

func (node *RBNode) maximumRBNode() *RBNode {
	if node == nil {
		return nil
	}
	for node.Right != nil {
		node = node.Right
	}
	return node
}

func (tree *RBTree) deleteCase1(node *RBNode) {
	if node.Parent == nil {
		return
	}
	tree.deleteCase2(node)
}

func (tree *RBTree) deleteCase2(node *RBNode) {
	sibling := node.sibling()
	if nodeColor(sibling) == red {
		node.Parent.color = red
		sibling.color = black
		if node == node.Parent.Left {
			tree.rotateLeft(node.Parent)
		} else {
			tree.rotateRight(node.Parent)
		}
	}
	tree.deleteCase3(node)
}

func (tree *RBTree) deleteCase3(node *RBNode) {
	sibling := node.sibling()
	if nodeColor(node.Parent) == black &&
		nodeColor(sibling) == black &&
		nodeColor(sibling.Left) == black &&
		nodeColor(sibling.Right) == black {
		sibling.color = red
		tree.deleteCase1(node.Parent)
	} else {
		tree.deleteCase4(node)
	}
}

func (tree *RBTree) deleteCase4(node *RBNode) {
	sibling := node.sibling()
	if nodeColor(node.Parent) == red &&
		nodeColor(sibling) == black &&
		nodeColor(sibling.Left) == black &&
		nodeColor(sibling.Right) == black {
		sibling.color = red
		node.Parent.color = black
	} else {
		tree.deleteCase5(node)
	}
}

func (tree *RBTree) deleteCase5(node *RBNode) {
	sibling := node.sibling()
	if node == node.Parent.Left &&
		nodeColor(sibling) == black &&
		nodeColor(sibling.Left) == red &&
		nodeColor(sibling.Right) == black {
		sibling.color = red
		sibling.Left.color = black
		tree.rotateRight(sibling)
	} else if node == node.Parent.Right &&
		nodeColor(sibling) == black &&
		nodeColor(sibling.Right) == red &&
		nodeColor(sibling.Left) == black {
		sibling.color = red
		sibling.Right.color = black
		tree.rotateLeft(sibling)
	}
	tree.deleteCase6(node)
}

func (tree *RBTree) deleteCase6(node *RBNode) {
	sibling := node.sibling()
	sibling.color = nodeColor(node.Parent)
	node.Parent.color = black
	if node == node.Parent.Left && nodeColor(sibling.Right) == red {
		sibling.Right.color = black
		tree.rotateLeft(node.Parent)
	} else if nodeColor(sibling.Left) == red {
		sibling.Left.color = black
		tree.rotateRight(node.Parent)
	}
}

func nodeColor(node *RBNode) color {
	if node == nil {
		return black
	}
	return node.color
}

///////// priority queue ///////////

type PriorityQueue struct {
	Data       []interface{}
	Comparator func(a, b interface{}) int
}

func NewPriorityQueue(comparator func(a, b interface{}) int) *PriorityQueue {
	res := &PriorityQueue{
		Data:       []interface{}{},
		Comparator: comparator,
	}
	heap.Init(res)
	return res
}

func (pq *PriorityQueue) Len() int {
	return len(pq.Data)
}

func (pq *PriorityQueue) Less(i, j int) bool {
	return pq.Comparator(pq.Data[i], pq.Data[j]) < 0
}

func (pq *PriorityQueue) Swap(i, j int) {
	pq.Data[i], pq.Data[j] = pq.Data[j], pq.Data[i]
}

func (pq *PriorityQueue) Push(a interface{}) {
	pq.Data = append(pq.Data, a)
}

func (pq *PriorityQueue) Pop() interface{} {
	n := len(pq.Data)
	res := pq.Data[n-1]
	pq.Data = pq.Data[0 : n-1]
	return res
}

func (pq *PriorityQueue) Put(a interface{}) {
	heap.Push(pq, a)
}

func (pq *PriorityQueue) Get() interface{} {
	return heap.Pop(pq)
}

////////////////////////////////////

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

var T, N int
var mp map[int][]int

func solve() (flag bool, res []int) {
	flag = true
	res = make([]int, N)
	for _, vs := range mp {
		if len(vs) == 1 {
			flag = false
			return
		}

		n := len(vs)
		for i := 0; i < n; i++ {
			a, b := vs[i], vs[(i+1)%n]
			res[a] = b
		}
	}
	return
}

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

	fmt.Fscan(in, &T)

	for tt := 1; tt <= T; tt++ {
		fmt.Fscan(in, &N)
		var s int
		mp = map[int][]int{}
		for i := 0; i < N; i++ {
			fmt.Fscan(in, &s)
			if _, ok := mp[s]; !ok {
				mp[s] = []int{}
			}
			mp[s] = append(mp[s], i)
		}

		flag, res := solve()
		if !flag {
			fmt.Println(-1)
		} else {
			for _, v := range res {
				fmt.Printf("%d ", v+1)
			}
			fmt.Print("\n")
		}

	}

}

// 00
package main

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

type Anything interface {
	int64 | float64 | int | string | float32
}

func write[K Anything](f *bufio.Writer, a K) {
	f.Write([]byte(fmt.Sprint(a)))
}

func main() {
	var T int
	reader := bufio.NewReader(os.Stdin)
	f := bufio.NewWriter(os.Stdout)
	defer f.Flush()
	fmt.Fscan(reader, &T)
	for t := 1; t <= T; t++ {
		var n int
		fmt.Fscan(reader, &n)
		s := make([]int, n)
		m := make(map[int]int)
		for i := 0; i < n; i++ {
			fmt.Fscan(reader, &s[i])
			m[s[i]]++
		}
		if t == 28 {
			fmt.Println(n, s)
		}
		ok := true
		for _, v := range m {
			if v == 1 {
				ok = false
				break
			}
		}
		if ok {
			start := 1
			for _, v := range m {
				write(f, start+v-1)
				write(f, " ")
				for k := start; k < start+v-1; k++ {
					write(f, k)
					write(f, " ")
				}
				start += v
			}
			// print line
			write(f, "\n")

		} else {
			write(f, -1)
			write(f, "\n")
		}
	}
}

// 00
package main

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

type Anything interface {
	int64 | float64 | int | string | float32
}

func write[K Anything](f *bufio.Writer, a K) {
	f.Write([]byte(fmt.Sprint(a)))
}

func main() {
	var T int
	reader := bufio.NewReader(os.Stdin)
	f := bufio.NewWriter(os.Stdout)
	defer f.Flush()
	fmt.Fscan(reader, &T)
	for t := 1; t <= T; t++ {
		var n int
		fmt.Fscan(reader, &n)
		s := make([]int, n)
		m := make(map[int]int)
		for i := 0; i < n; i++ {
			fmt.Fscan(reader, &s[i])
			m[s[i]]++
		}
		ok := true
		for _, v := range m {
			if v == 1 {
				ok = false
				break
			}
		}
		if ok {
			start := 1
			for _, v := range m {
				write(f, start+v-1)
				write(f, " ")
				for k := start; k < start+v-1; k++ {
					write(f, k)
					write(f, " ")
				}
				start += v
			}
			// print line
			write(f, "\n")

		} else {
			write(f, -1)
			write(f, "\n")
		}
	}
}

// 00
package main

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

type Anything interface {
	int64 | float64 | int | string | float32
}

func write[K Anything](f *bufio.Writer, a K) {
	f.Write([]byte(fmt.Sprint(a)))
}

func main() {
	var T int
	reader := bufio.NewReader(os.Stdin)
	f := bufio.NewWriter(os.Stdout)
	defer f.Flush()
	fmt.Fscan(reader, &T)
	for t := 1; t <= T; t++ {
		var n int
		fmt.Fscan(reader, &n)
		s := make([]int, n)
		m := make(map[int]int)
		for i := 0; i < n; i++ {
			fmt.Fscan(reader, &s[i])
			m[s[i]]++
		}
		ok := true
		for _, v := range m {
			if v == 1 {
				ok = false
				break
			}
		}
		if ok {
			start := 1
			for _, v := range m {
				write(f, start+v-1)
				write(f, " ")
				for k := start; k < start+v-1; k++ {
					write(f, k)
					write(f, " ")
				}
				start += v
			}
			write(f, "\n")

		} else {
			write(f, -1)
			write(f, "\n")
		}
	}
}

package main

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

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

	var testCases int
	Fscan(in, &testCases)

	for c := 0; c < testCases; c++ {
		var n int
		Fscan(in, &n)

		nums := make([]Pair, n)
		for i := 1; i <= n; i++ {
			Fscan(in, &nums[i-1].shoe)
			nums[i-1].idx = i
		}

		res := solve(nums)
		if res == nil {
			Fprintln(out, -1)
			return
		}

		for i := 0; i < n; i++ {
			Fprint(out, res[i])
			if i < n {
				Fprint(out, " ")
			}
		}
		Fprintln(out)
	}

}

type Pair struct {
	idx  int
	shoe int
}

func solve(nums []Pair) []int {
	sort.Slice(nums, func(i, j int) bool {
		if nums[i].shoe == nums[j].shoe {
			return nums[i].idx < nums[j].idx
		}
		return nums[i].shoe < nums[j].shoe
	})

	n := len(nums)
	res := make([]int, n)

	for i := n - 1; i >= 0; {
		j := i - 1
		for ; j >= 0; j-- {
			if nums[j].shoe != nums[i].shoe {
				break
			}
		}

		if j+1 >= i {
			return nil
		}

		l := j + 1
		r := i
		if (r-l+1)%2 == 1 {
			res[l] = nums[r].idx
			nums[r].idx = nums[l].idx
			nums[r].shoe = nums[l].shoe
			l++
		}
		for l <= r {
			res[l] = nums[r].idx
			res[r] = nums[l].idx
			l++
			r--
		}
		i = j
	}
	return res
}

package main

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

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

	var testCases int
	Fscan(in, &testCases)

	for c := 0; c < testCases; c++ {
		var n int
		Fscan(in, &n)

		nums := make([]Pair, n)
		for i := 1; i <= n; i++ {
			Fscan(in, &nums[i-1].shoe)
			nums[i-1].idx = i
		}

		res := solve(nums)
		if res == nil {
			Fprintln(out, -1)
			return
		}

		for i := 0; i < n; i++ {
			Fprint(out, res[i])
			if i < n {
				Fprint(out, " ")
			}
		}
		Fprintln(out)
	}

}

type Pair struct {
	idx  int
	shoe int
}

func solve(nums []Pair) []int {
	sort.Slice(nums, func(i, j int) bool {
		if nums[i].shoe == nums[j].shoe {
			return nums[i].idx < nums[j].idx
		}
		return nums[i].shoe < nums[j].shoe
	})

	n := len(nums)
	res := make([]int, n)

	for i := n - 1; i >= 0; {
		j := i - 1
		for ; j >= 0; j-- {
			if nums[j].shoe != nums[i].shoe {
				break
			}
		}

		if j+1 >= i {
			return nil
		}

		l := j + 1
		r := i
		for l <= i {
			res[l] = nums[r].idx
			res[r] = nums[l].idx
			l++
			r--
		}
		i = j
	}
	return res
}

package main

import (
	"bufio"
	"container/heap"
	. "fmt"
	"math"
	"os"
)

type Int int64

const (
	INF = 3e5 + 10
	L0  = Int(0)
	L1  = Int(1)
)

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

	var T int
	Fscan(in, &T)

	for tt := 0; tt < T; tt++ {
		var n int
		Fscan(in, &n)

		a := make([]int, n)
		ans := make([]int, n)

		for i := 0; i < n; i++ {
			Fscan(in, &a[i])
		}

		if n == 1 {
			Fprintln(out, -1)
			continue
		}

		flag := true

		last := a[0]
		first := 0
		p := 0
		cnt := 1
		for i := 1; i < n; i++ {
			if a[i] == last {
				ans[i] = p
				p = i
				cnt++
				if i == n-1 {
					ans[first] = i
				}
			} else {
				if cnt == 1 {
					flag = false
					break
				}
				ans[first] = i - 1
				last = a[i]
				p = i
				first = i
				cnt = 1
			}
		}
		if !flag {
			Fprintln(out, -1)
		} else {
			for i := 0; i < n; i++ {
				Fprint(out, ans[i]+1, " ")
			}
			Fprintln(out, "")
		}
	}

}

func MakeGrid(h, w int) [][]Int {
	index := make([][]Int, h)
	data := make([]Int, h*w)
	for i := 0; i < h; i++ {
		index[i] = data[i*w : (i+1)*w]
	}
	return index
}

func Abs(x Int) Int {
	if x > 0 {
		return x
	}
	return -x
}

func Min(nums ...Int) Int {
	return nums[MinIdx(nums...)]
}

func MinIdx(nums ...Int) Int {
	maxNumIdx := L0
	for i, num := range nums {
		if num < nums[maxNumIdx] {
			maxNumIdx = Int(i)
		}
	}
	return maxNumIdx
}

func Max(nums ...Int) Int {
	return nums[MaxIdx(nums...)]
}

func MaxIdx(nums ...Int) Int {
	maxNumIdx := L0
	for i, num := range nums {
		if num > nums[maxNumIdx] {
			maxNumIdx = Int(i)
		}
	}
	return maxNumIdx
}

var (
	mod  Int
	fmod func(Int) Int = doNothing
)

// SetMod sets the mod. It must be called first.
func SetMod(newMod Int) {
	mod = newMod
	fmod = dynamicMod
}

func dynamicMod(m Int) Int {
	m %= mod
	if m < 0 {
		return m + mod
	}
	return m
}

func doNothing(m Int) Int {
	return m
}

// Mod returns m % mod.
func (m Int) Mod() Int {
	return fmod(m)
}

// Inv returns modular multiplicative inverse
func (m Int) Inv() Int {
	return m.Pow(Int(0).Sub(2))
}

// Pow returns m^n
func (m Int) Pow(n Int) Int {
	p := Int(1)
	for n > 0 {
		if n&1 == 1 {
			p.MulAs(m)
		}
		m.MulAs(m)
		n >>= 1
	}
	return p
}

// Add returns m+x
func (m Int) Add(x Int) Int {
	return (m + x).Mod()
}

// Sub returns m-x
func (m Int) Sub(x Int) Int {
	return (m - x).Mod()
}

// Mul returns m*x
func (m Int) Mul(x Int) Int {
	return (m * x).Mod()
}

// Div returns m/x
func (m Int) Div(x Int) Int {
	return m.Mul(x.Inv())
}

// AddAs assigns *m + x to *m and returns m
func (m *Int) AddAs(x Int) *Int {
	*m = m.Add(x)
	return m
}

// SubAs assigns *m - x to *m and returns m
func (m *Int) SubAs(x Int) *Int {
	*m = m.Sub(x)
	return m
}

// MulAs assigns *m * x to *m and returns m
func (m *Int) MulAs(x Int) *Int {
	*m = m.Mul(x)
	return m
}

// DivAs assigns *m / x to *m and returns m
func (m *Int) DivAs(x Int) *Int {
	*m = m.Div(x)
	return m
}

func (m *Int) MaxAs(x ...Int) *Int {
	*m = Max(append(x, *m)...)
	return m
}

func (m *Int) MinAs(x ...Int) *Int {
	*m = Min(append(x, *m)...)
	return m
}

type Void struct{}

var void Void

type HashSet struct {
	ma map[Int]Void
}

func NewHashSet() *HashSet {
	return &HashSet{
		ma: make(map[Int]Void),
	}
}

func (s *HashSet) add(x Int) bool {
	_, exists := s.ma[x]
	if !exists {
		s.ma[x] = void
		return true
	} else {
		return false
	}
}

func (s *HashSet) del(x Int) {
	delete(s.ma, x)
}

func (s *HashSet) exist(x Int) bool {
	_, exists := s.ma[x]
	return exists
}

// An Item is something we manage in a priority queue.
type Item struct {
	value    Int // The value of the item; arbitrary.
	priority Int // The priority of the item in the queue.
	indices  Int
	// The index is needed by update and is maintained by the heap.Interface methods.
	index int // The index of the item in the heap.
}

// A PriorityQueue implements heap.Interface and holds Items.
type PriorityQueue []*Item

func NewItem(value, priority Int) *Item {
	return &Item{
		value:    value,
		priority: priority,
		index:    -1,
	}

}

func (pq PriorityQueue) Len() int { return len(pq) }

func (pq PriorityQueue) Less(i, j int) bool {
	// We want Pop to give us the highest, not lowest, priority so we use greater than here.
	return pq[i].priority < pq[j].priority
}

func (pq PriorityQueue) Swap(i, j int) {
	pq[i], pq[j] = pq[j], pq[i]
	pq[i].index = i
	pq[j].index = j
}

func (pq *PriorityQueue) Push(x interface{}) {
	n := len(*pq)
	item := x.(*Item)
	item.index = n
	*pq = append(*pq, item)
}

func (pq *PriorityQueue) Pop() interface{} {
	old := *pq
	n := len(old)
	item := old[n-1]
	old[n-1] = nil  // avoid memory leak
	item.index = -1 // for safety
	*pq = old[0 : n-1]
	return item
}

// update modifies the priority and value of an Item in the queue.
func (pq *PriorityQueue) update(item *Item, value Int, priority Int) {
	item.value = value
	item.priority = priority
	heap.Fix(pq, item.index)
}

type SegTree struct {
	st []Segment
}

type Segment struct {
	l, r, val, add, minIndex Int
}

func newSegTree(n Int) SegTree {
	segTree := SegTree{make([]Segment, n<<2)}
	segTree.Build(1, 1, n)
	return segTree
}

func (segTree SegTree) Build(x, l, r Int) {
	segTree.st[x].l = l
	segTree.st[x].r = r
	if l == r {
		segTree.st[x].minIndex = l
		return
	}
	mid := (l + r) >> 1
	segTree.Build(x<<1, l, mid)
	segTree.Build(x<<1|1, mid+1, r)
}

func (segTree SegTree) push(x Int) {
	if segTree.st[x].add != 0 {
		segTree.modifyOne(x<<1, segTree.st[x].add)
		segTree.modifyOne(x<<1|1, segTree.st[x].add)
		segTree.st[x].add = 0
	}
}

func (segTree SegTree) update(x Int) {
	if segTree.st[x<<1].val < segTree.st[x<<1|1].val {
		segTree.st[x].val = segTree.st[x<<1].val
		segTree.st[x].minIndex = segTree.st[x<<1].minIndex
	} else {
		segTree.st[x].val = segTree.st[x<<1|1].val
		segTree.st[x].minIndex = segTree.st[x<<1|1].minIndex
	}
}

func (segTree SegTree) modifyOne(x, add Int) {
	segTree.st[x].val += add
	if segTree.st[x].l != segTree.st[x].r {
		segTree.st[x].add += add
	}
}

func (segTree SegTree) Modify(x, l, r, add Int) {
	if segTree.st[x].l >= l && segTree.st[x].r <= r {
		segTree.modifyOne(x, add)
		return
	}
	segTree.push(x)
	mid := (segTree.st[x].l + segTree.st[x].r) >> 1
	if mid >= l {
		segTree.Modify(x<<1, l, r, add)
	}
	if mid < r {
		segTree.Modify(x<<1|1, l, r, add)
	}
	segTree.update(x)
}

func updateRes(cRes, cIndex, res, index Int) (Int, Int) {
	if cRes > res {
		return res, index
	}
	return cRes, cIndex
}

func (segTree SegTree) Query(x, l, r Int) (Int, Int) {
	res := Int(math.MaxInt64)
	resInd := -L1
	if segTree.st[x].l >= l && segTree.st[x].r <= r {
		res, resInd = updateRes(res, resInd, segTree.st[x].val, segTree.st[x].minIndex)
		return res, resInd
	}
	mid := (segTree.st[x].l + segTree.st[x].r) >> 1
	if mid >= l {
		sonRes, sonInd := segTree.Query(x<<1, l, r)
		res, resInd = updateRes(res, resInd, sonRes, sonInd)
	}
	if mid < r {
		sonRes, sonInd := segTree.Query(x<<1|1, l, r)
		res, resInd = updateRes(res, resInd, sonRes, sonInd)
	}
	return res, resInd
}

type Graph struct {
	nodeSize Int
	edges    []Edge
	head     []Int
	dis      []Int
	vis      []bool
	nCnt     Int
	ans      []Int
}

type Edge struct {
	u, v, c, indices, next Int
}

func NewGraph(nodeSize Int) *Graph {
	return &Graph{
		nodeSize: nodeSize,
		edges:    make([]Edge, (2e5+10)<<2),
		head:     make([]Int, nodeSize+100),
		dis:      make([]Int, nodeSize+100),
		vis:      make([]bool, nodeSize+100),
		nCnt:     L1,
		ans:      make([]Int, nodeSize),
	}
}

func (g *Graph) addEdge(u Int, v Int, cost Int, indices Int) {
	g.nCnt++
	g.edges[g.nCnt] = Edge{u, v, cost, indices, g.head[u]}
	g.head[u] = g.nCnt
}

func (g *Graph) Dijkstra(begin Int) {
	for i := L1; i <= g.nodeSize; i++ {
		g.dis[i] = math.MaxInt64
	}
	pq := make(PriorityQueue, 0)
	heap.Init(&pq)

	g.dis[begin] = 0
	heap.Push(&pq, &Item{begin, 0, -1, -1})

	id := L0

	for len(pq) > 0 {
		it := heap.Pop(&pq).(*Item)
		u := it.value
		if g.vis[u] {
			continue
		}
		g.vis[u] = true

		if it.indices != -1 && id < g.nodeSize-1 {
			g.ans[id] = it.indices
			id++
		}

		for i := g.head[u]; i != 0; i = g.edges[i].next {
			v := g.edges[i].v
			if g.dis[v] > g.dis[u]+g.edges[i].c {
				g.dis[v] = g.dis[u] + g.edges[i].c

				heap.Push(&pq, &Item{v, g.dis[v], g.edges[i].indices, -1})
			}
		}
	}
}

package main

import (
	"bufio"
	"container/heap"
	. "fmt"
	"math"
	"os"
)

type Int int64

const (
	INF = 3e5 + 10
	L0  = Int(0)
	L1  = Int(1)
)

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

	var T int
	Fscan(in, &T)

	for tt := 0; tt < T; tt++ {
		var n int
		Fscan(in, &n)

		a := make([]int, n)
		ans := make([]int, n)

		for i := 0; i < n; i++ {
			Fscan(in, &a[i])
		}

		flag := true

		last := a[0]
		first := 0
		p := 0
		cnt := 1
		for i := 1; i < n; i++ {
			if a[i] == last {
				ans[i] = p
				p = i
				cnt++
				if i == n-1 {
					ans[first] = i
				}
			} else {
				if cnt == 1 {
					flag = false
					break
				}
				ans[first] = i - 1
				last = a[i]
				p = i
				first = i
				cnt = 1
			}
		}
		if !flag {
			Fprintln(out, -1)
		} else {
			for i := 0; i < n; i++ {
				Fprint(out, ans[i]+1, " ")
			}
			Fprintln(out, "")
		}
	}

}

func MakeGrid(h, w int) [][]Int {
	index := make([][]Int, h)
	data := make([]Int, h*w)
	for i := 0; i < h; i++ {
		index[i] = data[i*w : (i+1)*w]
	}
	return index
}

func Abs(x Int) Int {
	if x > 0 {
		return x
	}
	return -x
}

func Min(nums ...Int) Int {
	return nums[MinIdx(nums...)]
}

func MinIdx(nums ...Int) Int {
	maxNumIdx := L0
	for i, num := range nums {
		if num < nums[maxNumIdx] {
			maxNumIdx = Int(i)
		}
	}
	return maxNumIdx
}

func Max(nums ...Int) Int {
	return nums[MaxIdx(nums...)]
}

func MaxIdx(nums ...Int) Int {
	maxNumIdx := L0
	for i, num := range nums {
		if num > nums[maxNumIdx] {
			maxNumIdx = Int(i)
		}
	}
	return maxNumIdx
}

var (
	mod  Int
	fmod func(Int) Int = doNothing
)

// SetMod sets the mod. It must be called first.
func SetMod(newMod Int) {
	mod = newMod
	fmod = dynamicMod
}

func dynamicMod(m Int) Int {
	m %= mod
	if m < 0 {
		return m + mod
	}
	return m
}

func doNothing(m Int) Int {
	return m
}

// Mod returns m % mod.
func (m Int) Mod() Int {
	return fmod(m)
}

// Inv returns modular multiplicative inverse
func (m Int) Inv() Int {
	return m.Pow(Int(0).Sub(2))
}

// Pow returns m^n
func (m Int) Pow(n Int) Int {
	p := Int(1)
	for n > 0 {
		if n&1 == 1 {
			p.MulAs(m)
		}
		m.MulAs(m)
		n >>= 1
	}
	return p
}

// Add returns m+x
func (m Int) Add(x Int) Int {
	return (m + x).Mod()
}

// Sub returns m-x
func (m Int) Sub(x Int) Int {
	return (m - x).Mod()
}

// Mul returns m*x
func (m Int) Mul(x Int) Int {
	return (m * x).Mod()
}

// Div returns m/x
func (m Int) Div(x Int) Int {
	return m.Mul(x.Inv())
}

// AddAs assigns *m + x to *m and returns m
func (m *Int) AddAs(x Int) *Int {
	*m = m.Add(x)
	return m
}

// SubAs assigns *m - x to *m and returns m
func (m *Int) SubAs(x Int) *Int {
	*m = m.Sub(x)
	return m
}

// MulAs assigns *m * x to *m and returns m
func (m *Int) MulAs(x Int) *Int {
	*m = m.Mul(x)
	return m
}

// DivAs assigns *m / x to *m and returns m
func (m *Int) DivAs(x Int) *Int {
	*m = m.Div(x)
	return m
}

func (m *Int) MaxAs(x ...Int) *Int {
	*m = Max(append(x, *m)...)
	return m
}

func (m *Int) MinAs(x ...Int) *Int {
	*m = Min(append(x, *m)...)
	return m
}

type Void struct{}

var void Void

type HashSet struct {
	ma map[Int]Void
}

func NewHashSet() *HashSet {
	return &HashSet{
		ma: make(map[Int]Void),
	}
}

func (s *HashSet) add(x Int) bool {
	_, exists := s.ma[x]
	if !exists {
		s.ma[x] = void
		return true
	} else {
		return false
	}
}

func (s *HashSet) del(x Int) {
	delete(s.ma, x)
}

func (s *HashSet) exist(x Int) bool {
	_, exists := s.ma[x]
	return exists
}

// An Item is something we manage in a priority queue.
type Item struct {
	value    Int // The value of the item; arbitrary.
	priority Int // The priority of the item in the queue.
	indices  Int
	// The index is needed by update and is maintained by the heap.Interface methods.
	index int // The index of the item in the heap.
}

// A PriorityQueue implements heap.Interface and holds Items.
type PriorityQueue []*Item

func NewItem(value, priority Int) *Item {
	return &Item{
		value:    value,
		priority: priority,
		index:    -1,
	}

}

func (pq PriorityQueue) Len() int { return len(pq) }

func (pq PriorityQueue) Less(i, j int) bool {
	// We want Pop to give us the highest, not lowest, priority so we use greater than here.
	return pq[i].priority < pq[j].priority
}

func (pq PriorityQueue) Swap(i, j int) {
	pq[i], pq[j] = pq[j], pq[i]
	pq[i].index = i
	pq[j].index = j
}

func (pq *PriorityQueue) Push(x interface{}) {
	n := len(*pq)
	item := x.(*Item)
	item.index = n
	*pq = append(*pq, item)
}

func (pq *PriorityQueue) Pop() interface{} {
	old := *pq
	n := len(old)
	item := old[n-1]
	old[n-1] = nil  // avoid memory leak
	item.index = -1 // for safety
	*pq = old[0 : n-1]
	return item
}

// update modifies the priority and value of an Item in the queue.
func (pq *PriorityQueue) update(item *Item, value Int, priority Int) {
	item.value = value
	item.priority = priority
	heap.Fix(pq, item.index)
}

type SegTree struct {
	st []Segment
}

type Segment struct {
	l, r, val, add, minIndex Int
}

func newSegTree(n Int) SegTree {
	segTree := SegTree{make([]Segment, n<<2)}
	segTree.Build(1, 1, n)
	return segTree
}

func (segTree SegTree) Build(x, l, r Int) {
	segTree.st[x].l = l
	segTree.st[x].r = r
	if l == r {
		segTree.st[x].minIndex = l
		return
	}
	mid := (l + r) >> 1
	segTree.Build(x<<1, l, mid)
	segTree.Build(x<<1|1, mid+1, r)
}

func (segTree SegTree) push(x Int) {
	if segTree.st[x].add != 0 {
		segTree.modifyOne(x<<1, segTree.st[x].add)
		segTree.modifyOne(x<<1|1, segTree.st[x].add)
		segTree.st[x].add = 0
	}
}

func (segTree SegTree) update(x Int) {
	if segTree.st[x<<1].val < segTree.st[x<<1|1].val {
		segTree.st[x].val = segTree.st[x<<1].val
		segTree.st[x].minIndex = segTree.st[x<<1].minIndex
	} else {
		segTree.st[x].val = segTree.st[x<<1|1].val
		segTree.st[x].minIndex = segTree.st[x<<1|1].minIndex
	}
}

func (segTree SegTree) modifyOne(x, add Int) {
	segTree.st[x].val += add
	if segTree.st[x].l != segTree.st[x].r {
		segTree.st[x].add += add
	}
}

func (segTree SegTree) Modify(x, l, r, add Int) {
	if segTree.st[x].l >= l && segTree.st[x].r <= r {
		segTree.modifyOne(x, add)
		return
	}
	segTree.push(x)
	mid := (segTree.st[x].l + segTree.st[x].r) >> 1
	if mid >= l {
		segTree.Modify(x<<1, l, r, add)
	}
	if mid < r {
		segTree.Modify(x<<1|1, l, r, add)
	}
	segTree.update(x)
}

func updateRes(cRes, cIndex, res, index Int) (Int, Int) {
	if cRes > res {
		return res, index
	}
	return cRes, cIndex
}

func (segTree SegTree) Query(x, l, r Int) (Int, Int) {
	res := Int(math.MaxInt64)
	resInd := -L1
	if segTree.st[x].l >= l && segTree.st[x].r <= r {
		res, resInd = updateRes(res, resInd, segTree.st[x].val, segTree.st[x].minIndex)
		return res, resInd
	}
	mid := (segTree.st[x].l + segTree.st[x].r) >> 1
	if mid >= l {
		sonRes, sonInd := segTree.Query(x<<1, l, r)
		res, resInd = updateRes(res, resInd, sonRes, sonInd)
	}
	if mid < r {
		sonRes, sonInd := segTree.Query(x<<1|1, l, r)
		res, resInd = updateRes(res, resInd, sonRes, sonInd)
	}
	return res, resInd
}

type Graph struct {
	nodeSize Int
	edges    []Edge
	head     []Int
	dis      []Int
	vis      []bool
	nCnt     Int
	ans      []Int
}

type Edge struct {
	u, v, c, indices, next Int
}

func NewGraph(nodeSize Int) *Graph {
	return &Graph{
		nodeSize: nodeSize,
		edges:    make([]Edge, (2e5+10)<<2),
		head:     make([]Int, nodeSize+100),
		dis:      make([]Int, nodeSize+100),
		vis:      make([]bool, nodeSize+100),
		nCnt:     L1,
		ans:      make([]Int, nodeSize),
	}
}

func (g *Graph) addEdge(u Int, v Int, cost Int, indices Int) {
	g.nCnt++
	g.edges[g.nCnt] = Edge{u, v, cost, indices, g.head[u]}
	g.head[u] = g.nCnt
}

func (g *Graph) Dijkstra(begin Int) {
	for i := L1; i <= g.nodeSize; i++ {
		g.dis[i] = math.MaxInt64
	}
	pq := make(PriorityQueue, 0)
	heap.Init(&pq)

	g.dis[begin] = 0
	heap.Push(&pq, &Item{begin, 0, -1, -1})

	id := L0

	for len(pq) > 0 {
		it := heap.Pop(&pq).(*Item)
		u := it.value
		if g.vis[u] {
			continue
		}
		g.vis[u] = true

		if it.indices != -1 && id < g.nodeSize-1 {
			g.ans[id] = it.indices
			id++
		}

		for i := g.head[u]; i != 0; i = g.edges[i].next {
			v := g.edges[i].v
			if g.dis[v] > g.dis[u]+g.edges[i].c {
				g.dis[v] = g.dis[u] + g.edges[i].c

				heap.Push(&pq, &Item{v, g.dis[v], g.edges[i].indices, -1})
			}
		}
	}
}


package main

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

func solve() {
	n := readInt()
	str := readString()
	a := make([]int, 26)
	b := make([]int, 26)
	for i := 0; i < 26; i++ {
		a[i] = readInt()
	}
	r := []rune(str)
	start := 0
	end := 0
	h := NewMinHeap(26)
	maxlen := 0
	tmplen := make([]int, n)
	for end < n && start < n {
		ch := int(r[end] - 'a')
		b[ch]++
		end++
		h.Add(ch, a[ch])
		curlen := end - start
		for end-start > 0 && h.Min() < curlen {
			oldch := int(r[start] - 'a')
			b[oldch]--
			curlen--
			start++
			if b[oldch] == 0 {
				h.Remove(oldch)
			}
		}
		if maxlen < curlen {
			maxlen = curlen
		}
		for i := start; i < end; i++ {
			if tmplen[i] < end {
				tmplen[i] = end
			}
		}
	}
	res := dfs(str, 0, tmplen, 0)
	fmt.Printf("%d\n", res)
	fmt.Printf("%d\n", maxlen)
	fmt.Printf("%d\n", minJumps)
}

var memo = map[int]int{}
var minJumps = 100000

func dfs(str string, pos int, tmplen []int, jumps int) int {
	if prev, ok := memo[pos]; ok {
		return prev
	}
	if pos == len(str) {
		if minJumps > jumps {
			minJumps = jumps
		}
		return 1
	}
	res := 0
	for i := tmplen[pos]; i >= pos+1; i-- {
		if i <= len(str) {
			res += dfs(str, i, tmplen, jumps+1)
			res %= 1000000007
		}
	}
	memo[pos] = res
	return res
}

type MinHeap struct {
	a    []int
	vmap []int
	imap []int
	n    int
	pos  int
}

const INF = math.MaxInt32

func NewMinHeap(m int) *MinHeap {
	heap := &MinHeap{}
	m += 2
	heap.n = m
	heap.a = make([]int, heap.n)
	heap.vmap = make([]int, heap.n)
	heap.imap = make([]int, heap.n)
	heap.pos = 1
	for i := 0; i < heap.n; i++ {
		heap.a[i] = INF
		heap.vmap[i] = -1
		heap.imap[i] = -1
	}
	return heap
}

func (h *MinHeap) Add(ind, x int) int {
	ret := h.imap[ind]
	if h.imap[ind] < 0 {
		h.a[h.pos] = x
		h.vmap[h.pos] = ind
		h.imap[ind] = h.pos
		h.pos++
		h.up(h.pos - 1)
	}
	if ret != -1 {
		return h.a[ret]
	}
	return x
}

func (h *MinHeap) Update(ind, x int) int {
	ret := h.imap[ind]
	if h.imap[ind] < 0 {
		h.a[h.pos] = x
		h.vmap[h.pos] = ind
		h.imap[ind] = h.pos
		h.pos++
		h.up(h.pos - 1)
	} else {
		h.a[ret] = x
		h.up(ret)
		h.down(ret)
	}
	return x
}

func (h *MinHeap) Remove(ind int) int {
	if h.pos == 1 {
		return INF
	}
	if h.imap[ind] == -1 {
		return INF
	}

	h.pos--
	rem := h.imap[ind]
	ret := h.a[rem]
	h.vmap[rem] = h.vmap[h.pos]
	h.imap[h.vmap[h.pos]] = rem
	h.imap[ind] = -1
	h.a[rem] = h.a[h.pos]
	h.a[h.pos] = INF
	h.vmap[h.pos] = -1

	h.up(rem)
	h.down(rem)
	return ret
}

func (h *MinHeap) Min() int {
	return h.a[1]
}

func (h *MinHeap) ArgMin() int {
	return h.vmap[1]
}

func (h *MinHeap) Size() int {
	return h.pos - 1
}

func (h *MinHeap) up(cur int) {
	for c, p := cur, cur>>1; p >= 1 && h.a[p] > h.a[c]; c, p = c>>1, p>>1 {
		h.a[p], h.a[c] = h.a[c], h.a[p]
		h.imap[h.vmap[p]], h.imap[h.vmap[c]] = h.imap[h.vmap[c]], h.imap[h.vmap[p]]
		h.vmap[p], h.vmap[c] = h.vmap[c], h.vmap[p]
	}
}

func (h *MinHeap) down(cur int) {
	for c := cur; 2*c < h.pos; {
		b := 0
		if h.a[2*c] < h.a[2*c+1] {
			b = 2 * c
		} else {
			b = 2*c + 1
		}
		if h.a[b] < h.a[c] {
			h.a[c], h.a[b] = h.a[b], h.a[c]
			h.imap[h.vmap[c]], h.imap[h.vmap[b]] = h.imap[h.vmap[b]], h.imap[h.vmap[c]]
			h.vmap[c], h.vmap[b] = h.vmap[b], h.vmap[c]
			c = b
		} else {
			break
		}
	}
}

var scanner *bufio.Scanner

func main() {
	scanner = bufio.NewScanner(os.Stdin)
	const MaxTokenLength = 1024 * 1024
	scanner.Buffer(make([]byte, 0, MaxTokenLength), MaxTokenLength)
	scanner.Split(bufio.ScanWords)
	solve()
}

// IO

func readString() string {
	scanner.Scan()
	return scanner.Text()
}

func readInt() int {
	val, _ := strconv.Atoi(readString())
	return val
}

func readInt64() int64 {
	v, _ := strconv.ParseInt(readString(), 10, 64)
	return v
}

func readIntArray(sz int) []int {
	a := make([]int, sz)
	for i := 0; i < sz; i++ {
		a[i] = readInt()
	}
	return a
}

func readInt64Array(n int) []int64 {
	res := make([]int64, n)
	for i := 0; i < n; i++ {
		res[i] = readInt64()
	}
	return res
}

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

package main

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

// github.com/EndlessCheng/codeforces-go
func CF766C(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()
	const mod int64 = 1e9 + 7

	var n int
	var s []byte
	Fscan(in, &n, &s)
	for i := range s {
		s[i] -= 'a'
	}
	a := [26]int{}
	for i := range a {
		Fscan(in, &a[i])
	}

	mxLen := 0
	dp := make([]int64, n)
	var f func(int) int64
	f = func(p int) (res int64) {
		if p == n {
			return 1
		}
		if dp[p] > 0 {
			return dp[p]
		}
		defer func() { dp[p] = res }()
		curMx := int(1e9)
		for i := p; i < n; i++ {
			if a[s[i]] < curMx {
				curMx = a[s[i]]
			}
			if i-p+1 > curMx {
				break
			}
			if i-p+1 > mxLen {
				mxLen = i - p + 1
			}
			res = (res + f(i+1)) % mod
		}
		return
	}
	Fprintln(out, f(0))
	Fprintln(out, mxLen)
	num := 0
	for i := 0; i < n; {
		curMx := int(1e9)
		for st := i; i < n; i++ {
			if a[s[i]] < curMx {
				curMx = a[s[i]]
			}
			if i-st+1 > curMx {
				break
			}
		}
		num++
	}
	Fprint(out, num)
}

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

package main

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

var stdReader *bufio.Reader = bufio.NewReader(os.Stdin)

func readInt() (result int) {
	var negative, started bool
READER_LOOP:
	for {
		char, err := stdReader.ReadByte()
		switch {
		case err != nil:
			break READER_LOOP
		case char == '-':
			negative = true
		case unicode.IsDigit(rune(char)):
			started = true
			result = result*10 + int(char&0xf)
		case started:
			break READER_LOOP
		}
	}
	if negative {
		result = -result
	}
	return
}

const mod = 1e9 + 7

type tuple struct {
	count, maxchunk, minchunks int
}

func readString() string {
	var str []byte
	for {
		buf, isPrefix, err := stdReader.ReadLine()
		if err != nil {
			panic(err)
		}
		str = append(str, buf...)
		if !isPrefix {
			return string(str)
		}
	}
}

func main() {
	readString()
	str := readString()
	n := len(str)
	var lim [26]int
	for i := range lim {
		lim[i] = readInt()
	}
	maj := make([]tuple, n+1)
	maj[0] = tuple{1, 0, 0}
	for i := 0; i < n; i++ {
		var presence [26]bool
	SPREAD:
		for j := 1; j <= n-i; j++ {
			presence[str[i+j-1]-'a'] = true
			for k, p := range presence {
				if p && j > lim[k] {
					break SPREAD
				}
			}
			// maj[i] -> maj[i + j]
			maj[i+j].count = (maj[i].count + maj[i+j].count) % mod
			if maj[i].maxchunk > maj[i+j].maxchunk {
				maj[i+j].maxchunk = maj[i].maxchunk
			}
			if j > maj[i+j].maxchunk {
				maj[i+j].maxchunk = j
			}
			if maj[i+j].minchunks == 0 || maj[i].minchunks+1 < maj[i+j].minchunks {
				maj[i+j].minchunks = maj[i].minchunks + 1
			}
		}
	}
	fmt.Printf("%d %d %d\n", maj[n].count, maj[n].maxchunk, maj[n].minchunks)
}

package main

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

const MOD int = 1000000007

func Solve(io *FastIO) {
	N := io.NextInt()
	S := io.NextLine()
	A := io.NextIntArray(26)

	ways := make([]int, N + 1)
	ways[0] = 1
	maxSpan := 0
	best := make([]int, N + 1)
	FillArray(best, math.MaxInt32)
	best[0] = 0

	for i := 0; i < N; i++ {
		has := make([]bool, 26)
		for j := i + 1; j <= N; j++ {
			has[S[j - 1] - 'a'] = true
			if ValidSubstring(has, A, j - i) {
				ways[j] = (ways[j] + ways[i]) % MOD
				maxSpan = Max(maxSpan, j - i)
				best[j] = Min(best[j], 1 + best[i])
			}
		}
	}

	io.Println(ways[N])
	io.Println(maxSpan)
	io.Println(best[N])
}

func ValidSubstring(has []bool, A []int, length int) bool {
	for c, b := range has {
		if !b {
			continue
		}
		if A[c] < length {
			return false
		}
	}
	return true
}

func FillArray(arr []int, val int) {
	for i := range arr {
		arr[i] = val
	}
}

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

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

type FastIO struct {
	reader *bufio.Reader
	writer *bufio.Writer
}

func (io *FastIO) NextChar() byte {
	c, _ := io.reader.ReadByte()
	return c
}

func (io *FastIO) NextInt() int {
	c := io.NextChar()
	for IsSpaceChar(c) {
		c = io.NextChar()
	}
	sgn := 1
	if c == '-' {
		sgn = -1
		c = io.NextChar()
	}
	res := 0
	for !IsSpaceChar(c) {
		res = (res * 10) + int(c - '0')
		c = io.NextChar()
	}
	return sgn * res
}

func (io *FastIO) NextLong() int64 {
	c := io.NextChar()
	for IsSpaceChar(c) {
		c = io.NextChar()
	}
	sgn := int64(1)
	if c == '-' {
		sgn = -1
		c = io.NextChar()
	}
	res := int64(0)
	for !IsSpaceChar(c) {
		res = (res * 10) + int64(c - '0')
		c = io.NextChar()
	}
	return sgn * res
}

func (io *FastIO) NextIntArray(size int) []int {
	return io.NextIntArrayOffset(size, 0)
}

func (io *FastIO) NextIntArrayOffset(size, offset int) []int {
	arr := make([]int, size + offset)
	for i := 0; i < size; i++ {
		arr[i + offset] = io.NextInt()
	}
	return arr
}

func (io *FastIO) NextLongArray(size int) []int64 {
	return io.NextLongArrayOffset(size, 0)
}

func (io *FastIO) NextLongArrayOffset(size, offset int) []int64 {
	arr := make([]int64, size + offset)
	for i := 0; i < size; i++ {
		arr[i + offset] = io.NextLong()
	}
	return arr
}

func (io *FastIO) NextString() string {
	c := io.NextChar()
	for (IsSpaceChar(c)) {
		c = io.NextChar()
	}
	var sb bytes.Buffer
	for !IsSpaceChar(c) {
		sb.WriteByte(c)
		c = io.NextChar()
	}
	return sb.String()
}

func (io *FastIO) NextLine() string {
	c := io.NextChar()
	for (IsSpaceChar(c)) {
		c = io.NextChar()
	}
	var sb bytes.Buffer
	for !IsLineBreakChar(c) {
		sb.WriteByte(c)
		c = io.NextChar()
	}
	return sb.String()
}

func (io *FastIO) Println(args ...interface{}) {
	io.writer.WriteString(fmt.Sprintln(args...))
}

func (io *FastIO) Printf(format string, args ...interface{}) {
	io.writer.WriteString(fmt.Sprintf(format, args...))
}

func (io *FastIO) FlushOutput() {
	io.writer.Flush()
}

func IsSpaceChar(c byte) bool {
	switch c {
	case 0, '\t', '\n', '\r', ' ':
		return true
	default:
		return false
	}
}

func IsLineBreakChar(c byte) bool {
	switch c {
		case 0, '\n', '\r':
			return true
		default:
			return false
	}
}

func main() {
	io := FastIO{reader: bufio.NewReader(os.Stdin), writer: bufio.NewWriter(os.Stdout)}
	Solve(&io)
	io.FlushOutput()
}

package main

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

const MOD int = 1000000007

func Solve(io *FastIO) {
	N := io.NextInt()
	S := io.NextLine()
	A := io.NextIntArray(26)

	can := MakeMatrix(N + 1, N + 1)
	for i := 0; i < N; i++ {
		has := make([]bool, 26)
		for j := i; j < N; j++ {
			has[S[j] - 'a'] = true
			if ValidSubstring(has, A, j - i + 1) {
				can[i][j + 1] = true
			}
		}
	}

	ways := make([]int, N + 1)
	ways[0] = 1
	for i := 1; i <= N; i++ {
		for j := 0; j < i; j++ {
			if can[j][i] {
				ways[i] += ways[j]
				ways[i] %= MOD
			}
		}
	}

	maxSpan := 0
	for i := 0; i < N; i++ {
		for j := i + 1; j <= N; j++ {
			if can[i][j] {
				maxSpan = Max(maxSpan, j - i)
			}
		}
	}

	best := make([]int, N + 1)
	FillArray(best, math.MaxInt32)
	best[0] = 0
	for i := 0; i < N; i++ {
		for j := i + 1; j <= N; j++ {
			if can[i][j] {
				best[j] = Min(best[j], 1 + best[i])
			}
		}
	}

	io.Println(ways[N])
	io.Println(maxSpan)
	io.Println(best[N])
}

func ValidSubstring(has []bool, A []int, length int) bool {
	for c, b := range has {
		if !b {
			continue
		}
		if A[c] < length {
			return false
		}
	}
	return true
}

func MakeMatrix(rows, cols int) [][]bool {
	mat := make([][]bool, rows)
	for r := range mat {
		mat[r] = make([]bool, cols)
	}
	return mat
}

func FillArray(arr []int, val int) {
	for i := range arr {
		arr[i] = val
	}
}

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

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

type FastIO struct {
	reader *bufio.Reader
	writer *bufio.Writer
}

func (io *FastIO) NextChar() byte {
	c, _ := io.reader.ReadByte()
	return c
}

func (io *FastIO) NextInt() int {
	c := io.NextChar()
	for IsSpaceChar(c) {
		c = io.NextChar()
	}
	sgn := 1
	if c == '-' {
		sgn = -1
		c = io.NextChar()
	}
	res := 0
	for !IsSpaceChar(c) {
		res = (res * 10) + int(c - '0')
		c = io.NextChar()
	}
	return sgn * res
}

func (io *FastIO) NextLong() int64 {
	c := io.NextChar()
	for IsSpaceChar(c) {
		c = io.NextChar()
	}
	sgn := int64(1)
	if c == '-' {
		sgn = -1
		c = io.NextChar()
	}
	res := int64(0)
	for !IsSpaceChar(c) {
		res = (res * 10) + int64(c - '0')
		c = io.NextChar()
	}
	return sgn * res
}

func (io *FastIO) NextIntArray(size int) []int {
	return io.NextIntArrayOffset(size, 0)
}

func (io *FastIO) NextIntArrayOffset(size, offset int) []int {
	arr := make([]int, size + offset)
	for i := 0; i < size; i++ {
		arr[i + offset] = io.NextInt()
	}
	return arr
}

func (io *FastIO) NextLongArray(size int) []int64 {
	return io.NextLongArrayOffset(size, 0)
}

func (io *FastIO) NextLongArrayOffset(size, offset int) []int64 {
	arr := make([]int64, size + offset)
	for i := 0; i < size; i++ {
		arr[i + offset] = io.NextLong()
	}
	return arr
}

func (io *FastIO) NextString() string {
	c := io.NextChar()
	for (IsSpaceChar(c)) {
		c = io.NextChar()
	}
	var sb bytes.Buffer
	for !IsSpaceChar(c) {
		sb.WriteByte(c)
		c = io.NextChar()
	}
	return sb.String()
}

func (io *FastIO) NextLine() string {
	c := io.NextChar()
	for (IsSpaceChar(c)) {
		c = io.NextChar()
	}
	var sb bytes.Buffer
	for !IsLineBreakChar(c) {
		sb.WriteByte(c)
		c = io.NextChar()
	}
	return sb.String()
}

func (io *FastIO) Println(args ...interface{}) {
	io.writer.WriteString(fmt.Sprintln(args...))
}

func (io *FastIO) Printf(format string, args ...interface{}) {
	io.writer.WriteString(fmt.Sprintf(format, args...))
}

func (io *FastIO) FlushOutput() {
	io.writer.Flush()
}

func IsSpaceChar(c byte) bool {
	switch c {
	case 0, '\t', '\n', '\r', ' ':
		return true
	default:
		return false
	}
}

func IsLineBreakChar(c byte) bool {
	switch c {
		case 0, '\n', '\r':
			return true
		default:
			return false
	}
}

func main() {
	io := FastIO{reader: bufio.NewReader(os.Stdin), writer: bufio.NewWriter(os.Stdout)}
	Solve(&io)
	io.FlushOutput()
}

package main

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

const MOD int = 1000000007

func Solve(io *FastIO) {
	N := io.NextInt()
	S := io.NextLine()
	A := io.NextIntArray(26)

	ways := make([]int, N + 1)
	ways[0] = 1
	maxSpan := 0
	best := make([]int, N + 1)
	FillArray(best, math.MaxInt32)
	best[0] = 0

	for i := 0; i < N; i++ {
		has := make([]bool, 26)
		for j := i + 1; j <= N; j++ {
			has[S[j - 1] - 'a'] = true
			if ValidSubstring(has, A, j - i) {
				ways[j] = (ways[j] + ways[i]) % MOD
				maxSpan = Max(maxSpan, j - i)
				best[j] = Min(best[j], 1 + best[i])
			}
		}
	}

	io.Println(ways[N])
	io.Println(maxSpan)
	io.Println(best[N])
}

func ValidSubstring(has []bool, A []int, length int) bool {
	for c, b := range has {
		if !b {
			continue
		}
		if A[c] < length {
			return false
		}
	}
	return true
}

func MakeMatrix(rows, cols int) [][]bool {
	mat := make([][]bool, rows)
	for r := range mat {
		mat[r] = make([]bool, cols)
	}
	return mat
}

func FillArray(arr []int, val int) {
	for i := range arr {
		arr[i] = val
	}
}

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

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

type FastIO struct {
	reader *bufio.Reader
	writer *bufio.Writer
}

func (io *FastIO) NextChar() byte {
	c, _ := io.reader.ReadByte()
	return c
}

func (io *FastIO) NextInt() int {
	c := io.NextChar()
	for IsSpaceChar(c) {
		c = io.NextChar()
	}
	sgn := 1
	if c == '-' {
		sgn = -1
		c = io.NextChar()
	}
	res := 0
	for !IsSpaceChar(c) {
		res = (res * 10) + int(c - '0')
		c = io.NextChar()
	}
	return sgn * res
}

func (io *FastIO) NextLong() int64 {
	c := io.NextChar()
	for IsSpaceChar(c) {
		c = io.NextChar()
	}
	sgn := int64(1)
	if c == '-' {
		sgn = -1
		c = io.NextChar()
	}
	res := int64(0)
	for !IsSpaceChar(c) {
		res = (res * 10) + int64(c - '0')
		c = io.NextChar()
	}
	return sgn * res
}

func (io *FastIO) NextIntArray(size int) []int {
	return io.NextIntArrayOffset(size, 0)
}

func (io *FastIO) NextIntArrayOffset(size, offset int) []int {
	arr := make([]int, size + offset)
	for i := 0; i < size; i++ {
		arr[i + offset] = io.NextInt()
	}
	return arr
}

func (io *FastIO) NextLongArray(size int) []int64 {
	return io.NextLongArrayOffset(size, 0)
}

func (io *FastIO) NextLongArrayOffset(size, offset int) []int64 {
	arr := make([]int64, size + offset)
	for i := 0; i < size; i++ {
		arr[i + offset] = io.NextLong()
	}
	return arr
}

func (io *FastIO) NextString() string {
	c := io.NextChar()
	for (IsSpaceChar(c)) {
		c = io.NextChar()
	}
	var sb bytes.Buffer
	for !IsSpaceChar(c) {
		sb.WriteByte(c)
		c = io.NextChar()
	}
	return sb.String()
}

func (io *FastIO) NextLine() string {
	c := io.NextChar()
	for (IsSpaceChar(c)) {
		c = io.NextChar()
	}
	var sb bytes.Buffer
	for !IsLineBreakChar(c) {
		sb.WriteByte(c)
		c = io.NextChar()
	}
	return sb.String()
}

func (io *FastIO) Println(args ...interface{}) {
	io.writer.WriteString(fmt.Sprintln(args...))
}

func (io *FastIO) Printf(format string, args ...interface{}) {
	io.writer.WriteString(fmt.Sprintf(format, args...))
}

func (io *FastIO) FlushOutput() {
	io.writer.Flush()
}

func IsSpaceChar(c byte) bool {
	switch c {
	case 0, '\t', '\n', '\r', ' ':
		return true
	default:
		return false
	}
}

func IsLineBreakChar(c byte) bool {
	switch c {
		case 0, '\n', '\r':
			return true
		default:
			return false
	}
}

func main() {
	io := FastIO{reader: bufio.NewReader(os.Stdin), writer: bufio.NewWriter(os.Stdout)}
	Solve(&io)
	io.FlushOutput()
}