After the contest in comparing numbers, Shapur's teacher found out that he is a real genius and that no one could possibly do the calculations faster than him even using a super computer!Some days before the contest, the teacher took a very simple-looking exam and all his n students took part in the exam. The teacher gave them 3 strings and asked them to concatenate them. Concatenating strings means to put them in some arbitrary order one after the other. For example from concatenating Alireza and Amir we can get to AlirezaAmir or AmirAlireza depending on the order of concatenation.Unfortunately enough, the teacher forgot to ask students to concatenate their strings in a pre-defined order so each student did it the way he/she liked.Now the teacher knows that Shapur is such a fast-calculating genius boy and asks him to correct the students' papers.Shapur is not good at doing such a time-taking task. He rather likes to finish up with it as soon as possible and take his time to solve 3-SAT in polynomial time. Moreover, the teacher has given some advice that Shapur has to follow. Here's what the teacher said:   As I expect you know, the strings I gave to my students (including you) contained only lowercase and uppercase Persian Mikhi-Script letters. These letters are too much like Latin letters, so to make your task much harder I converted all the initial strings and all of the students' answers to Latin.  As latin alphabet has much less characters than Mikhi-Script, I added three odd-looking characters to the answers, these include "-", ";" and "_". These characters are my own invention of course! And I call them Signs.  The length of all initial strings was less than or equal to 100 and the lengths of my students' answers are less than or equal to 600  My son, not all students are genius as you are. It is quite possible that they make minor mistakes changing case of some characters. For example they may write ALiReZaAmIR instead of AlirezaAmir. Don't be picky and ignore these mistakes.  Those signs which I previously talked to you about are not important. You can ignore them, since many students are in the mood for adding extra signs or forgetting about a sign. So something like Iran;;-- is the same as --;IRAN  You should indicate for any of my students if his answer was right or wrong. Do this by writing "WA" for Wrong answer or "ACC" for a correct answer.  I should remind you that none of the strings (initial strings or answers) are empty.  Finally, do these as soon as possible. You have less than 2 hours to complete this.

The first three lines contain a string each. These are the initial strings. They consists only of lowercase and uppercase Latin letters and signs ("-", ";" and "_"). All the initial strings have length from 1 to 100, inclusively. In the fourth line there is a single integer n (0 ≤ n ≤ 1000), the number of students. Next n lines contain a student's answer each. It is guaranteed that the answer meets what the teacher said. Each answer iconsists only of lowercase and uppercase Latin letters and signs ("-", ";" and "_"). Length is from 1 to 600, inclusively.

For each student write in a different line. Print "WA" if his answer is wrong or "ACC" if his answer is OK.

Iran_
Persian;
W_o;n;d;e;r;f;u;l;
7
WonderfulPersianIran
wonderful_PersIAN_IRAN;;_
WONDERFUL___IRAN__PERSIAN__;;
Ira__Persiann__Wonderful
Wonder;;fulPersian___;I;r;a;n;
__________IranPersianWonderful__________
PersianIran_is_Wonderful

Shapur;;
is___
a_genius
3
Shapur__a_is___geniUs
is___shapur___a__Genius;
Shapur;;is;;a;;geni;;us;;

package main

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

func main() {
	// INPUT
	// file, _ := os.Open("input")
	file := os.Stdin
	reader := bufio.NewReader(file)
	arr := make([]string, 3)
	nStudent := 0
	for i := range arr {
		fmt.Fscanf(reader, "%s\n", &arr[i])
	}
	fmt.Fscanf(reader, "%d\n", &nStudent)
	answers := make([]string, nStudent)
	for i := 0; i < nStudent; i++ {
		fmt.Fscanf(reader, "%s\n", &answers[i])
	}

	// PREPROCESS
	for i := range arr {
		arr[i] = normalize(arr[i])
	}

	// BUILD HASH MAP ALL ACC ANSWER
	positions := []int{0, 1, 2}
	posPermutations := permutate(positions)
	permutations := map[string]bool{}

	for _, p := range posPermutations {
		concat := ""
		for _, v := range p {
			concat += arr[v]
		}
		permutations[strings.ToLower(concat)] = true
	}

	// PROCESS
	for _, answer := range answers {
		realAnswer := normalize(answer)

		if permutations[realAnswer] {
			fmt.Println("ACC")
		} else {
			fmt.Println("WA")
		}
	}

	return
}

func recursiveGenerate(arr []int, curLen, size int, result *[][]int) {
	if curLen == 1 {
		permutation := make([]int, size)
		copy(permutation, arr)
		*result = append(*result, permutation)
		return
	}

	for i := 0; i < curLen; i++ {
		recursiveGenerate(arr, curLen-1, size, result)

		if curLen%2 != 0 {
			arr[0], arr[curLen-1] = arr[curLen-1], arr[0]
		} else {
			arr[i], arr[curLen-1] = arr[curLen-1], arr[i]
		}
	}
}

func permutate(arr []int) [][]int {
	n := len(arr)
	permutations := [][]int{}

	recursiveGenerate(arr, n, n, &permutations)

	return permutations
}

func normalize(s string) string {
	s = strings.ReplaceAll(s, "_", "")
	s = strings.ReplaceAll(s, "-", "")
	s = strings.ReplaceAll(s, ";", "")

	return strings.ToLower(s)
}

package main

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

func main() {

	reader := NewStdReader(os.Stdin)
	s1, s2, s3 := reader.ReadText(), reader.ReadText(), reader.ReadText()

	s1, s2, s3 = cleanup(s1), cleanup(s2), cleanup(s3)

	c1 := s1 + s2 + s3
	c2 := s1 + s3 + s2
	c3 := s2 + s1 + s3
	c4 := s2 + s3 + s1
	c5 := s3 + s1 + s2
	c6 := s3 + s2 + s1

	n := reader.ReadInt()

	for i := 0; i < n; i++ {
		s := reader.ReadText()
		s = cleanup(s)
		if s == c1 || s == c2 || s == c3 || s == c4 || s == c5 || s == c6 {
			fmt.Println("ACC")
		} else {
			fmt.Println("WA")
		}
	}
}

func cleanup(s string) string {
	s = strings.ToLower(s)
	s = strings.Replace(s, "-", "", -1)
	s = strings.Replace(s, "_", "", -1)
	s = strings.Replace(s, ";", "", -1)
	return s
}

type StdReader struct {
	buf *bufio.Reader
}

func NewStdReader(reader io.Reader) *StdReader {
	return &StdReader{bufio.NewReaderSize(reader, 20*1024*1024)}
}

func (std *StdReader) ReadInt() int {

	r := 0
	sign := 1
	ok := false

	for {
		b, e := std.buf.ReadByte()

		if e != nil {
			break
		}
		if b >= '0' && b <= '9' {
			r = r*10 + int(b-'0')
			ok = true
		} else {
			if ok {
				break
			} else {
				if b == '-' {
					sign = -sign
				}
			}
		}
	}

	return sign * r
}

func (std *StdReader) ReadText() string {

	buf := bytes.NewBuffer(nil)

	for {
		b, e := std.buf.ReadByte()

		if e != nil {
			break
		}
		if b == ' ' || b == '\t' || b == '\r' || b == '\n' {
			if buf.Len() > 0 {
				break
			}
		} else {
			buf.WriteByte(b)
		}
	}

	return buf.String()
}


On February 14 Denis decided to give Valentine to Nastya and did not come up with anything better than to draw a huge red heart on the door of the length $$$k$$$ ($$$k \ge 3$$$). Nastya was very confused by this present, so she decided to break the door, throwing it on the mountains.Mountains are described by a sequence of heights $$$a_1, a_2, \dots, a_n$$$ in order from left to right ($$$k \le n$$$). It is guaranteed that neighboring heights are not equal to each other (that is, $$$a_i \ne a_{i+1}$$$ for all $$$i$$$ from $$$1$$$ to $$$n-1$$$).Peaks of mountains on the segment $$$[l,r]$$$ (from $$$l$$$ to $$$r$$$) are called indexes $$$i$$$ such that $$$l < i < r$$$, $$$a_{i - 1} < a_i$$$ and $$$a_i > a_{i + 1}$$$. It is worth noting that the boundary indexes $$$l$$$ and $$$r$$$ for the segment are not peaks. For example, if $$$n=8$$$ and $$$a=[3,1,4,1,5,9,2,6]$$$, then the segment $$$[1,8]$$$ has only two peaks (with indexes $$$3$$$ and $$$6$$$), and there are no peaks on the segment $$$[3, 6]$$$.To break the door, Nastya throws it to a segment $$$[l,l+k-1]$$$ of consecutive mountains of length $$$k$$$ ($$$1 \le l \le n-k+1$$$). When the door touches the peaks of the mountains, it breaks into two parts, after that these parts will continue to fall in different halves and also break into pieces when touching the peaks of the mountains, and so on. Formally, the number of parts that the door will break into will be equal to $$$p+1$$$, where $$$p$$$ is the number of peaks on the segment $$$[l,l+k-1]$$$.Nastya wants to break it into as many pieces as possible. Help her choose such a segment of mountains $$$[l, l+k-1]$$$ that the number of peaks on it is maximum. If there are several optimal segments, Nastya wants to find one for which the value $$$l$$$ is minimal.Formally, you need to choose a segment of mountains $$$[l, l+k-1]$$$ that has the maximum number of peaks. Among all such segments, you need to find the segment that has the minimum possible value $$$l$$$.

The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$)  — the number of test cases. Then the descriptions of the test cases follow. The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$3 \leq k \leq n \leq 2 \cdot 10^5$$$)  — the number of mountains and the length of the door. The second line of the input data set contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \leq a_i \leq 10 ^ 9$$$, $$$a_i \neq a_{i + 1}$$$)  — the heights of mountains. It is guaranteed that the sum of $$$n$$$ over all the test cases will not exceed $$$2 \cdot 10^5$$$.

For each test case, output two integers $$$t$$$ and $$$l$$$  — the maximum number of parts that the door can split into, and the left border of the segment of length $$$k$$$ that the door should be reset to.

NoteIn the first example, you need to select a segment of mountains from $$$2$$$ to $$$7$$$. In this segment, the indexes $$$3$$$ and $$$6$$$ are peaks, so the answer is $$$3$$$ (only $$$2$$$ peaks, so the door will break into $$$3$$$ parts). It is not difficult to notice that the mountain segments $$$[1, 6]$$$ and $$$[3, 8]$$$ are not suitable since they only have a $$$1$$$ peak (for the first segment, the $$$6$$$ index is not a peak, and for the second segment, the $$$3$$$ index is not a peak).In the second example, you need to select a segment of mountains from $$$2$$$ to $$$4$$$. In this segment, the index $$$3$$$ is a peak, so the answer is $$$2$$$ (only $$$1$$$ peak, so the door will break into $$$2$$$ parts).In the third example, you need to select a segment of mountains from $$$1$$$ to $$$4$$$. In this segment, the index $$$3$$$ is a peak, so the answer is $$$2$$$ (only $$$1$$$ peak, so the door will break into $$$2$$$ parts). You can see that on the segments $$$[2, 5]$$$, $$$[4, 7]$$$ and $$$[5, 8]$$$ the number of peaks is also $$$1$$$, but these segments have a left border greater than the segment $$$[1, 4]$$$, so they are not the correct answer.

package main

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

func main() {
	s := NewScanner()
	t := s.NextInt()

	for i := 0; i < t; i++ {
		n, k := s.NextInt(), s.NextInt()
		ar := make([]int, n)
		for i := 0; i < n; i++ {
			ar[i] = s.NextInt()
		}

		peaks := make([]int, n)
		peaks[0] = 0
		for i := 1; i < n-1; i++ {
			peaks[i] = peaks[i-1]
			if ar[i-1] < ar[i] && ar[i] > ar[i+1] {
				peaks[i]++
			}
		}
		peaks[n-1] = peaks[n-2]

		var l, t int
		for i := 0; i <= n-k; i++ {
			s, e := i, i+k-2
			ns := peaks[e] - peaks[s]
			if ns > t {
				t = ns
				l = i
			}
		}

		fmt.Printf("%d %d\n", t+1, l+1)

	}
}

type scanner struct {
	*bufio.Scanner
}

func NewScanner() *scanner {
	s := bufio.NewScanner(os.Stdin)
	s.Split(bufio.ScanWords)
	return &scanner{s}
}

func (s *scanner) NextInt() int {
	s.Scan()
	i, _ := strconv.Atoi(s.Text())
	return i
}

func (s *scanner) NextInt64() int64 {
	s.Scan()
	i, _ := strconv.ParseInt(s.Text(), 10, 64)
	return i
}

func (s *scanner) NextString() string {
	s.Scan()
	return s.Text()
}

// https://codeforces.com/contest/1341/problem/B
package main

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

// (c) Dmitriy Blokhin (sv.dblokhin@gmail.com)

func main () {
	var (
		T, n, k int
	)

	//f, _ := os.Open("input.txt")
	//input := bufio.NewReader(f)
	input := bufio.NewReader(os.Stdin)

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

		pref := make([]int, n + k)
		for i := 2; i < n; i++ {
			if a[i-2] < a[i -1 ] && a[i-1] > a[i] {
				pref[i]++
				pref[i - 2 + k]--
			}
		}

		maxC := 0
		minR := 0
		for i := 1; i <n;i++ {
			pref[i] += pref[i - 1]
			if maxC < pref[i] {
				maxC = pref[i]
				minR = i
			}
		}

		minL := minR - k + 1
		if minL < 0 {
			minL = 0
		}

		fmt.Println(maxC + 1, minL + 1)
	}
}

package main

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

var a = [int(2e5)]int64{}

func main() {
	in := bufio.NewReader(os.Stdin)
	t := 0
	_, _ = fmt.Fscan(in, &t)
	for t > 0 {
		var n, k int
		_, _ = fmt.Fscan(in, &n, &k)
		cur := 0
		for i := 0; i < n; i++ {
			_, _ = fmt.Fscan(in, &a[i])
			if i >= 2 && i <= k - 1  {
				l := i - 1
				if a[l - 1] < a[l] && a[l] > a[l + 1] {
					cur++
				}
			}
		}
		mx := cur
		l := 0
		for i := 1; i <= n - k; i++ {
			if a[i - 1] < a[i] && a[i] > a[i + 1] {
				cur--
			}
			r := i + k - 1
			//fmt.Println(i)
			if a[r - 2] < a[r - 1] && a[r - 1] > a[r] {
				cur++
			}
			if cur > mx {
				mx = cur
				l = i
			}
		}
		fmt.Printf("%d %d\n", mx + 1, l + 1)
		t--
	}
}

/*
URL:
https://codeforces.com/problemset/problem/1341/B
*/

package main

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

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

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

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

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

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

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

const (
	// General purpose
	MOD          = 1000000000 + 7
	ALPHABET_NUM = 26
	INF_INT64    = math.MaxInt64
	INF_BIT60    = 1 << 60
	INF_INT32    = math.MaxInt32
	INF_BIT30    = 1 << 30
	NIL          = -1

	// for dijkstra, prim, and so on
	WHITE = 0
	GRAY  = 1
	BLACK = 2
)

func init() {
	// bufio.ScanWords <---> bufio.ScanLines
	ReadString = newReadString(os.Stdin, bufio.ScanWords)
	stdout = bufio.NewWriter(os.Stdout)
}

var (
	t int

	n, k int
	A    []int
)

func main() {
	t = ReadInt()
	for i := 0; i < t; i++ {
		n, k = ReadInt2()
		A = ReadIntSlice(n)

		solve()
	}
}

func solve() {
	P := make([]int, n)
	S := make([]int, n+1)
	for i := 1; i < n-1; i++ {
		if A[i-1] < A[i] && A[i] > A[i+1] {
			P[i] = 1
		}
	}
	for i := 0; i < n; i++ {
		S[i+1] = S[i] + P[i]
	}

	ans := 1
	idx := 1
	for l, r := 0, k; r <= n; l, r = l+1, r+1 {
		ll, rr := l+1, r-1
		tmp := S[rr] - S[ll]
		if ChMax(&ans, tmp+1) {
			idx = l + 1
		}
	}
	fmt.Println(ans, idx)
}

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

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

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

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

func newReadString(ior io.Reader, sf bufio.SplitFunc) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+9)) // for Codeforces
	r.Split(sf)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

	return res
}

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

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

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

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

	return string(res)
}

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

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

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

	return string(res)
}

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

// PrintfBufStdout is function for output strings to buffered os.Stdout.
// You may have to call stdout.Flush() finally.
func PrintfBufStdout(format string, a ...interface{}) {
	fmt.Fprintf(stdout, format, a...)
}

package main

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

func main() {
	rd := bufio.NewReader(os.Stdin)
	wr := bufio.NewWriter(os.Stdout)

	var t, n, k, i, j, l1, l2, l3, l, x, ml, mi int
	var A []int

	fmt.Fscanf(rd, "%d\n", &t)
	for i = 0; i < t; i++ {
		fmt.Fscanf(rd, "%d %d\n", &n, &k)
		l = 0
		x = 0
		ml = 0
		mi = 0
		A = make([]int, 0)
		for j = 0; j < n; j++ {
			fmt.Fscanf(rd, "%d", &l3)
			if j > 1 {
				if l1 < l2 && l2 > l3 {
					l++
					A = append(A, j-1)
				}
			}
			if len(A) > 0 && x < len(A) && j-k+1 > A[x]-1 {
				x++
				l--
			}
			if l > ml && j-k+1 >= 0 {
				ml = l
				mi = j - k + 1
			}
			l1 = l2
			l2 = l3
			// for i1 = 0; i1 < len(A); i1++ {
			// 	fmt.Fprintf(wr, "%d ", A[i1])
			// }
			// fmt.Fprintf(wr, "\n")
		}
		fmt.Fscanf(rd, "\n")
		fmt.Fprintf(wr, "%d %d\n", ml+1, mi+1)
	}

	wr.Flush()
}

package main

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

// github.com/EndlessCheng/codeforces-go
func main() {
	in := bufio.NewReader(os.Stdin)
	var t, n, k int
	for Fscan(in, &t); t > 0; t-- {
		Fscan(in, &n, &k)
		a := make([]int, n)
		for i := range a {
			Fscan(in, &a[i])
		}
		sum := make([]int, n+1)
		for i := 1; i+1 < n; i++ {
			sum[i+1] = sum[i]
			if a[i-1] < a[i] && a[i] > a[i+1] {
				sum[i+1]++
			}
		}
		sum[n] = sum[n-1]
		ans, l := 0, 0
		for i := 0; i+k <= n; i++ {
			s := sum[i+k] - sum[i]
			if sum[i+1] > sum[i] {
				s--
			}
			if sum[i+k] > sum[i+k-1] {
				s--
			}
			if s > ans {
				ans = s
				l = i
			}
		}
		Println(ans+1, l+1)
	}
}

package main

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

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

	var t, n, k int
	for Fscan(in, &t); t > 0; t-- {
		Fscan(in, &n, &k)
		a := make([]int, n)
		for i := range a {
			Fscan(in, &a[i])
		}
		sum := make([]int, n+1)
		for i := 1; i+1 < n; i++ {
			sum[i+1] = sum[i]
			if a[i-1] < a[i] && a[i] > a[i+1] {
				sum[i+1]++
			}
		}
		sum[n] = sum[n-1]
		ans, l := 0, 0
		for i := 0; i+k <= n; i++ {
			s := sum[i+k] - sum[i]
			if sum[i+1] > sum[i] {
				s--
			}
			if sum[i+k] > sum[i+k-1] {
				s--
			}
			if s > ans {
				ans = s
				l = i
			}
		}
		Fprintln(out, ans+1, l+1)
	}
}

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

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

func newScanner() *bufio.Scanner {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	return scanner
}

func scanInt() int {
	sc.Scan()
	v, _ := strconv.Atoi(sc.Text())
	return v
}

func scanInts(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = scanInt()
	}
	return a
}

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

var sc = newScanner()

func main() {
	w := bufio.NewWriter(os.Stdout)
	defer w.Flush()
	for t:= scanInt(); t >0 ; t-- {
		n, k := scanInt(), scanInt()
		a := scanInts(n)
		p := make([]int, n)
		for i := 1; i < n-1; i++ {
			if a[i] > a[i-1] && a[i] > a[i+1] {
				p[i] = 1
			}
		}
		x := 0
		for i := 1; i <= k-2; i++ {
			x += p[i]
		}
		max, l := x, 0
		for i := 1; i <= n-k; i++ {
			x += p[i+k-2] - p[i]
			if x > max {
				max, l = x, i
			}
		}

		fmt.Fprintln(w,max+1, l+1)
	}
}

package main

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

type BufferedWriter interface {
	Printf(format string, a ...interface{})
	Flush()
}

type writerImpl struct {
	*bufio.Writer
}

func NewBufferedWriter(writer io.Writer) BufferedWriter {
	return &writerImpl{Writer: bufio.NewWriter(writer)}
}

func (impl *writerImpl) Printf(f string, a ...interface{}) {
	fmt.Fprintf(impl.Writer, f, a...)
}

func (impl *writerImpl) Flush() {
	impl.Writer.Flush()
}

type WordScanner interface {
	NextInt() int
	NextInt64() int64
	NextString() string
}

type wordScannerImpl struct {
	*bufio.Scanner
}

func NewWordScanner(reader io.Reader) WordScanner {
	s := bufio.NewScanner(reader)
	s.Split(bufio.ScanWords)
	// adjust the following size as needed
	// 2 << 17 is good enough to scan strings of len 2*10^5
	// it could go as high as 2 << 26 before cf judge breaks
	size := 2 << 20
	buf := make([]byte, size)
	s.Buffer(buf, size)
	return &wordScannerImpl{Scanner: s}
}

func (impl *wordScannerImpl) NextInt() int {
	impl.Scan()
	bb := impl.Bytes()
	i := 0
	if bb[0] == '-' {
		for _, b := range bb[1:] {
			i *= 10
			i -= int(b - '0')
		}
		return i
	}
	for _, b := range bb {
		i *= 10
		i += int(b - '0')
	}
	return i
}

func (impl *wordScannerImpl) NextInt64() int64 {
	impl.Scan()
	bb := impl.Bytes()
	i := int64(0)
	if bb[0] == '-' {
		for _, b := range bb[1:] {
			i *= 10
			i -= int64(b - '0')
		}
		return i
	}
	for _, b := range bb {
		i *= 10
		i += int64(b - '0')
	}
	return i
}

func (impl *wordScannerImpl) NextString() string {
	impl.Scan()
	return impl.Text()
}

var reader = NewWordScanner(os.Stdin)
var writer = NewBufferedWriter(os.Stdout)

func main() {
	defer writer.Flush()
	t := reader.NextInt64()
	for ; t > 0; t-- {
		n, k := reader.NextInt64(), reader.NextInt64()
		aa := make([]int64, n)
		for i := int64(0); i < n; i++ {
			aa[i] = reader.NextInt64()
		}
		parts, idx := sol(k, aa)
		writer.Printf("%d %d\n", parts, idx)
	}
}

func sol(k int64, aa []int64) (int64, int64) {
	l := int64(0)
	r := l+k-1
	currMax := int64(0)
	currMaxL := int64(0)
	for i := l + 1; i < r; i++ {
		if aa[i] > aa[i-1] && aa[i] > aa[i+1] {
			currMax++
		}
	}
	tmp := currMax
	for r < int64(len(aa))-1 {
		if aa[r] > aa[r-1] && aa[r] > aa[r+1] {
			tmp++
		}
		if aa[l+1] > aa[l] && aa[l+1] > aa[l+2] {
			tmp--
		}
		l++
		r++
		if tmp > currMax {
			currMax = tmp
			currMaxL = l
		}
	}
	return currMax+1, currMaxL+1
}

// https://codeforces.com/contest/1341/problem/B
package main

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

// (c) Dmitriy Blokhin (sv.dblokhin@gmail.com)

func main () {
	var (
		T, n, k int
	)

	//f, _ := os.Open("input.txt")
	//input := bufio.NewReader(f)
	input := bufio.NewReader(os.Stdin)

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

		minL := int(10e6)
		minLen := n
		maxC := 0
		dp := make([][]int, n)
		for i := 0; i < n; i++ {
			dp[i] = make([]int, n)
		}
		for l := 0; l < n; l++ {
			for r := l + 2; r < min(l + k, n); r++ {
				dp[l][r] = dp[l][r - 1]
				if a[r - 2] < a[r - 1] && a[r - 1] > a[r] {
					//println("Found pik:", l, r, "total: ", dp[l][r - 1] + 1)
					dp[l][r] = dp[l][r - 1] + 1

					if maxC < dp[l][r] {
						maxC = dp[l][r]
						minLen = r - l
						minL = l
					}
					if maxC == dp[l][r] {
						//println("COND: ", l, r, r -l, minLen)
						if r - l >= k - 1  && r - l < minLen {
							minLen = r - l
							minL = l
							//println("set minL", minL, minLen, maxC)
						}
						if r - l == minLen {
							minL = min(minL, l)
						}
					}
				}
			}
		}

		fmt.Println(maxC + 1, minL + 1)
	}
}

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

package main

import "fmt"

var a = [int(2e5)]int64{}

func main() {
	t := 0
	_, _ = fmt.Scan(&t)
	for t > 0 {
		var n, k int
		_, _ = fmt.Scan(&n, &k)
		for i := 0; i < n; i++ {
			_, _ = fmt.Scanf("%d", &a[i])
		}
		cur := 0
		for i := 1; i < k - 1; i++ {
			if a[i - 1] < a[i] && a[i] > a[i + 1] {
				cur++
			}
		}
		mx := cur
		l := 0
		for i := 1; i <= n - k; i++ {
			if a[i - 1] < a[i] && a[i] > a[i + 1] {
				cur--
			}
			r := i + k - 1
			//fmt.Println(i)
			if a[r - 2] < a[r - 1] && a[r - 1] > a[r] {
				cur++
			}
			if cur > mx {
				mx = cur
				l = i
			}
		}
		fmt.Printf("%d %d\n", mx + 1, l + 1)
		t--
	}
}

package main

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

func main() {
	rd := bufio.NewReader(os.Stdin)
	wr := bufio.NewWriter(os.Stdout)

	var t, n, k, i, j, l1, l2, l3, l, x, ml, mi int
	var A []int

	fmt.Fscanf(rd, "%d\n", &t)
	for i = 0; i < t; i++ {
		fmt.Fscanf(rd, "%d %d\n", &n, &k)
		l = 0
		x = 0
		ml = 0
		mi = 0
		A = make([]int, 0)
		for j = 0; j < n; j++ {
			fmt.Fscanf(rd, "%d", &l3)
			if j > 1 {
				if l1 < l2 && l2 > l3 {
					l++
					A = append(A, j-1)
				}
			}
			if len(A) > 0 && x < len(A) && j-k+1 > A[x] {
				x++
				l--
			}
			if l > ml && j-k+1 >= 0 {
				ml = l
				mi = j - k + 1
			}
			l1 = l2
			l2 = l3
			// for i1 = 0; i1 < len(A); i1++ {
			// 	fmt.Fprintf(wr, "%d ", A[i1])
			// }
			// fmt.Fprintf(wr, "\n")
		}
		fmt.Fscanf(rd, "\n")
		fmt.Fprintf(wr, "%d %d\n", ml+1, mi+1)
	}

	wr.Flush()
}


Bash has set out on a journey to become the greatest Pokemon master. To get his first Pokemon, he went to Professor Zulu's Lab. Since Bash is Professor Zulu's favourite student, Zulu allows him to take as many Pokemon from his lab as he pleases.But Zulu warns him that a group of k > 1 Pokemon with strengths {s1, s2, s3, ..., sk} tend to fight among each other if gcd(s1, s2, s3, ..., sk) = 1 (see notes for gcd definition).Bash, being smart, does not want his Pokemon to fight among each other. However, he also wants to maximize the number of Pokemon he takes from the lab. Can you help Bash find out the maximum number of Pokemon he can take? Note: A Pokemon cannot fight with itself.

The input consists of two lines. The first line contains an integer n (1 ≤ n ≤ 105), the number of Pokemon in the lab. The next line contains n space separated integers, where the i-th of them denotes si (1 ≤ si ≤ 105), the strength of the i-th Pokemon.

Print single integer — the maximum number of Pokemons Bash can take.

Notegcd (greatest common divisor) of positive integers set {a1, a2, ..., an} is the maximum positive integer that divides all the integers {a1, a2, ..., an}.In the first sample, we can take Pokemons with strengths {2, 4} since gcd(2, 4) = 2.In the second sample, we can take Pokemons with strengths {2, 4, 6}, and there is no larger group with gcd ≠ 1.

package main

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

func main() {
	n := readi()
	values := readis(n)
	fmt.Fprintln(writer, solve(values))
	writer.Flush()
}

func solve(values []int) int {
	primes := getPrimes(1e5)
	primeCount := make([]int, 1e5)
	fillAll(values, primes, primeCount)
	ans := 0
	for _, p := range primes {
		ans = max(ans, primeCount[p])
	}
	if ans == 0 {
		ans = 1
	}
	return ans
}

func fillAll(values, primes, primeCount []int) {
	for _, x := range values {
		fill(x, primes, primeCount)
	}
}

func fill(n int, primes, primeCount []int) {
	for _, p := range primes {
		if p*p > n {
			break
		}
		if n%p == 0 {
			primeCount[p]++
			for n%p == 0 {
				n /= p
			}
		}
	}
	if n > 1 {
		primeCount[n]++
	}
}

func getPrimes(n int) []int {
	isPrime := make([]bool, n)
	for i := 2; i < len(isPrime); i++ {
		isPrime[i] = true
	}
	max := int(math.Sqrt(float64(n)))
	for i := 2; i <= max; i++ {
		if isPrime[i] {
			for j := i * i; j < len(isPrime); j += i {
				isPrime[j] = false
			}
		}
	}
	var primes []int
	for n, ok := range isPrime {
		if ok {
			primes = append(primes, n)
		}
	}
	return primes
}

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

func abs64(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

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

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

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

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

var (
	reader = bufio.NewReaderSize(os.Stdin, 1<<13)
	writer = bufio.NewWriterSize(os.Stdout, 1<<13)
)

func readi() int {
	return int(readi64())
}

func read2i() (int, int) {
	return readi(), readi()
}

func readis(n int) []int {
	res := make([]int, n)
	for i := range res {
		res[i] = readi()
	}
	return res
}

func readi64() int64 {
	b, err := reader.ReadByte()
	for !isValid(b, err) {
		b, err = reader.ReadByte()
	}
	sign, res := int64(1), int64(0)
	if b == '-' {
		sign *= -1
		b, err = reader.ReadByte()
	}
	for isValid(b, err) {
		res = res*10 + int64(b-'0')
		b, err = reader.ReadByte()
	}
	return res * sign
}

func readline() string {
	res := new(bytes.Buffer)
	for {
		line, isPrefix, err := reader.ReadLine()
		if err != nil {
			panic(err)
		}
		res.Write(line)
		if !isPrefix {
			break
		}
	}
	return res.String()
}

func isValid(b byte, err error) bool {
	return err == nil && (('0' <= b && b <= '9') || b == '-')
}

package main

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

func I(i interface{}, delim string) {
	fmt.Fscanf(r, "%v"+delim, i)
}

func O(o interface{}, delim string) {
	fmt.Fprintf(w, "%v"+delim, o)
}

var (
	r *bufio.Reader
	w *bufio.Writer
)

func main() {
	r = bufio.NewReader(os.Stdin)
	w = bufio.NewWriter(os.Stdout)
	defer w.Flush()
	var n int
	I(&n, "\n")
	max := 100001
	in := make([]int, max)
	for i := 0; i < n; i++ {
		var o int
		I(&o, " ")
		in[o]++
	}
	m := 1
	for i := 2; i < max; i++ {
		mm := 0
		for j := i; j < max; j += i {
			mm += in[j]
		}
		if mm > m {
			m = mm
		}
	}
	O(m, "\n")
}

/*
URL:
https://codeforces.com/problemset/problem/757/B
*/

package main

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

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

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

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

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

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

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

const (
	// General purpose
	MOD          = 1000000000 + 7
	ALPHABET_NUM = 26
	INF_INT64    = math.MaxInt64
	INF_BIT60    = 1 << 60
	INF_INT32    = math.MaxInt32
	INF_BIT30    = 1 << 30
	NIL          = -1

	// for dijkstra, prim, and so on
	WHITE = 0
	GRAY  = 1
	BLACK = 2
)

func init() {
	// bufio.ScanWords <---> bufio.ScanLines
	ReadString = newReadString(os.Stdin, bufio.ScanWords)
	stdout = bufio.NewWriter(os.Stdout)
}

var (
	n int
	A []int

	memo [100000 + 50]int
)

func main() {
	n = ReadInt()
	A = ReadIntSlice(n)

	for _, a := range A {
		if a == 1 {
			continue
		}

		M := TrialDivision(a)
		for k := range M {
			memo[k]++
		}
	}

	ans := 1
	for i := 2; i <= 100000; i++ {
		ChMax(&ans, memo[i])
	}
	fmt.Println(ans)
}

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

// TrialDivision returns the result of prime factorization of integer N.
func TrialDivision(n int) map[int]int {
	var i, exp int
	p := map[int]int{}

	if n <= 1 {
		panic(errors.New("[argument error]: TrialDivision only accepts a NATURAL number"))
	}

	for i = 2; i*i <= n; i++ {
		exp = 0
		for n%i == 0 {
			exp++
			n /= i
		}

		if exp == 0 {
			continue
		}
		p[i] = exp
	}
	if n > 1 {
		p[n] = 1
	}

	return p
}

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

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

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

func newReadString(ior io.Reader, sf bufio.SplitFunc) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+9)) // for Codeforces
	r.Split(sf)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

	return res
}

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

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

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

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

	return string(res)
}

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

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

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

	return string(res)
}

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

// PrintfBufStdout is function for output strings to buffered os.Stdout.
// You may have to call stdout.Flush() finally.
func PrintfBufStdout(format string, a ...interface{}) {
	fmt.Fprintf(stdout, format, a...)
}

package main

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

func solve() {
	n := readInt()
	a := make([]int, 0)
	for i := 0; i < n; i++ {
		a = append(a, readInt())
	}
	const N = 100110

	f := make([]int, N)
	for _, x := range a {
		f[x]++
	}

	ans := 1

	for i := 2; i < N; i++ {
		for j := 2 * i; j < N; j += i {
			f[i] += f[j]
		}
		ans = max(ans, f[i])
	}
	fmt.Println(ans)
}

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

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

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

package main

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

func solve() {
	n := readInt()
	a := make([]int, 0)
	visited := make(map[int]int)
	for i := 0; i < n; i++ {
		value := readInt()
		if cnt := visited[value]; cnt == 0 {
			a = append(a, value)
		}
		visited[value]++
	}
	m := make(map[int]map[int]bool)
	for i := 0; i < len(a); i++ {
		value := a[i]
		for j := 2; j <= value; j++ {
			if value%j == 0 {
				if _, ok := m[j]; !ok {
					m[j] = make(map[int]bool)
				}
				m[j][a[i]] = true
				value /= j
				j--
			}
		}
	}
	ans := 1
	for _, v := range m {
		sum := 0
		for value := range v {
			sum += visited[value]
		}
		if sum > ans {
			ans = sum
		}
	}
	fmt.Println(ans)
}

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
}

// Codeforces 757 B  Bash's Big Day
package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
	"strconv"
	"sort"
)
var in *bufio.Reader

func readFive() (int,int,int,int,int) {
	var a [5]int
	s, err := in.ReadString('\n')
	if err != nil {
		fmt.Println("first read failure", err)
		panic(err)
	}
	ss := strings.Split(strings.Trim(s, " \n\r"), " ")
	for i:=0; i<len(ss); i++ {
		a[i], err = strconv.Atoi(ss[i])
		if err != nil {
			fmt.Println("n atoi failure", err)
			panic(err)
		}
	}
	return a[0],a[1],a[2],a[3],a[4]
}

func readLineNumbs(n int) []int {
	a := make([]int, n)
	s, err := in.ReadString('\n')
	if err != nil {
		fmt.Println("read failure", err)
		panic(err)
	}
	ss := strings.Split(strings.Trim(s, " \n\r"), " ")
	for j:=0; j<n; j++ {
		aa,err := strconv.Atoi(ss[j])
		if err != nil {
			fmt.Println("aa conv failed", err)
			panic(err)
		}
		a[j] = aa
	}
	return a
}

var n int
var s []int
var maxPok int
var nPrimePok []int
var primes []int
var nPrime int

func readData() {
	in = bufio.NewReader(os.Stdin)
	// reading n
	n,_,_,_,_ = readFive()
	s = readLineNumbs(n)
}

func toPrimeIdxs(a int, sameCnt int)  {
	for i:=0; i<nPrime && a>1; i++ {
		pr := primes[i]
		if (a % pr) == 0 {
			nPrimePok[i] += sameCnt
			// fmt.Printf("a, Prime, i, cnt = %d %d %d %d \n",a,primes[i],i,nPrimePok[i])
			for (a % pr)==0 {
				a = a/pr
			}
		}
	}
}

func eratosthene() {
	maxPok = 0
	for i:=0; i<n; i++ {
		if maxPok<s[i] {
			maxPok = s[i]+5
		}
	}
	isPrime := make([]bool, maxPok)
	for i:=0; i<maxPok; i++ {
		isPrime[i] = true
	}
	for i:=2; i<maxPok; i++ {
		if isPrime[i] {
			for j:=2; i*j<maxPok; j++ {
				isPrime[i*j] = false
			}
		}
	}
	primes = make([]int,0)
	nPrime = 0
	for i:=2; i<maxPok; i++ {
		if isPrime[i] {
			primes = append(primes, i)
		}
	}
	nPrime = len(primes)
}

func solve() {
	eratosthene()
	sort.Ints(s)
	nPrimePok = make([]int, nPrime)
	sameCnt := 1
	for i:=0; i<n; i++ {
		if i==n-1 || s[i] != s[i+1] {
			toPrimeIdxs(s[i], sameCnt)
			sameCnt = 1
		} else {
			sameCnt++
		}

	}
	maxPok = 1
	for i:=0; i<nPrime; i++ {
		if nPrimePok[i] > maxPok {
			maxPok = nPrimePok[i]
			// fmt.Printf("prime,nPriRok = %d %d\n", primes[i],nPrimePok[i])
		}
	}
}

func printRes() {
	fmt.Println(maxPok)
}

func main() {
	readData()
	solve()
	printRes()
}

package main

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

func main() {
	n := readi()
	values := readis(n)
	fmt.Fprintln(writer, solve(values))
	writer.Flush()
}

func solve(values []int) int {
	primes := getPrimes(1e5)
	primeCount := make([]int, 1e5)
	fillAll(values, primes, primeCount)
	ans := 0
	for _, p := range primes {
		ans = max(ans, primeCount[p])
	}
	return ans
}

func fillAll(values, primes, primeCount []int) {
	for _, x := range values {
		fill(x, primes, primeCount)
	}
}

func fill(n int, primes, primeCount []int) {
	for _, p := range primes {
		if p*p > n {
			break
		}
		if n%p == 0 {
			primeCount[p]++
			for n%p == 0 {
				n /= p
			}
		}
	}
	if n > 1 {
		primeCount[n]++
	}
}

func getPrimes(n int) []int {
	isPrime := make([]bool, n)
	for i := 2; i < len(isPrime); i++ {
		isPrime[i] = true
	}
	max := int(math.Sqrt(float64(n)))
	for i := 2; i <= max; i++ {
		if isPrime[i] {
			for j := i * i; j < len(isPrime); j += i {
				isPrime[j] = false
			}
		}
	}
	var primes []int
	for n, ok := range isPrime {
		if ok {
			primes = append(primes, n)
		}
	}
	return primes
}

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

func abs64(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

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

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

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

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

var (
	reader = bufio.NewReaderSize(os.Stdin, 1<<13)
	writer = bufio.NewWriterSize(os.Stdout, 1<<13)
)

func readi() int {
	return int(readi64())
}

func read2i() (int, int) {
	return readi(), readi()
}

func readis(n int) []int {
	res := make([]int, n)
	for i := range res {
		res[i] = readi()
	}
	return res
}

func readi64() int64 {
	b, err := reader.ReadByte()
	for !isValid(b, err) {
		b, err = reader.ReadByte()
	}
	sign, res := int64(1), int64(0)
	if b == '-' {
		sign *= -1
		b, err = reader.ReadByte()
	}
	for isValid(b, err) {
		res = res*10 + int64(b-'0')
		b, err = reader.ReadByte()
	}
	return res * sign
}

func readline() string {
	res := new(bytes.Buffer)
	for {
		line, isPrefix, err := reader.ReadLine()
		if err != nil {
			panic(err)
		}
		res.Write(line)
		if !isPrefix {
			break
		}
	}
	return res.String()
}

func isValid(b byte, err error) bool {
	return err == nil && (('0' <= b && b <= '9') || b == '-')
}

package main

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

func I(i interface{}, delim string) {
	fmt.Fscanf(r, "%v"+delim, i)
}

func O(o interface{}, delim string) {
	fmt.Fprintf(w, "%v"+delim, o)
}

var (
	r *bufio.Reader
	w *bufio.Writer
)

func main() {
	r = bufio.NewReader(os.Stdin)
	w = bufio.NewWriter(os.Stdout)
	defer w.Flush()
	var n int
	I(&n, "\n")
	in := make([]int, n)
	for i := 0; i < n; i++ {
		I(&in[i], " ")
	}
	o := make([]int, 10000)
	mmm := 0
	for i := 2; i < 10000; i++ {
		qq := true
		for ii := 2; ii < 100; ii++ {
			if i%ii == 0 {
				qq = false
			}
		}
		if qq || i < 100 {
			for j := 0; j < n; j++ {
				if in[j]%i == 0 {
					o[i]++
				}
			}
			if o[i] > mmm {
				mmm = o[i]
			}
		}
	}
	O(mmm, "\n")
}

package main

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

func I(i interface{}, delim string) {
	fmt.Fscanf(r, "%v"+delim, i)
}

func O(o interface{}, delim string) {
	fmt.Fprintf(w, "%v"+delim, o)
}

var (
	r *bufio.Reader
	w *bufio.Writer
)

func main() {
	r = bufio.NewReader(os.Stdin)
	w = bufio.NewWriter(os.Stdout)
	defer w.Flush()
	var n int
	I(&n, "\n")
	in := make([]int, n)
	for i := 0; i < n; i++ {
		I(&in[i], " ")
	}
	o := make([]int, 34200)
	mmm := 1
	for i := 2; i < 34200; i++ {
		qq := true
		for ii := 2; ii < 50; ii++ {
			if i%ii == 0 {
				qq = false
			}
		}
		if qq || i < 50 {
			for j := 0; j < n; j++ {
				if in[j]%i == 0 {
					o[i]++
				}
			}
			if o[i] > mmm {
				mmm = o[i]
			}
		}
	}
	O(mmm, "\n")
}

package main

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

func I(i interface{}, delim string) {
	fmt.Fscanf(r, "%v"+delim, i)
}

func O(o interface{}, delim string) {
	fmt.Fprintf(w, "%v"+delim, o)
}

var (
	r *bufio.Reader
	w *bufio.Writer
)

func main() {
	r = bufio.NewReader(os.Stdin)
	w = bufio.NewWriter(os.Stdout)
	defer w.Flush()
	var n int
	I(&n, "\n")
	in := make([]int, n)
	for i := 0; i < n; i++ {
		I(&in[i], " ")
	}
	o := make([]int, 5000)
	for i := 2; i < 5000; i++ {
		for j := 0; j < n; j++ {
			if in[j]%i == 0 {
				o[i]++
			}
		}
	}
	sort.Sort(sort.Reverse(sort.IntSlice(o)))
	O(o[0], "\n")
}

package main

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

func I(i interface{}, delim string) {
	fmt.Fscanf(r, "%v"+delim, i)
}

func O(o interface{}, delim string) {
	fmt.Fprintf(w, "%v"+delim, o)
}

var (
	r *bufio.Reader
	w *bufio.Writer
)

func main() {
	r = bufio.NewReader(os.Stdin)
	w = bufio.NewWriter(os.Stdout)
	defer w.Flush()
	var n int
	I(&n, "\n")
	in := make([]int, n)
	for i := 0; i < n; i++ {
		I(&in[i], " ")
	}
	o := make([]int, 34000)
	mmm := 0
	for i := 2; i < 34000; i++ {
		qq := true
		for ii := 2; ii < 50; ii++ {
			if i%ii == 0 {
				qq = false
			}
		}
		if qq || i < 50 {
			for j := 0; j < n; j++ {
				if in[j]%i == 0 {
					o[i]++
				}
			}
			if o[i] > mmm {
				mmm = o[i]
			}
		}
	}
	O(mmm, "\n")
}

package main

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

func solve() {
	n := readInt()
	a := make([]int, 0)
	v := make(map[int]bool)
	for i := 0; i < n; i++ {
		value := readInt()
		if _, ok := v[value]; !ok {
			v[value] = true
			a = append(a, value)
		}
	}

	res := make(map[int]map[int]bool)
	for i := 0; i < len(a); i++ {
		for j := i + 1; j < len(a); j++ {
			div := gcd(a[i], a[j])
			if div > 1 {
				if _, ok := res[div]; !ok {
					res[div] = make(map[int]bool)
				}
				res[div][a[i]] = true
				res[div][a[j]] = true
			}
		}
	}
	ans := 1
	for _, v := range res {
		if len(v) > ans {
			ans = len(v)
		}
	}
	fmt.Println(ans)
}

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

func gcd(x, y int) int {
	for y != 0 {
		x, y = y, x%y
	}
	return x
}

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
}

package main

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

func solve() {
	n := readInt()
	a := make([]int, 0)
	v := make(map[int]bool)

	for i := 0; i < n; i++ {
		value := readInt()
		if _, ok := v[value]; !ok {
			v[value] = true
			a = append(a, value)
		}
	}
	m := make(map[int]map[int]bool)
	for i := 0; i < len(a); i++ {
		value := a[i]
		for j := 2; j <= value; j++ {
			if value%j == 0 {
				if _, ok := m[j]; !ok {
					m[j] = make(map[int]bool)
				}
				m[j][value] = true
				value /= j
				j--
			}
		}
	}
	ans := 0
	for _, v := range m {
		if len(v) > ans {
			ans = len(v)
		}

	}
	fmt.Println(ans)
}

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

func gcd(x, y int) int {
	for y != 0 {
		x, y = y, x%y
	}
	return x
}

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
}

package main

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

func solve() {
	n := readInt()
	a := make([]int, 0)
	v := make(map[int]bool)

	for i := 0; i < n; i++ {
		value := readInt()
		if _, ok := v[value]; !ok {
			v[value] = true
			a = append(a, value)
		}
	}
	m := make(map[int]map[int]bool)
	for i := 0; i < len(a); i++ {
		value := a[i]
		for j := 2; j <= value; j++ {
			if value%j == 0 {
				if _, ok := m[j]; !ok {
					m[j] = make(map[int]bool)
				}
				m[j][value] = true
				value /= j
				j--
			}
		}
	}
	ans := 1
	for k, v := range m {
		if k > 1 && len(v) > ans {
			ans = len(v)
		}
	}
	fmt.Println(ans)
}

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

func gcd(x, y int) int {
	for y != 0 {
		x, y = y, x%y
	}
	return x
}

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
}

package main

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

func solve() {
	n := readInt()
	a := make([]int, 0)
	v := make(map[int]bool)
	for i := 0; i < n; i++ {
		value := readInt()
		if _, ok := v[value]; !ok {
			v[value] = true
			a = append(a, value)
		}
	}
	sort.Ints(a)
	ans := 0
	for i := 0; i < len(a); i++ {
		cnt := 1
		for j := i + 1; j < len(a); j++ {
			if a[j]%a[i] == 0 {
				cnt++
			}
		}
		if ans < cnt {
			ans = cnt
		}
	}
	fmt.Println(ans)
}

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

func gcd(x, y int) int {
	for y != 0 {
		x, y = y, x%y
	}
	return x
}

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
}

// Codeforces 757 B  Bash's Big Day
package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
	"strconv"
)
var in *bufio.Reader

func readFive() (int,int,int,int,int) {
	var a [5]int
	s, err := in.ReadString('\n')
	if err != nil {
		fmt.Println("first read failure", err)
		panic(err)
	}
	ss := strings.Split(strings.Trim(s, " \n\r"), " ")
	for i:=0; i<len(ss); i++ {
		a[i], err = strconv.Atoi(ss[i])
		if err != nil {
			fmt.Println("n atoi failure", err)
			panic(err)
		}
	}
	return a[0],a[1],a[2],a[3],a[4]
}

func readLineNumbs(n int) []int {
	a := make([]int, n)
	s, err := in.ReadString('\n')
	if err != nil {
		fmt.Println("read failure", err)
		panic(err)
	}
	ss := strings.Split(strings.Trim(s, " \n\r"), " ")
	for j:=0; j<n; j++ {
		aa,err := strconv.Atoi(ss[j])
		if err != nil {
			fmt.Println("aa conv failed", err)
			panic(err)
		}
		a[j] = aa
	}
	return a
}

var n int
var s []int
var maxPok int
var nPrimePok []int
var primes []int
var nPrime int

func readData() {
	in = bufio.NewReader(os.Stdin)
	// reading n
	n,_,_,_,_ = readFive()
	s = readLineNumbs(n)
}

func toPrimeIdxs(a int)  {
	pr := make([]int,0)
	for i:=0; i<nPrime && a>1; i++ {
		if (a % primes[i]) == 0 {
			pr = append(pr, i)
			nPrimePok[i]++
			// fmt.Printf("a, Prime, i, cnt = %d %d %d %d \n",a,primes[i],i,nPrimePok[i])
			a = a/primes[i]
			for (a % primes[i])==0 {
				a = a/primes[i]
			}
		}
	}
}

func eratosthene() {
	maxPok = 0
	for i:=0; i<n; i++ {
		if maxPok<s[i] {
			maxPok = s[i]+5
		}
	}
	isPrime := make([]bool, maxPok)
	for i:=0; i<maxPok; i++ {
		isPrime[i] = true
	}
	for i:=2; i<maxPok; i++ {
		if isPrime[i] {
			for j:=2; i*j<maxPok; j++ {
				isPrime[i*j] = false
			}
		}
	}
	primes = make([]int,0)
	nPrime = 0
	for i:=2; i<maxPok; i++ {
		if isPrime[i] {
			primes = append(primes, i)
		}
	}
	nPrime = len(primes)
}

func solve() {
	eratosthene()
	nPrimePok = make([]int, nPrime)
	for i:=0; i<n; i++ {
		toPrimeIdxs(s[i])
	}
	maxPok = 0
	for i:=0; i<nPrime; i++ {
		if nPrimePok[i] > maxPok {
			maxPok = nPrimePok[i]
			// fmt.Printf("prime,nPriRok = %d %d\n", primes[i],nPrimePok[i])
		}
	}
}

func printRes() {
	fmt.Println(maxPok)
}

func main() {
	readData()
	solve()
	printRes()
}

// Codeforces 757 B  Bash's Big Day
package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
	"strconv"
	"sort"
)
var in *bufio.Reader

func readFive() (int,int,int,int,int) {
	var a [5]int
	s, err := in.ReadString('\n')
	if err != nil {
		fmt.Println("first read failure", err)
		panic(err)
	}
	ss := strings.Split(strings.Trim(s, " \n\r"), " ")
	for i:=0; i<len(ss); i++ {
		a[i], err = strconv.Atoi(ss[i])
		if err != nil {
			fmt.Println("n atoi failure", err)
			panic(err)
		}
	}
	return a[0],a[1],a[2],a[3],a[4]
}

func readLineNumbs(n int) []int {
	a := make([]int, n)
	s, err := in.ReadString('\n')
	if err != nil {
		fmt.Println("read failure", err)
		panic(err)
	}
	ss := strings.Split(strings.Trim(s, " \n\r"), " ")
	for j:=0; j<n; j++ {
		aa,err := strconv.Atoi(ss[j])
		if err != nil {
			fmt.Println("aa conv failed", err)
			panic(err)
		}
		a[j] = aa
	}
	return a
}

var n int
var s []int
var maxPok int
var nPrimePok []int
var primes []int
var nPrime int

func readData() {
	in = bufio.NewReader(os.Stdin)
	// reading n
	n,_,_,_,_ = readFive()
	s = readLineNumbs(n)
}

func toPrimeIdxs(a int, sameCnt int)  {
	for i:=0; i<nPrime && a>1; i++ {
		pr := primes[i]
		if (a % pr) == 0 {
			nPrimePok[i] += sameCnt
			// fmt.Printf("a, Prime, i, cnt = %d %d %d %d \n",a,primes[i],i,nPrimePok[i])
			for (a % pr)==0 {
				a = a/pr
			}
		}
	}
}

func eratosthene() {
	maxPok = 0
	for i:=0; i<n; i++ {
		if maxPok<s[i] {
			maxPok = s[i]+5
		}
	}
	isPrime := make([]bool, maxPok)
	for i:=0; i<maxPok; i++ {
		isPrime[i] = true
	}
	for i:=2; i<maxPok; i++ {
		if isPrime[i] {
			for j:=2; i*j<maxPok; j++ {
				isPrime[i*j] = false
			}
		}
	}
	primes = make([]int,0)
	nPrime = 0
	for i:=2; i<maxPok; i++ {
		if isPrime[i] {
			primes = append(primes, i)
		}
	}
	nPrime = len(primes)
}

func solve() {
	if n==1 {
		maxPok = 1
		return
	}
	eratosthene()
	sort.Ints(s)
	nPrimePok = make([]int, nPrime)
	sameCnt := 1
	for i:=0; i<n; i++ {
		if i==n-1 || s[i] != s[i+1] {
			toPrimeIdxs(s[i], sameCnt)
			sameCnt = 1
		} else {
			sameCnt++
		}

	}
	maxPok = 0
	for i:=0; i<nPrime; i++ {
		if nPrimePok[i] > maxPok {
			maxPok = nPrimePok[i]
			// fmt.Printf("prime,nPriRok = %d %d\n", primes[i],nPrimePok[i])
		}
	}
}

func printRes() {
	fmt.Println(maxPok)
}

func main() {
	readData()
	solve()
	printRes()
}


The School №0 of the capital of Berland has n children studying in it. All the children in this school are gifted: some of them are good at programming, some are good at maths, others are good at PE (Physical Education). Hence, for each child we know value ti:  ti = 1, if the i-th child is good at programming,  ti = 2, if the i-th child is good at maths,  ti = 3, if the i-th child is good at PE Each child happens to be good at exactly one of these three subjects.The Team Scientific Decathlon Olympias requires teams of three students. The school teachers decided that the teams will be composed of three children that are good at different subjects. That is, each team must have one mathematician, one programmer and one sportsman. Of course, each child can be a member of no more than one team.What is the maximum number of teams that the school will be able to present at the Olympiad? How should the teams be formed for that?

The first line contains integer n (1 ≤ n ≤ 5000) — the number of children in the school. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ 3), where ti describes the skill of the i-th child.

In the first line output integer w — the largest possible number of teams.  Then print w lines, containing three numbers in each line. Each triple represents the indexes of the children forming the team. You can print both the teams, and the numbers in the triplets in any order. The children are numbered from 1 to n in the order of their appearance in the input. Each child must participate in no more than one team. If there are several solutions, print any of them. If no teams can be compiled, print the only line with value w equal to 0.

package main

import (
	"bufio"
	"os"
	"strconv"
	"fmt"
	"container/list"
)

var in *bufio.Scanner = bufio.NewScanner(os.Stdin)
var out *bufio.Writer = bufio.NewWriter(os.Stdout)

type Tuple struct{ x, y, z interface{} }

func main() {
	defer out.Flush()
	in.Split(bufio.ScanWords)

	n := nextInt()
	var a []*list.List = []*list.List{list.New(), list.New(), list.New()}
	for i := 0; i < n; i++ {
		a[nextInt() - 1].PushFront(i + 1)
	}

	var m []Tuple
	for i, j, k := a[0].Front(), a[1].Front(), a[2].Front(); i != nil && j != nil && k != nil; {
		m = append(m, Tuple{i.Value, j.Value, k.Value})
		i = i.Next()
		j = j.Next()
		k = k.Next()
	}

	fmt.Println(len(m))
	for _, i := range m {
		fmt.Printf("%d %d %d\n", i.x, i.y, i.z)
	}
}

func nextInt() int {
	in.Scan()
	res, _ := strconv.Atoi(in.Text())
	return res
}

package main

import "fmt"

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

func main() {
	var n int
	fmt.Scan(&n)
	var t [3][]int
	for i := 0; i < n; i++ {
		var v int
		fmt.Scan(&v)
		t[v-1] = append(t[v-1], i+1)
	}
	w := min(len(t[0]), min(len(t[1]), len(t[2])))
	fmt.Println(w)
	for i := 0; i < w; i++ {
		fmt.Println(t[0][i], t[1][i], t[2][i])
	}
}

package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	data := make([][]int, 3)
	for i := 0; i < 3; i++ {
		data[i] = make([]int, 0)
	}
	for i := 1; i <= n; i++ {
		var x int
		fmt.Scan(&x)
		x--
		data[x] = append(data[x], i)
	}
	res := make([][]int, 0)
	for allNotEmpty(data) {
		newTeam := make([]int, 3)
		for i := 0; i < 3; i++ {
			newTeam[i] = data[i][0]
			data[i] = data[i][1:]
		}
		res = append(res, newTeam)
	}
	fmt.Printf("%v\n", len(res))
	for _, team := range res {
		fmt.Printf("%v %v %v\n", team[0], team[1], team[2])
	}
}

func allNotEmpty(a [][]int) bool {
	for _, b := range a {
		if len(b) == 0 {
			return false
		}
	}
	return true
}

package main

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

func scanInt(scanner *bufio.Scanner) int {
	scanner.Scan()
	x, _ := strconv.Atoi(scanner.Text())
	return x
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	writer := bufio.NewWriter(os.Stdout)
	defer writer.Flush()
	n := scanInt(scanner)
	part := make([][]int, 3)
	for i := 0; i < 3; i++ {
		part[i] = []int{}
	}
	for i := 1; i <= n; i++ {
		x := scanInt(scanner)-1
		part[x] = append(part[x], i)
	}
	count := len(part[0])
	if count > len(part[1]) {
		count = len(part[1])
	}
	if count > len(part[2]) {
		count = len(part[2])
	}
	writer.WriteString(fmt.Sprintf("%d\n", count))
	for i := 0; i < count; i++ {
		writer.WriteString(fmt.Sprintf("%d %d %d\n",
				part[0][i], part[1][i], part[2][i]))
	}
}

package main

import (
	"fmt"
)

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

func main() {
	var n, t int
	fmt.Scanf("%d \n", &n)
	myMap := make(map[int][]int)
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &t)
		myMap[t] = append(myMap[t], i+1)
	}
	count := min(len(myMap[1]), min(len(myMap[2]), len(myMap[3])))
	fmt.Println(count)
	for i := 0; i < count; i++ {
		fmt.Println(myMap[1][i], myMap[2][i], myMap[3][i])
	}
}

package main

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

var (
	n      int
	skill  [][]int
	result int
)

func in() {
	skill = make([][]int, 3)
	read(&n)
	var s int
	for i := 0; i < n; i++ {
		read(&s)
		skill[s-1] = append(skill[s-1], i+1)
	}
}

func out() {
	defer output.Flush()
}

func run() {
	w := len(skill[0])
	if len(skill[1]) < w {
		w = len(skill[1])
	}
	if len(skill[2]) < w {
		w = len(skill[2])
	}
	println(w)
	for i := 0; i < w; i++ {
		println(skill[0][i], skill[1][i], skill[2][i])
	}
}

/** main **/
func main() {
	in()
	run()
	out()
}

// Input & Output
var (
	input  = bufio.NewReader(os.Stdin)
	output = bufio.NewWriter(os.Stdout)
)

func read(a ...interface{}) {
	_, err := fmt.Fscan(input, a...)
	if err != nil {
		println(err)
	}
}

func println(a ...interface{}) {
	fmt.Fprintln(output, a...)
}

func printf(format string, a ...interface{}) {
	fmt.Fprintf(output, format, a...)
}

package main

import "fmt"

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

func main() {
	var n int
	fmt.Scan(&n)
	// students := make(map[int]int)
	studentsSkill1 := []int{}
	studentsSkill2 := []int{}
	studentsSkill3 := []int{}
	var ns1, ns2, ns3 int
	for i := 0; i < n; i++ {
		var skill int
		fmt.Scan(&skill)
		if skill == 1 {
			studentsSkill1 = append(studentsSkill1, i+1)
			ns1++
		} else if skill == 2 {
			studentsSkill2 = append(studentsSkill2, i+1)
			ns2++
		} else if skill == 3 {
			studentsSkill3 = append(studentsSkill3, i+1)
			ns3++
		}
	}
	// fmt.Println(studentsSkill1)
	// fmt.Println(studentsSkill2)
	// fmt.Println(studentsSkill3)
	minTeams := min(min(ns1, ns2), ns3)
	fmt.Println(minTeams)
	for i := 0; i < minTeams; i++ {
		fmt.Print(studentsSkill1[i])
		fmt.Print(" ")
		fmt.Print(studentsSkill2[i])
		fmt.Print(" ")
		fmt.Println(studentsSkill3[i])
	}

}

package main

import (
	"fmt"
	"math"
)

func main()  {
	var w int
	fmt.Scan(&w)
	t := make([]int,w)
	readN(t,0,w)
	m := map[int][]int{
		1 : make([]int, 0,w),
		2 : make([]int, 0,w),
		3 : make([]int, 0,w),
	}
	for i,v := range t {
		m[v] = append(m[v], i+1)
	}
	i := math.Min(float64(len(m[1])),math.Min(float64(len(m[2])),float64(len(m[3]))))
	fmt.Println(i)
	for j:=0;j<int(i);j++{
		fmt.Printf("%d %d %d\n",m[1][j],m[2][j],m[3][j])
	}
}

func readN(all []int, i, n int) {
    if n == 0 {
        return
    }
    if m, err := scan(&all[i]); m != 1 {
        panic(err)
    }
    readN(all, i+1, n-1)
}

func scan(a *int) (int, error) {
    return fmt.Scan(a)
}

package main
import (
	"fmt"
)

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

func main() {
	var n int
	fmt.Scan(&n)
	var w int
	var counter1, counter2, counter3 int = 0,0,0
	var arr1,arr2, arr3 []int
	for i := 0; i < n; i++ {
		fmt.Scan(&w)
		if w == 1{
			arr1 = append(arr1,i+1)
			counter1++
		}else if w == 2{
			arr2 = append(arr2,i+1)
			counter2++
		}else{
			arr3 = append(arr3,i+1)
			counter3++
		}
	}
	minn := min(min(counter1,counter2),counter3)
	fmt.Println(minn)
	for i := 0; i < minn; i++{
		output := fmt.Sprintf("%d %d %d", arr1[i], arr2[i], arr3[i])
		fmt.Println(output)
	}

}

package main

import (
	"fmt"
)

func main() {
	var n int

	fmt.Scan(&n)

	var t int
	var fields [3][]int

	for i := 0; i < 3; i++ {
		fields[i] = make([]int, 0)
	}

	for i := 1; i <= n; i++ {
		fmt.Scan(&t)
		t--
		fields[t] = append(fields[t], i)
	}

	min := len(fields[0])
	for i := 1; i < 3; i++ {
		if len(fields[i]) < min {
			min = len(fields[i])
		}
	}

	fmt.Println(min)

	for i := 0; i < min; i++ {
		fmt.Println(fields[0][i], fields[1][i], fields[2][i])
	}
}

package main

import "fmt"

func main() {
	var i, tmp, ll int
	var s1, s2, s3 []int
	fmt.Scanf("%d\n", &i)

	for j:=0;j<i;j++  {
		fmt.Scanf("%d", &tmp)
		if tmp == 1 {
			s1 = append(s1, j+1)
		} else if tmp == 2 {
			s2 = append(s2, j+1)
		} else {
			s3 = append(s3, j+1)
		}
	}
	ll = min(s1,s2,s3)
	fmt.Println(ll)
	for k := 0; k < ll;k++  {
		fmt.Print(s1[k], s2[k], s3[k], "\n")
	}

}

func min(s1, s2, s3 []int) int {
	if len(s1) < len(s2) {
		if len(s1) < len(s3) {
			return len(s1)
		}
		return len(s3)
	} else {
		if len(s2) < len(s3) {
			return len(s2)
		}
		return len(s3)
	}
}

package main

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

const MAXN = int(5e3 + 10)

var A,B,C [MAXN] int

func min(a, b int) int{

    var ret int
    if a < b {
        ret = a
    }else {

        ret = b
    }
    return ret

}

func main(){

    reader := bufio.NewReader(os.Stdin)
    var n int
    fmt.Fscan(reader,&n)
    var a,b,c int
    for i := 1 ;i <= n; i ++ {
        var x int
        fmt.Fscan(reader,&x)
        if 1 == x {
            a ++
            A[a] = i

        }else if(2 == x){

            b ++
            B[b] = i
        }else {
            c ++
            C[c] = i
        }

    }
    ans := min(a,min(b,c))
    fmt.Println(ans)
    for i:=1;i <= ans; i ++ {

        fmt.Printf("%d %d %d\n",A[i],B[i],C[i])
    }

}

package main

import (
	"fmt"
)

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

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

	students := make([]int, 0)
	for i := 0; i < N; i++ {
		var C int
		fmt.Scanf("%d", &C)
		students = append(students, C)
	}

	m := map[int][]int{1: []int{}, 2: []int{}, 3: []int{}}

	for index, student := range students {
		m[student] = append(m[student], index+1)
	}
	teams := 1000000
	for _, v := range m {
		teams = min(teams, len(v))
	}
	fmt.Printf("%d\n", teams)
	if teams == 0 {
		return
	}

	for i := 0; i < teams; i++ {
			fmt.Printf("%d %d %d\n", m[1][i], m[2][i], m[3][i])
	}
}

package main

import (
	"fmt"
)

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

func main() {
	var n int
	fmt.Scan(&n)
	t := make([][]int, 3)
	for i := 0; i < 3; i++ {
		t[i] = make([]int, 0, 5000)
	}
	for i := 1; i <= n; i++ {
		var x int
		fmt.Scan(&x)
		x--
		t[x] = append(t[x], i)
	}
	z := 1 << 30
	for i := 0; i < 3; i++ {
		z = min(z, len(t[i]))
	}
	fmt.Println(z)
	for i := 0; i < z; i++ {
		fmt.Printf("%d %d %d\n", t[0][0], t[1][0], t[2][0])
		for j := 0; j < 3; j++ {
			t[j] = t[j][1:]
		}
	}
}

package main

import "fmt"

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

func main() {
	var n int
	fmt.Scan(&n)
	var ts [5000]int
	for i := 0; i < n; i++ {
		var t int
		fmt.Scan(&t)
		ts[i] = t - 1
	}
	var fs [3]int
	for i := 0; i < n; i++ {
		fs[ts[i]]++
	}
	w := min(fs[0], min(fs[1], fs[2]))
	fmt.Println(w)
	printTeam := func() {
		findFirst := func(x int) int {
			for i := 0; i < n; i++ {
				t := ts[i]
				if x == t {
					ts[i] = -1
					return i + 1
				}
			}
			panic("do not reach here")
		}
		fmt.Printf("%d %d %d\n", findFirst(0), findFirst(1), findFirst(2))
	}
	for i := 0; i < w; i++ {
		printTeam()
	}
}

package main

import "fmt"

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

	var subjects [3][]int

	v := 0
	for i := 1; i <= n; i++ {
		fmt.Scan(&v)
		subjects[v-1] = append(subjects[v-1], i)
	}

	min := len(subjects[0])
	if min > len(subjects[1]) {
		min = len(subjects[1])
	}

	if min > len(subjects[2]) {
		min = len(subjects[2])
	}

	fmt.Println(min)
	for i := 0; i < min; i++ {
		fmt.Printf("%d %d %d\n", subjects[0][i], subjects[1][i], subjects[2][i])
	}
}

package main

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

var reader *bufio.Reader

func init() {
	stdin := os.Stdin
	// stdin, _ = os.Open("1.in")
	reader = bufio.NewReaderSize(stdin, 1<<20)
}

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

var n int

func main() {
	fmt.Fscan(reader, &n)
	var m [4][]int
	for i := 1; i <= n; i++ {
		var a int
		fmt.Fscan(reader, &a)
		m[a] = append(m[a], i)
	}
	ans := n
	ans = Min(ans, len(m[1]))
	ans = Min(ans, len(m[2]))
	ans = Min(ans, len(m[3]))
	fmt.Println(ans)
	for i := 0; i < ans; i++ {
		fmt.Println(m[1][i], m[2][i], m[3][i])
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)
type Team struct {
	id uint32
	loc []uint32
}

func main() {
	var n, c1,c2,c3,c uint32
	var t uint32
	m := make(map[uint32]Team)
	in := bufio.NewReader(os.Stdin)
	fmt.Fscanf(in, "%d\n", &n)
	for i:= uint32(0); i < n; i++{
		fmt.Fscanf(in, "%d", &t)
		var team Team
		team = m[t]
		team.id++
		if t == 1{
			c1++
		}else if t == 2{
			c2++
		}else if t ==3{
			c3++
		}
		team.loc = append(team.loc, i)
		m[t] = team
	}
	if c1 != 0 && c2 != 0 && c3 != 0{
		if c2 >= c1 && c3 >= c1 {
			c = c1
		}else if c2 >= c3 && c2 >= c3{
			c = c3
		}else if c1 >= c2 && c3 >= c2{
			c = c2
		}
		fmt.Println(c)
		for i:=uint32(0); i < c; i++{
			if c1 == 0 || c2 == 0 || c3 == 0{
				break
				fmt.Println()
			}
			for _, v := range m {
				fmt.Print(v.loc[0] + 1," ")
				RemoveIndex(v.loc, 0)
			}
			c1--
			c2--
			c3--
			fmt.Println()
		}
	}else{
		fmt.Println(0)
	}
}
func RemoveIndex(s []uint32, index uint32) []uint32 {
    return append(s[:index], s[index+1:]...)
}

package main

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

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

// IO helper functions

// Returns next token from input.  It must be initialized by SetInput()
// before the first call.
var nextToken func() ([]byte, error)
var nextLine func() ([]byte, error)

// Holds a buffer for output.  It must be initialized by SetOutput().
// All IO fucntions (read*() and [e]print*()) should write to OutputWriter
// instead of this.
var OutputBuffer *bufio.Writer

// Holds an io.Writer.  It must be initialized by SetOutput()
var OutputWriter io.Writer

// Set IO functions for interactive input/output.
func SetInteractive(w io.Writer, r io.Reader) {
	SetUnbefferedInput(r)
	OutputBuffer = nil
	OutputWriter = w
}

// Setup OutputBuffer and OutputWriter.
func SetOutput(w io.Writer) {
	OutputBuffer = bufio.NewWriter(w)
	OutputWriter = OutputBuffer
}

// Flushes OutputBuffer
func Flush() {
	if OutputBuffer != nil {
		OutputBuffer.Flush()
	}
}

// Returns true if c is a white space
func IsSpace(c byte) bool {
	switch c {
	case '\t', '\n', '\v', '\f', '\r', ' ':
		return true
	}
	return false
}

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

// Setup nextToken with input buffer.
func SetInput(r io.Reader) {
	buf := new(bytes.Buffer)
	var b []byte

	var i int
	rest := func() ([]byte, error) {
		for i < len(b) && IsSpace(b[i]) {
			i++
		}
		if i == len(b) {
			return nil, io.ErrUnexpectedEOF
		}
		j := i
		for i < len(b) && !IsSpace(b[i]) {
			i++
		}
		return b[j:i], nil
	}
	initial := func() ([]byte, error) {
		io.Copy(buf, r)
		b = buf.Bytes()
		nextToken = rest
		return rest()
	}
	nextToken = initial

	restLn := func() ([]byte, error) {
		for i < len(b) && IsNewLine(b[i]) {
			i++
		}
		if i == len(b) {
			return nil, io.ErrUnexpectedEOF
		}
		j := i
		for i < len(b) && !IsNewLine(b[i]) {
			i++
		}
		return b[j:i], nil
	}

	initialLn := func() ([]byte, error) {
		io.Copy(buf, r)
		b = buf.Bytes()
		nextLine = restLn
		return restLn()
	}
	nextLine = initialLn
}

// Setup nextToken without input buffer.
func SetUnbefferedInput(r io.Reader) {
	buf := bufio.NewReader(r)
	var b []byte

	var i int
	nextToken = func() ([]byte, error) {
		var err error
		if i == len(b) {
			b, err = buf.ReadBytes('\n')
			if err != nil {
				return nil, err
			}
			i = 0
			j := len(b) - 1
			for 0 <= j && IsSpace(b[j]) {
				j--
			}
			b = b[0 : j+1]
		}
		for i < len(b) && IsSpace(b[i]) {
			i++
		}
		j := i
		for i < len(b) && !IsSpace(b[i]) {
			i++
		}
		if i == j {
			return nil, io.ErrUnexpectedEOF
		}
		return b[j:i], nil
	}
}

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

// IO functions

// Reads next token and return it as []byte
func readb() []byte {
	b, err := nextToken()
	if err != nil {
		panic(err)
	}
	return b
}

// Reads next token and return it as string
func reads() string {
	return string(readb())
}

// Read next line as []byte
func readbln() []byte {
	b, err := nextLine()
	if err != nil {
		panic(err)
	}
	return b
}

// Read next line as string
func readsln() string {
	return string(readbln())
}

// Reads next token and return it as int64
func readll() int64 {
	i, err := strconv.ParseInt(reads(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// Reads next token and return it as int
func readi() int {
	return int(readll())
}

// Reads next token and return it as float64
func readf() float64 {
	f, err := strconv.ParseFloat(reads(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// Write args to OutputWriter with the format f
func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(OutputWriter, f, args...)
}

// Write args to OutputWriter without format
func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(OutputWriter, args...)
}

// Write args to stderr with the format f
func eprintf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(os.Stderr, f, args...)
}

// Write args to stderr without format
func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

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

// Simple math functions

const (
	// big prime
	INF  = 1000000007
	INF2 = 1000000009
	INF3 = 998244353
)

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

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

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

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

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

func absll(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

// egcd(a, b) returns d, x, y:
//   d is gcd(a,b)
//   x, y are  integers that satisfy ax + by = d
func egcd(a, b int) (int, int, int) {
	if b == 0 {
		return a, 1, 0
	}
	d, x, y := egcd(b, a%b)
	return d, y, x - a/b*y
}

func egcdll(a, b int64) (int64, int64, int64) {
	if b == 0 {
		return a, 1, 0
	}
	d, x, y := egcdll(b, a%b)
	return d, y, x - a/b*y
}

func gcd(a, b int) int {
	d, _, _ := egcd(a, b)
	return d
}

func gcdll(a, b int64) int64 {
	d, _, _ := egcdll(a, b)
	return d
}

// set up IO functions
func init() {
	// for non-interactive
	SetInput(os.Stdin)
	SetOutput(os.Stdout)

	// Enable below when interactive.  Its ok to leave above intact.
	// SetInteractive(os.Stdout, os.Stdin)
}

func main() {
	defer Flush()

	n := readi()
	t := make([]int, n)
	for i := range t {
		t[i] = readi() - 1
	}
	m := make([][]int, 3)
	for i, v := range t {
		m[v] = append(m[v], i+1)
	}
	l := n + 1
	for i := range m {
		l = min(l, len(m[i]))
	}
	for i := range m {
		m[i] = m[i][:l]
	}
	println(len(m[0]))
	for i := range m[0] {
		println(m[0][i], m[1][i], m[2][i])
	}
}

package main

import "fmt"

var (
	nChild int
	d int
	size int
	a,b,c bool
)

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

func main(){
	teams  := make(map[int][]int)
	fmt.Scanf("%d\n", &nChild)
	for i:=1; i<=nChild; i++{
		fmt.Scan(&d)
		teams[d] = append(teams[d], i)
	}
	programming, _ := teams[1]
	maths, _ := teams[2]
	sports, _ := teams[3]
	lessPossibleTeams := min(len(programming), len(maths))
	lessPossibleTeams = min(lessPossibleTeams, len(sports))
	fmt.Println(lessPossibleTeams)
	for x := 0; x<lessPossibleTeams; x++{
		fmt.Printf("%d %d %d\n", programming[x], maths[x], sports[x] )
	}
}

package main

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

func main() {
	var n, maxTeams, countProgs, countMaths, countPES int
	reader := bufio.NewReader(os.Stdin)
	fmt.Fscan(reader, &n)
	arrayOfChilds := make([]int, n)
	var arrayOfProg, arrayOfMath, arrayOfPE []int
	for index := 0; index < n; index++ {
		fmt.Fscan(reader, &arrayOfChilds[index])
	}
	for index := 0; index < n; index++ {
		if arrayOfChilds[index] == 1 {
			arrayOfProg = append(arrayOfProg, index+1)
		} else if arrayOfChilds[index] == 2 {
			arrayOfMath = append(arrayOfMath, index+1)
		} else {
			arrayOfPE = append(arrayOfPE, index+1)
		}
	}
	maxTeams = 0
	countProgs = len(arrayOfProg)
	countMaths = len(arrayOfMath)
	countPES = len(arrayOfPE)

	if countProgs < countMaths {
		maxTeams = countProgs
		if countProgs > countPES {
			maxTeams = countPES
		}
	} else {
		maxTeams = countMaths
		if countMaths > countPES {
			maxTeams = countPES
		}
	}

	fmt.Println(maxTeams)
	for index := 0; index < maxTeams; index++ {
		fmt.Print(arrayOfProg[index], " ", arrayOfMath[index], " ", arrayOfPE[index])
		fmt.Println()
	}
}

package main

import "fmt"

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

func main()  {
  var N int

  fmt.Scanf("%d\n", &N)
  T := make(map[int][]int)

  for i := 1; i <= N; i++ {
    var t int
    fmt.Scanf("%d", &t)
    T[t] = append(T[t], i)
  }

  var t1, t2, t3 int = 0, 0, 0

  maxTeams := min(len(T[1]), min(len(T[2]), len(T[3])))
  fmt.Println(maxTeams)

  for i := 0; i < maxTeams; i++ {
    fmt.Println(T[1][t1], T[2][t2], T[3][t3])
    t1++
    t2++
    t3++
  }
}

package main

import "fmt"

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

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

func main() {
	var a []int
	var b []int
	var c []int
	var n, x int
	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		fmt.Scan(&x)
		switch x {
		case 1:
			a = append(a, i+1)
		case 2:
			b = append(b, i+1)
		case 3:
			c = append(c, i+1)
		}
	}
	ans := min(len(a), min(len(b), len(c)))
	fmt.Println(ans)
	for i := 0; i < ans; i++ {
		fmt.Println(a[i], b[i], c[i])
	}
}

package main

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

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

// https://codeforces.com/problemset/problem/490/A
// комментарии к решению
// Входной поток состоит только из цифр 1, 2 и 3, поэтому можно
// считать его как []byte и разобрать посимвольно.
// Т.к. для ответа требуется указывать порядковые номера, то
// распределяем учеников по группам с соответствующими способностями
func taskSolution(in []byte, n int) (ans string) {
	type s []int
	children := map[byte]s{
		'1': s{},
		'2': s{},
		'3': s{},
	}
	// no overflow потому что мы знаем объем входных данных
	for i, pos := 1, 0; i <= n; i, pos = i+1, pos+1 {
		// find next
		for in[pos] < '1' || in[pos] > '3' {
			pos += 1
		}
		children[in[pos]] = append(children[in[pos]], i)
	}
	// calculate
	count := min(len(children['1']), len(children['2']))
	count = min(count, len(children['3']))
	ans = fmt.Sprint(count)
	for i := 0; i < count; i += 1 {
		ans = fmt.Sprintf("%s\n%d %d %d", ans, children['1'][i], children['2'][i], children['3'][i])
	}
	return ans
}

func main() {
	var n int
	if _, err := fmt.Scan(&n); err != nil {
		panic(err)
	}

	inRaw, err := ioutil.ReadAll(os.Stdin)
	if err != nil {
		panic(err)
	}

	fmt.Println(taskSolution(inRaw, n))
}

package main

import "fmt"

func main() {
  var n int
  fmt.Scan(&n)
  var programming []int
  var math []int
  var PE []int

  var skill int

  for i:=1; i <= n; i++ {
    fmt.Scan(&skill)
    if skill == 1 {
      programming = append(programming, i)
    }
    if skill == 2 {
      math = append(math, i)
    }
    if skill == 3 {
      PE = append(PE, i)
    }
  }
  noOfTeams := 0

  if len(programming) <= len(math) && len(programming) <= len(PE) {
    noOfTeams = len(programming)
  }

  if len(math) <= len(programming) && len(math) <= len(PE) {
    noOfTeams = len(math)
  }

  if len(PE) <= len(programming) && len(PE) <= len(math) {
    noOfTeams = len(PE)
  }
  fmt.Println(noOfTeams)
  for i := 0; i<noOfTeams; i++ {
    fmt.Println(fmt.Sprint(programming[i],math[i],PE[i]))
  }
}

package main

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

func main() {
	var n, t int
	fmt.Scanf("%d \n", &n)
	count := 0
	reader := bufio.NewReader(os.Stdin)
	ss, _ := reader.ReadString('\n')
	list := strings.Split(strings.TrimRight(ss, "\r\n"), " ")
	arr := [][]int{[]int{}, []int{}, []int{}}
	for i := 0; i < n; i++ {
		temp, _ := strconv.ParseInt(list[i], 10, 64)
		t = int(temp) - 1
		arr[t] = append(arr[t], i+1)
		if len(arr[0]) > count && len(arr[1]) > count && len(arr[2]) > count {
			fmt.Println(arr[0][count], arr[1][count], arr[2][count])
			count++
		}
	}
	if count == 0 {
		fmt.Print(count)
	}
}

package main

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

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}
func main() {
	var n int
	fmt.Scanf("%d \n", &n)
	reader := bufio.NewReader(os.Stdin)
	line, _ := reader.ReadString('\n')
	n = max(strings.Count(line, "1"), max(strings.Count(line, "2"), strings.Count(line, "3")))
	fmt.Print(n)
}

package main
import (
	"fmt"
)

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

func main() {
	var n int
	fmt.Scan(&n)
	var w int
	var counter1, counter2, counter3 int = 0,0,0
	var arr1,arr2, arr3 []int
	for i := 0; i < n; i++ {
		fmt.Scan(&w)
		if w == 1{
			arr1 = append(arr1,i)
			counter1++
		}else if w == 2{
			arr2 = append(arr2,i)
			counter2++
		}else{
			arr3 = append(arr3,i)
			counter3++
		}
	}
	minn := min(min(counter1,counter2),counter3)
	fmt.Println(minn)
	for i := 0; i < minn; i++{
		output := fmt.Sprintf("%d %d %d", arr1[i], arr2[i], arr3[i])
		fmt.Println(output)
	}

}

package main

import "fmt"

func main() {
	var i, j, k, tmp, ll int
	var s1, s2, s3 []int
	fmt.Scanf("%d", &i)

	for j=0;j<i;j++  {
		fmt.Scanf("%d", &tmp)
		if tmp == 1 {
			s1 = append(s1, j+1)
		} else if tmp == 2 {
			s2 = append(s2, j+1)
		} else {
			s3 = append(s3, j+1)
		}
	}
	ll = min(s1,s2,s3)
	fmt.Println(ll)
	for k = 0; k < ll;k++  {
		fmt.Print(s1[k], s2[k], s3[k], "\n")
	}

}

func min(s1, s2, s3 []int) int {
	if len(s1) < len(s2) {
		if len(s1) < len(s3) {
			return len(s1)
		}
		return len(s3)
	} else {
		if len(s2) < len(s3) {
			return len(s2)
		}
		return len(s3)
	}
}

package main

import "fmt"

func main() {
	var i, j, k, tmp int
	var s1, s2, s3 []int
	fmt.Scanf("%d", &i)

	for j=0;j<i;j++  {
		fmt.Scanf("%d", &tmp)
		if tmp == 1 {
			s1 = append(s1, j+1)
		} else if tmp == 2 {
			s2 = append(s2, j+1)
		} else {
			s3 = append(s3, j+1)
		}
	}
	ll := min(s1,s2,s3)
	fmt.Println(ll)
	for k = 0; k < ll;k++  {
		fmt.Println(s1[k], s2[k], s3[k])
	}

}

func min(s1, s2, s3 []int) int {
	if len(s1) < len(s2) {
		if len(s1) < len(s3) {
			return len(s1)
		}
		return len(s3)
	} else {
		if len(s2) < len(s3) {
			return len(s2)
		}
		return len(s3)
	}
}

package main

import "fmt"

func main() {
	var i, j, k, tmp int
	var s1, s2, s3 []int
	fmt.Scanf("%d", &i)

	for j=0;j<i;j++  {
		fmt.Scanf("%d", &tmp)
		if tmp == 1 {
			s1 = append(s1, j+1)
		} else if tmp == 2 {
			s2 = append(s2, j+1)
		} else {
			s3 = append(s3, j+1)
		}
	}
	ll := min(s1,s2,s3)
	fmt.Println(ll)
	for k = 0; k < ll;k++  {
		fmt.Print(s1[k], s2[k], s3[k], "\n")
	}

}

func min(s1, s2, s3 []int) int {
	if len(s1) < len(s2) {
		if len(s1) < len(s3) {
			return len(s1)
		}
		return len(s3)
	} else {
		if len(s2) < len(s3) {
			return len(s2)
		}
		return len(s3)
	}
}

package main

import "fmt"

func main() {
    fmt.Println("Hello, 世界")
}

package main

import (
	"fmt"
)

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

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

	students := make([]int, 0)
	for i := 0; i < N; i++ {
		var C int
		fmt.Scanf("%d", &C)
		students = append(students, C)
	}

	m := map[int]int{1: 0, 2: 0, 3: 0}

	for _, i := range students {
		m[i] += 1
	}
	limit := 100000
	for _, v := range m {
		limit = min(limit, v)
	}

	num_teams := limit
	fmt.Printf("%d\n", num_teams)
	if num_teams == 0 {
		return
	}
	for i := 0; i < N; i++ {
		if num_teams == 0 {
			break
		}

		if students[i] < 0 {
			continue
		}
		temp := map[int]bool{1: false, 2: false, 3: false}
		temp[students[i]] = true
		team := make([]int, 0)
		team = append(team, i)
		students[i] *= -1
		for j := i + 1; j < N; j++ {
					if len(team) == 3 {
						break
					}
					if students[j] < 0 {
						continue
					}

					if !temp[students[j]] {
						team = append(team, j)
						temp[students[j]] = true
						students[j] *= -1
					}
		}
		num_teams -= 1
		fmt.Printf("%d %d %d\n", team[0], team[1], team[2])
	}
}

package main

import (
	"fmt"
)

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

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

	students := make([]int, 0)
	for i := 0; i < N; i++ {
		var C int
		fmt.Scanf("%d", &C)
		students = append(students, C)
	}

	m := map[int][]int{1: []int{}, 2: []int{}, 3: []int{}}

	for index, student := range students {
		m[student] = append(m[student], index)
	}
	teams := 1000000
	for _, v := range m {
		teams = min(teams, len(v))
	}
	fmt.Printf("%d\n", teams)
	if teams == 0 {
		return
	}

	for i := 0; i < teams; i++ {
			fmt.Printf("%d %d %d\n", m[1][i], m[2][i], m[3][i])
	}
}

package main

import (
	"fmt"
)

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

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

	students := make([]int, 0)
	for i := 0; i < N; i++ {
		var C int
		fmt.Scanf("%d", &C)
		students = append(students, C)
	}

	m := map[int]int{1: 0, 2: 0, 3: 0}

	for _, i := range students {
		m[i] += 1
	}
	limit := 100000
	for _, v := range m {
		limit = min(limit, v)
	}

	num_teams := limit
	fmt.Printf("%d\n", num_teams)
	if num_teams == 0 {
		return
	}
	for i := 0; i < N; i++ {
		if num_teams == 0 {
			break
		}

		if students[i] < 0 {
			continue
		}
		temp := map[int]bool{1: false, 2: false, 3: false}
		temp[students[i]] = true
		team := make([]int, 0)
		team = append(team, i+1)
		students[i] *= -1
		for j := i + 1; j < N; j++ {
					if len(team) == 3 {
						break
					}
					if students[j] < 0 {
						continue
					}

					if !temp[students[j]] {
						team = append(team, j+1)
						temp[students[j]] = true
						students[j] *= -1
					}
		}
		num_teams -= 1
		fmt.Printf("%d %d %d\n", team[0], team[1], team[2])
	}
}

package main

import (
	"fmt"
)

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

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

	students := make([]int, 0)
	for i := 0; i < N; i++ {
		var C int
		fmt.Scanf("%d", &C)
		students = append(students, C)
	}

	m := map[int][]int{1: []int{}, 2: []int{}, 3: []int{}}

	for index, student := range students {
		m[student] = append(m[student], index)
	}
	teams := 1000000
	for _, v := range m {
		teams = min(teams, len(v))
	}
	fmt.Printf("%d\n", teams)
	if teams == 0 {
		return
	}

	for i := 0; i < teams; i++ {
			fmt.Printf("%d %d %d\n", m[1][i], m[2][i], m[3][i])
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)
type Team struct {
	id uint32
	loc []uint32
}

func main() {
	var n, c1,c2,c3 uint32
	var t uint32
	m := make(map[uint32]Team)
	in := bufio.NewReader(os.Stdin)
	fmt.Fscanf(in, "%d\n", &n)
	for i:= uint32(0); i < n; i++{
		fmt.Fscanf(in, "%d", &t)
		var team Team
		team = m[t]
		team.id++
		if t == 1{
			c1++
		}else if t == 2{
			c2++
		}else if t ==3{
			c3++
		}
		team.loc = append(team.loc, i)
		m[t] = team
	}
	if c1 != 0 && c2 != 0 && c3 != 0{
		c := c1 + c2 + c3
		c = c/3
		fmt.Println(c)
		for i:=uint32(0); i < c; i++{
			if c1 == 0 || c2 == 0 || c3 == 0{
				break
				fmt.Println()
			}
			for _, v := range m {
				fmt.Print(v.loc[0] + 1," ")
				RemoveIndex(v.loc, 0)
			}
			c1--
			c2--
			c3--
			fmt.Println()
		}
	}else{
		fmt.Println(0)
	}
}
func RemoveIndex(s []uint32, index uint32) []uint32 {
    return append(s[:index], s[index+1:]...)
}

package main

import (
	"bufio"
	"fmt"
	"os"
)
type Team struct {
	id uint16
	loc []uint16
}

func main() {
	var n, c1,c2,c3 uint16
	var t uint16
	m := make(map[uint16]Team)
	in := bufio.NewReader(os.Stdin)
	fmt.Fscanf(in, "%d\n", &n)
	for i:= uint16(0); i < n; i++{
		fmt.Fscanf(in, "%d", &t)
		var team Team
		team = m[t]
		team.id++
		if t == 1{
			c1++
		}else if t == 2{
			c2++
		}else if t ==3{
			c3++
		}
		team.loc = append(team.loc, i)
		m[t] = team
	}
	if c1 != 0 && c2 != 0 && c3 != 0{
		c := c1 + c2 + c3
		c = c/3
		fmt.Println(c)
		for i:=uint16(0); i < c; i++{
			for _, v := range m {
				fmt.Print(v.loc[0] + 1," ")
				RemoveIndex(v.loc, 0)
			}
			fmt.Println()
		}
	}else{
		fmt.Println(0)
	}
}
func RemoveIndex(s []uint16, index uint16) []uint16 {
    return append(s[:index], s[index+1:]...)
}

package main

import (
	"bufio"
	"fmt"
	"os"
)
type Team struct {
	id uint16
	loc []uint16
}

func main() {
	var n, c1,c2,c3 uint16
	var t uint16
	m := make(map[uint16]Team)
	in := bufio.NewReader(os.Stdin)
	fmt.Fscanf(in, "%d\n", &n)
	for i:= uint16(0); i < n; i++{
		fmt.Fscanf(in, "%d", &t)
		var team Team
		team = m[t]
		team.id++
		if t == 1{
			c1++
		}else if t == 2{
			c2++
		}else if t ==3{
			c3++
		}
		team.loc = append(team.loc, i)
		m[t] = team
	}
	if c1 != 0 && c2 != 0 && c3 != 0{
		c := c1 + c2 + c3
		c = c/3
		fmt.Println(c)
		for i:=uint16(0); i < c; i++{
			if c1 == 0 || c2 == 0 || c3 == 0{
				break
				fmt.Println()
			}
			for _, v := range m {
				fmt.Print(v.loc[0] + 1," ")
				RemoveIndex(v.loc, 0)
			}
			c1--
			c2--
			c3--
			fmt.Println()
		}
	}else{
		fmt.Println(0)
	}
}
func RemoveIndex(s []uint16, index uint16) []uint16 {
    return append(s[:index], s[index+1:]...)
}


A tree is a connected undirected graph consisting of n vertices and n  -  1 edges. Vertices are numbered 1 through n.Limak is a little polar bear and Radewoosh is his evil enemy. Limak once had a tree but Radewoosh stolen it. Bear is very sad now because he doesn't remember much about the tree — he can tell you only three values n, d and h:  The tree had exactly n vertices.  The tree had diameter d. In other words, d was the biggest distance between two vertices.  Limak also remembers that he once rooted the tree in vertex 1 and after that its height was h. In other words, h was the biggest distance between vertex 1 and some other vertex. The distance between two vertices of the tree is the number of edges on the simple path between them.Help Limak to restore his tree. Check whether there exists a tree satisfying the given conditions. Find any such tree and print its edges in any order. It's also possible that Limak made a mistake and there is no suitable tree – in this case print "-1".

The first line contains three integers n, d and h (2 ≤ n ≤ 100 000, 1 ≤ h ≤ d ≤ n - 1) — the number of vertices, diameter, and height after rooting in vertex 1, respectively.

If there is no tree matching what Limak remembers, print the only line with "-1" (without the quotes). Otherwise, describe any tree matching Limak's description. Print n - 1 lines, each with two space-separated integers – indices of vertices connected by an edge. If there are many valid trees, print any of them. You can print edges in any order.

NoteBelow you can see trees printed to the output in the first sample and the third sample.

package main

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

func main() {
	defer out.Flush()
	n := in.NextInt()
	d := in.NextInt()
	h := in.NextInt()
	if d-h > h || (d == 1 && n != 2) {
		fmt.Fprintln(out, -1)
		return
	}
	addBranch(h)
	n -= h + 1
	if d == h {
		for n > 0 {
			fmt.Fprintln(out, 2, nextVertex())
			n--
		}
		return
	}
	for n > 0 {
		k := d - h
		if k > n {
			k = n
		}
		addBranch(k)
		n -= k
	}
}

func addBranch(h int) {
	p := 1
	for h > 0 {
		v := nextVertex()
		fmt.Fprintln(out, p, v)
		p = v
		h--
	}
}

var vertex = 1

func nextVertex() int {
	vertex++
	return vertex
}

type Edge struct {
	a, b int
}

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

type FastReader struct {
	r   *bufio.Reader
	buf string
}

func NewFastReader(r io.Reader) *FastReader {
	return &FastReader{
		r: bufio.NewReader(r),
	}
}

func (r *FastReader) advance() {
	for len(r.buf) != 0 && r.buf[0] == ' ' {
		r.buf = r.buf[1:]
	}
	for len(r.buf) == 0 {
		var buf bytes.Buffer
		for {
			chunk, more, _ := r.r.ReadLine()
			buf.Write(chunk)
			if !more {
				break
			}
		}
		r.buf = buf.String()
	}
}

func (r *FastReader) NextLine() string {
	r.advance()
	line := r.buf
	r.buf = ""
	return line
}

func (r *FastReader) NextWord() string {
	r.advance()
	var word string
	wordStart := 0
	for i := 0; i < len(r.buf); i++ {
		b := r.buf[i]
		if b == ' ' {
			if i != wordStart {
				word = r.buf[wordStart:i]
				r.buf = r.buf[i:]
				break
			}
			wordStart = i + 1
		}
	}
	if len(word) == 0 {
		word = r.buf
		r.buf = ""
	}
	return word
}

func (r *FastReader) NextInt() int {
	return parseInt(r.NextWord())
}

func parseInt(word string) int {
	sign := 1
	if word[0] == '-' {
		sign = -1
		word = word[1:]
	}
	result := 0
	for i := 0; i < len(word); i++ {
		result = result*10 + int(word[i]) - '0'
	}
	result *= sign
	return result
}

package main

import (
	"fmt"
)

func main() {
	N,D,H,n,i,src := 0,0,0,0,0,0
	fmt.Scanf("%d %d %d\n", &N, &D, &H)
	if 2*H < D || H > D || (H == 1 && D == 1 && N > 2){
		fmt.Printf("-1\n")
		return
	}
	for n=2; n<=H+1; n++ {
		fmt.Printf("%d %d\n", n-1,n)
	}
	if H < D {
		H = D-H
		src = 1
	} else {
		src = 2
		H = 1
	}
	for n <= N {
		fmt.Printf("%d %d\n", src,n)
		n++
		for i=1; i<H && n<=N; i++ {
			fmt.Printf("%d %d\n", n-1,n)
			n++
		}
	}
}

package main

import (
	"fmt"
)

func main() {
	N,D,H,n,i,src := 0,0,0,0,0,0
	fmt.Scanf("%d %d %d\n", &N, &D, &H)
	if 2*H < D || H > D {
		fmt.Printf("-1\n")
		return
	}
	for n=2; n<=H+1; n++ {
		fmt.Printf("%d %d\n", n-1,n)
	}
	if H < D {
		H = D-H
		src = 1
	} else {
		src = 2
		H = 1
	}
	for n <= N {
		fmt.Printf("%d %d\n", src,n)
		n++
		for i=1; i<H && n<=N; i++ {
			fmt.Printf("%d %d\n", n-1,n)
			n++
		}
	}
}

package main

import (
	"fmt"
)

func main() {
	N,D,H,n,i := 0,0,0,0,0
	fmt.Scanf("%d %d %d\n", &N, &D, &H)
	if 2*H < D || H > D {
		fmt.Printf("-1\n")
		return
	}
	for n=2; n<=H+1; n++ {
		fmt.Printf("%d %d\n", n-1,n)
	}
	if H < D {
		H = D-H
	}
	for n <= N {
		fmt.Printf("1 %d\n", n)
		n++
		for i=1; i<H && n<=N; i++ {
			fmt.Printf("%d %d\n", n-1,n)
			n++
		}
	}
}

package main

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

var edges []Edge
var n int

func main() {
	defer out.Flush()
	n = in.NextInt()
	d := in.NextInt()
	h := in.NextInt()
	if d > 2*h || (d == h && d != n-1) {
		fmt.Fprintln(out, -1)
		return
	}
	addBranch(h)
	n -= h + 1
	for n > 0 {
		k := d - h
		if k > n {
			k = n
		}
		addBranch(k)
		n -= k
	}
	for _, e := range edges {
		fmt.Fprintln(out, e.a, e.b)
	}
}

func addBranch(h int) {
	p := 1
	for h > 0 {
		v := nextVertex()
		edges = append(edges, Edge{p, v})
		p = v
		h--
	}
}

var vertex = 1

func nextVertex() int {
	vertex++
	return vertex
}

type Edge struct {
	a, b int
}

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

type FastReader struct {
	r   *bufio.Reader
	buf string
}

func NewFastReader(r io.Reader) *FastReader {
	return &FastReader{
		r: bufio.NewReader(r),
	}
}

func (r *FastReader) advance() {
	for len(r.buf) != 0 && r.buf[0] == ' ' {
		r.buf = r.buf[1:]
	}
	for len(r.buf) == 0 {
		var buf bytes.Buffer
		for {
			chunk, more, _ := r.r.ReadLine()
			buf.Write(chunk)
			if !more {
				break
			}
		}
		r.buf = buf.String()
	}
}

func (r *FastReader) NextLine() string {
	r.advance()
	line := r.buf
	r.buf = ""
	return line
}

func (r *FastReader) NextWord() string {
	r.advance()
	var word string
	wordStart := 0
	for i := 0; i < len(r.buf); i++ {
		b := r.buf[i]
		if b == ' ' {
			if i != wordStart {
				word = r.buf[wordStart:i]
				r.buf = r.buf[i:]
				break
			}
			wordStart = i + 1
		}
	}
	if len(word) == 0 {
		word = r.buf
		r.buf = ""
	}
	return word
}

func (r *FastReader) NextInt() int {
	return parseInt(r.NextWord())
}

func parseInt(word string) int {
	sign := 1
	if word[0] == '-' {
		sign = -1
		word = word[1:]
	}
	result := 0
	for i := 0; i < len(word); i++ {
		result = result*10 + int(word[i]) - '0'
	}
	result *= sign
	return result
}