package main
import ."fmt"

// github.com/EndlessCheng/codeforces-go
func main() {
	var n, a, i, p int
	Scan(&n)
	for q, m := 1, n*n; i < m; i++ {
		if Scan(&a); q >= m || a > 1 && p < m {
			Println((7-a)/3, p/n+1, p/n&(n&1^1)+1+p%n)
			p += 2
		} else {
			Println((11-a)/3, q/n+1, q/n&(n&1^1)^1+q%n)
			q += 2
		}
	}
}

package main
import ."fmt"

// github.com/EndlessCheng/codeforces-go
func main() {
	var n, a, i, p int
	Scan(&n)
	for q, m := 1, n*n; i < m; i++ {
		if Scan(&a); q >= m || a > 1 && p < m {
			c := p%n + 1
			if n&1 == 0 && p/n&1 > 0 {
				c++
			}
			Println((7-a)/3, p/n+1, c)
			p += 2
		} else {
			c := q%n + 1
			if n&1 == 0 && q/n&1 > 0 {
				c--
			}
			Println((11-a)/3, q/n+1, c)
			q += 2
		}
	}
}

package main

import . "fmt"

// github.com/EndlessCheng/codeforces-go
func CF1503B() {
	var n, a int
	Scan(&n)
	for i, p, q, m := 0, 0, 1, n*n; i < m; i++ {
		Scan(&a)
		if q >= m || a > 1 && p < m {
			c := p%n + 1
			if n&1 == 0 && p/n&1 > 0 {
				c++
			}
			if a == 1 {
				Println(3, p/n+1, c)
			} else {
				Println(1, p/n+1, c)
			}
			p += 2
		} else {
			c := q%n + 1
			if n&1 == 0 && q/n&1 > 0 {
				c--
			}
			if a == 2 {
				Println(3, q/n+1, c)
			} else {
				Println(2, q/n+1, c)
			}
			q += 2
		}
	}
}

func main() { CF1503B() }

package main

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

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

	n := readNum(reader)
	a := readNum(reader)

	ask := func(b int, i int, j int, times int) int {
		fmt.Printf("%d %d %d\n", b, i, j)
		if times == n*n {
			return 0
		}
		return readNum(reader)
	}

	solve(n, a, ask)

}

func normalize(s string) string {

	for i := len(s); i > 0; i-- {
		if s[i-1] >= 'a' && s[i-1] <= 'z' {
			return s[:i]
		}
	}
	return ""
}

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

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

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

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

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

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

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

	return i
}

func solve(n int, a int, ask func(b int, i int, j int, times int) int) {
	// if n is even
	// 第一步在1，1处输出b(not a), 如果反馈不是b，可以在紧邻位置输出a
	// 对于位置（i，j), 它被top 和 left控制
	// 如果 top == left, 则没有问题
	que := make([][]Pair, 2)
	for i := 0; i < 2; i++ {
		que[i] = make([]Pair, 0, n*n/2)
	}
	grid := make([][]int, n+1)
	for i := 1; i <= n; i++ {
		grid[i] = make([]int, n+1)
		for j := 1; j <= n; j++ {
			k := (i + j) % 2
			que[k] = append(que[k], Pair{i, j})
		}
	}
	times := 1
	for len(que[0]) > 0 || len(que[1]) > 0 {
		if a == 1 {
			// put 2
			if len(que[0]) > 0 {
				b := 2
				cur := que[0][len(que[0])-1]
				a = ask(b, cur.first, cur.second, times)
				que[0] = que[0][:len(que[0])-1]
			} else {
				b := 3
				cur := que[1][len(que[1])-1]
				a = ask(b, cur.first, cur.second, times)
				que[1] = que[1][:len(que[1])-1]
			}
		} else if a == 2 {
			if len(que[1]) > 0 {
				b := 1
				cur := que[1][len(que[1])-1]
				a = ask(b, cur.first, cur.second, times)
				que[1] = que[1][:len(que[1])-1]
			} else {
				b := 3
				cur := que[0][len(que[0])-1]
				a = ask(b, cur.first, cur.second, times)
				que[0] = que[0][:len(que[0])-1]
			}
		} else {
			if len(que[0]) > 0 {
				b := 2
				cur := que[0][len(que[0])-1]
				a = ask(b, cur.first, cur.second, times)
				que[0] = que[0][:len(que[0])-1]
			} else {
				b := 1
				cur := que[1][len(que[1])-1]
				a = ask(b, cur.first, cur.second, times)
				que[1] = que[1][:len(que[1])-1]
			}
		}
		times++
	}

}

type Pair struct {
	first  int
	second int
}

package main
import ."fmt"

// github.com/EndlessCheng/codeforces-go
func main() {
	var n, a, i, p int
	Scan(&n)
	for q, m := 1, n*n; i < m; i++ {
		if Scan(&a); q >= m || a > 1 && p < m {
			Println((7-a)/3, p/n+1, p%n+1+p/n&(n&1^1))
			p += 2
		} else {
			Println((11-a)/3, q/n+1, q%n+q/n&(n&1^1)^1)
			q += 2
		}
	}
}

package main
import ."fmt"

// github.com/EndlessCheng/codeforces-go
func main() {
	var n, a, i, p int
	Scan(&n)
	for q, m := 1, n*n; i < m; i++ {
		if Scan(&a); q >= m || a > 1 && p < m {
			c := p%n + 1
			if n&1 == 0 && p/n&1 > 0 {
				c++
			}
			Println((4-a)/3*2+1, p/n+1, c)
			p += 2
		} else {
			c := q%n + 1
			if n&1 == 0 && q/n&1 > 0 {
				c--
			}
			Println((5-a)/3*2+1, q/n+1, c)
			q += 2
		}
	}
}

package main

import . "fmt"

// github.com/EndlessCheng/codeforces-go
func CF1503B() {
	var n, a int
	Scan(&n)
	for i, p, q, m := 0, 0, 1, n*n; i < m; i++ {
		Scan(&a)
		if q >= m || a > 1 && p < m {
			c := p%n + 1
			if n&1 == 0 && p/n&1 > 0 {
				c++
			}
			if a == 1 {
				Println(3, p/n+1, c)
			} else {
				Println(1, p/n+1, c)
			}
			p += 2
		} else {
			c := q%n + 1
			if n&1 == 0 && q/n&1 > 0 {
				c--
			}
			if a == 1 {
				Println(2, q/n+1, c)
			} else {
				Println(3, q/n+1, c)
			}
			q += 2
		}
	}
}

func main() { CF1503B() }


// 297A
package main

import (
	"fmt"
)

func main() {
	var a, b string
	var n, m, i int
	a1, b1 := 0, 0
	fmt.Scan(&a, &b)
	n, m = len(a), len(b)
	for i = 0; i < n; i++ {
		if a[i] == '1' {
			a1++
		}
	}
	for i = 0; i < m; i++ {
		if b[i] == '1' {
			b1++
		}
	}
	if a1%2 == 1 {
		a1++
	}
	if a1 >= b1 {
		fmt.Print("YES")
	} else {
		fmt.Print("NO")
	}
}

package main

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

func main(){
	var a, b string
	r := bufio.NewScanner(os.Stdin)
	r.Split(bufio.ScanWords)
	w := bufio.NewWriter(os.Stdout)
	r.Scan()
	a = r.Text()
	r.Scan()
	b = r.Text()
	counta, countb := 0, 0
	for i:=0; i<len(a); i++ {
		if string(a[i]) == "1" {
			counta += 1
		}
	}
	for j:=0; j<len(b); j++ {
		if string(b[j]) == "1" {
			countb += 1
		}
	}
	if counta % 2 == 0 {
		if countb <= counta {
			w.WriteString("YES\n")
		} else {
			w.WriteString("NO\n")
		}
	} else {
		if countb <= counta+1 {
			w.WriteString("YES\n")
		} else {
			w.WriteString("NO\n")
		}
	}
	w.Flush()
}

package main

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

// github.com/EndlessCheng/codeforces-go
func CF297A(in io.Reader, out io.Writer) {
	var s, t string
	Fscan(in, &s, &t)
	if (strings.Count(s, "1")+1)/2*2 >= strings.Count(t, "1") {
		Fprint(out, "YES")
	} else {
		Fprint(out, "NO")
	}
}

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

package main

import (
	. "fmt"
	"strings"
)

// github.com/EndlessCheng/codeforces-go
func main() {
	var s, t string
	Scan(&s, &t)
	if (strings.Count(s, "1")+1)/2*2 >= strings.Count(t, "1") {
		Print("YES")
	} else {
		Print("NO")
	}
}

package main

import "fmt"

func main() {
	a, b := "", ""
	fmt.Scanf("%s\n%s\n", &a, &b)

	na := 0
	for _, c := range a {
		if string(c) == "1" {
			na++
		}
	}
	if na%2 == 1 {
		na++
	}
	for _, c := range b {
		if string(c) == "1" {
			na--
		}
		if na < 0 {
			break
		}
	}
	if na < 0 {
		fmt.Printf("NO\n")
	} else {
		fmt.Printf("YES\n")
	}
}

// 297A-mic
package main

import (
	"fmt"
)

func main() {
	var a, b string
	fmt.Scan(&a, &b)
	var n1, n2 int
	for i := 0; i < len(a); i++ {
		if a[i] == '1' {
			n1++
		}
	}
	for i := 0; i < len(b); i++ {
		if b[i] == '1' {
			n2++
		}
	}
	if n1+(n1%2) >= n2 {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}

// Author: sighduck
// URL: https://codeforces.com/problemset/problem/297/A

package main

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

func getOneCount(s string) int {
	ones := 0
	for _, char := range s {
		if string(char) == "1" {
			ones += 1
		}
	}
	return ones
}

func Solve(a string, b string) string {
	aOneCount, bOneCount := getOneCount(a), getOneCount(b)
	if aOneCount%2 == 0 && aOneCount >= bOneCount {
		return "YES"
	}
	if aOneCount%2 == 1 && aOneCount+1 >= bOneCount {
		return "YES"
	}
	return "NO"
}

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

	var a, b string
	fmt.Fscanf(reader, "%s\n%s\n", &a, &b)

	fmt.Fprintf(writer, "%s\n", Solve(a, b))
}

package main

import "fmt"

func main() {
	a, b := "", ""
	fmt.Scanf("%s\n%s\n", &a, &b)

	na := 0
	for _, c := range a {
		if string(c) == "1" {
			na++
		}
	}
	for _, c := range b {
		if string(c) == "1" {
			na--
		}
		if na < 0 {
			break
		}
	}
	if na < 0 {
		fmt.Printf("NO\n")
	} else {
		fmt.Printf("YES\n")
	}
}

// 297A-mic
package main

import (
	"fmt"
)

func main() {
	var a, b string
	fmt.Scan(&a, &b)
	var n1, n2, i int
	for i = 0; i < len(a); i++ {
		n1 += int(a[i] - '0')
	}
	for i = 0; i < len(b); i++ {
		n2 += int(b[i] - '0')
	}
	if n1+n2%2 > n2 {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}


package main

import (
	"bufio"
	. "fmt"
	"index/suffixarray"
	"io"
	"os"
	"reflect"
	"unsafe"
)

// github.com/EndlessCheng/codeforces-go
func CF873F(_r io.Reader, _w io.Writer) {
	var n int
	var s, forbidden []byte
	Fscan(bufio.NewReader(_r), &n, &s, &forbidden)
	for i, j := 0, n-1; i < j; i++ {
		s[i], s[j] = s[j], s[i]
		forbidden[i], forbidden[j] = forbidden[j], forbidden[i]
		j--
	}

	sa := *(*[]int32)(unsafe.Pointer(reflect.ValueOf(suffixarray.New(s)).Elem().FieldByName("sa").Field(0).UnsafeAddr()))
	rank := make([]int, n)
	for i := range rank {
		rank[sa[i]] = i
	}
	height := make([]int, n)
	h := 0
	for i, sai := range rank {
		if h > 0 {
			h--
		}
		if sai > 0 {
			for j := int(sa[sai-1]); i+h < n && j+h < n && s[i+h] == s[j+h]; h++ {
			}
		}
		height[sai] = h
	}
	type pair struct{ v, i int }
	posL := make([]int, n)
	stack := []pair{{-1, -1}}
	for i, v := range height {
		for {
			if top := stack[len(stack)-1]; top.v < v {
				posL[i] = top.i
				break
			}
			stack = stack[:len(stack)-1]
		}
		stack = append(stack, pair{v, i})
	}
	posR := make([]int, n)
	stack = []pair{{-1, n}}
	for i := n - 1; i >= 0; i-- {
		v := height[i]
		for {
			if top := stack[len(stack)-1]; top.v < v {
				posR[i] = top.i
				break
			}
			stack = stack[:len(stack)-1]
		}
		stack = append(stack, pair{v, i})
	}

	ans := int64(0)
	for i, v := range forbidden {
		if v == '0' {
			ans = int64(n - i)
			break
		}
	}
	prefixSum := make([]int, n+1)
	for i, p := range sa {
		prefixSum[i+1] = prefixSum[i] + int('1'-forbidden[p])
	}
	for i, h := range height {
		if h > 0 {
			if v := int64(h) * int64(prefixSum[posR[i]]-prefixSum[posL[i]]); v > ans {
				ans = v
			}
		}
	}
	Fprint(_w, ans)
}

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

package main

import (
	"bufio"
	. "fmt"
	"index/suffixarray"
	"os"
	"reflect"
	"unsafe"
)

// github.com/EndlessCheng/codeforces-go
func main() {
	var n int
	var s, forbidden []byte
	Fscan(bufio.NewReader(os.Stdin), &n, &s, &forbidden)
	for i, j := 0, n-1; i < j; {
		s[i], s[j] = s[j], s[i]
		forbidden[i], forbidden[j] = forbidden[j], forbidden[i]
		i++
		j--
	}

	sa := *(*[]int32)(unsafe.Pointer(reflect.ValueOf(suffixarray.New(s)).Elem().FieldByName("sa").Field(0).UnsafeAddr()))
	rank := make([]int, n)
	for i := range rank {
		rank[sa[i]] = i
	}
	height := make([]int, n)
	h := 0
	for i, sai := range rank {
		if h > 0 {
			h--
		}
		if sai > 0 {
			for j := int(sa[sai-1]); i+h < n && j+h < n && s[i+h] == s[j+h]; h++ {
			}
		}
		height[sai] = h
	}
	type pair struct{ v, i int }
	posL := make([]int, n)
	stack := []pair{{-1, -1}}
	for i, v := range height {
		for {
			if top := stack[len(stack)-1]; top.v < v {
				posL[i] = top.i
				break
			}
			stack = stack[:len(stack)-1]
		}
		stack = append(stack, pair{v, i})
	}
	posR := make([]int, n)
	stack = []pair{{-1, n}}
	for i := n - 1; i >= 0; i-- {
		v := height[i]
		for {
			if top := stack[len(stack)-1]; top.v < v {
				posR[i] = top.i
				break
			}
			stack = stack[:len(stack)-1]
		}
		stack = append(stack, pair{v, i})
	}

	ans := int64(0)
	for i, v := range forbidden {
		if v == '0' {
			ans = int64(n - i)
			break
		}
	}
	prefixSum := make([]int, n+1)
	for i, p := range sa {
		prefixSum[i+1] = prefixSum[i] + int('1'-forbidden[p])
	}
	for i, h := range height {
		if h > 0 {
			if v := int64(h) * int64(prefixSum[posR[i]]-prefixSum[posL[i]]); v > ans {
				ans = v
			}
		}
	}
	Print(ans)
}

package main

import (
	"bufio"
	. "fmt"
	"index/suffixarray"
	"io"
	"os"
	"reflect"
	"unsafe"
)

// github.com/EndlessCheng/codeforces-go
func CF873F(_r io.Reader, _w io.Writer) {
	var n int
	var s, forbidden []byte
	Fscan(bufio.NewReader(_r), &n, &s, &forbidden)

	for i, j := 0, n-1; i < j; i++ {
		s[i], s[j] = s[j], s[i]
		forbidden[i], forbidden[j] = forbidden[j], forbidden[i]
		j--
	}
	ans := int64(0)
	prefixSum := make([]int, n+1)
	for i, v := range forbidden {
		if ans == 0 && v == '0' {
			ans = int64(n - i)
		}
		prefixSum[i+1] = prefixSum[i] + int(v-'0')
	}

	sa := *(*[]int32)(unsafe.Pointer(reflect.ValueOf(suffixarray.New(s)).Elem().FieldByName("sa").Field(0).UnsafeAddr()))
	rank := make([]int, n)
	for i := range rank {
		rank[sa[i]] = i
	}
	height := make([]int, n)
	h := 0
	for i, sai := range rank {
		if h > 0 {
			h--
		}
		if sai > 0 {
			for j := int(sa[sai-1]); i+h < n && j+h < n && s[i+h] == s[j+h]; h++ {
			}
		}
		height[sai] = h
	}

	type pair struct{ v, i int }
	posL := make([]int, n)
	stack := []pair{{-1, -1}}
	for i, v := range height {
		for {
			if top := stack[len(stack)-1]; top.v < v {
				posL[i] = top.i
				break
			}
			stack = stack[:len(stack)-1]
		}
		stack = append(stack, pair{v, i})
	}
	posR := make([]int, n)
	stack = []pair{{-1, n}}
	for i := n - 1; i >= 0; i-- {
		v := height[i]
		for {
			if top := stack[len(stack)-1]; top.v < v {
				posR[i] = top.i
				break
			}
			stack = stack[:len(stack)-1]
		}
		stack = append(stack, pair{v, i})
	}

	for i, h := range height {
		if h > 0 {
			if v := int64(h) * int64(posR[i]-posL[i]-(prefixSum[posR[i]]-prefixSum[posL[i]])); v > ans {
				ans = v
			}
		}
	}
	Fprint(_w, ans)
}

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


package main

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

/* solution */

func solve() {

	n := readInt()
	l := list.New()

	var max *list.Element
	for i := 0; i < n; i++ {
		e := l.PushBack(readInt())
		if max == nil || max.Value.(int) < e.Value.(int) {
			max = e
		}
	}

	for max.Next() != nil || max.Prev() != nil {
		old := max
		if max.Next() != nil && max.Next().Value.(int) == max.Value.(int)-1 {
			max = max.Next()
		} else if max.Prev() != nil && max.Prev().Value.(int) == max.Value.(int)-1 {
			max = max.Prev()
		} else {
			print("NO")
			return
		}
		l.Remove(old)
	}

	print("YES")

}

/* stubs */

func main() {

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

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

	reader = bufio.NewScanner(f)
	reader.Split(bufio.ScanWords)

	solve()

}

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

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

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

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

//HOWDY! IT'S ME! A HARD BLACKISH DICK MOVE!
package main

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

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

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

//str := PrintlnInts(X...)

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

func main() {
	n := ReadInt()
	a := ReadIntSlice(n)
	for i, j, k := 0, 1, 2; k < n; {
		if a[i] >= a[j] && a[j] <= a[k] {
			fmt.Println("NO")
			return
		}
		i++
		j++
		k++
	}
	fmt.Println("YES")
}

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

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

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

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

func gcd(args ...int) int {
	if len(args) == 0 {
		panic("empty!")
	}
	gcd := args[0]
	for i := 1; i < len(args); i++ {
		gcd = _gcd(gcd, args[i])
	}
	return gcd
}

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

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

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

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

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

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

func readInt_64() int64 {
	return readIntNbits(64)
}

func ReadInt2_64() (int64, int64) {
	return readInt_64(), readInt_64()
}

func ReadInt3_64() (int64, int64, int64) {
	return readInt_64(), readInt_64(), readInt_64()
}

func readInt() int {
	return int(readIntNbits(32))
}

func readIntNbits(n int) int64 {
	i, err := strconv.ParseInt(ReadString(), 0, n)
	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
}

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

// PrintIntsLine returns integers string delimited by a space.
func PrintlnInts(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)
}

package main

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

func main() {
	input := bufio.NewReader(os.Stdin)
	var num int

	_, err := fmt.Fscanf(input, "%d\n", &num)
	if err != nil {
	}

	var pillar = make([]int, num)
	var index, max int

	for i := 0; i < num; i++ {
		_, err := fmt.Fscanf(input, "%v", &pillar[i])
		if pillar[i] > max {
			max = pillar[i]
			index = i
		}
		if err != nil {
		}
	}

	for i, j := 1, 1; ; {
		left := 0
		right := 0
		if index-i >= 0 {
			left = pillar[index-i]
		}
		if index+j < num {
			right = pillar[index+j]
		}
		if index-i < 0 && index+j >= num {
			break
		}

		if left < max && left >= right {
			max = left
			i++
			continue
		}
		if right < max && right > left {
			max = right
			j++
			continue
		}
		fmt.Println("NO")
		return
	}
	fmt.Println("YES")

}

package main

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

func main() {

	//stdin, err := os.Open("test.txt")
	//if err != nil {
	///	panic(err)
	//}
	//defer stdin.Close()
	stdin := os.Stdin
	reader := bufio.NewReaderSize(stdin, 1024*1024)

	//stdout, err := os.Create("test.txt")
	//if err != nil {
	//	panic(err)
	//}
	//defer stdout.Close()
	stdout := os.Stdout
	writer := bufio.NewWriterSize(stdout, 1024*1024)

	var n, c, p, f int

	fmt.Fscanf(reader, "%d\n", &n)

	a := make([]int, n, n)
	m := make(map[int]bool)

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

		fmt.Fscanf(reader, "%d", &a[i])
		m[a[i]] = true
		if i > 0 {
			c = a[i] - a[i-1]
			if i == 0 {
				p = c
			}
			if (p > 0 && c < 0) || (p < 0 && c > 0) || (p == 0 && c < 0) || (p < 0 && c == 0) {
				//fmt.Println("+")
				f++
			}
			//fmt.Println(p, c)
			p = c
		}
	}

	if (f == 1 || f == 0) && len(m) == n {
		fmt.Fprintf(writer, "YES\n")
	} else {
		fmt.Fprintf(writer, "NO\n")
	}

	writer.Flush()
}

// Author: sighduck
// URL: https://codeforces.com/contest/1197/problem/B

package main

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

func Solve(n int, a []int) string {
	maxIndex := -1
	maxElem := 0
	for i, elem := range a {
		if elem > maxElem {
			maxIndex = i
			maxElem = elem
		}
	}
	for i := 0; i < maxIndex; i++ {
		if !(a[i] < a[i+1]) {
			return "NO"
		}
	}
	for i := n - 1; i > maxIndex; i-- {
		if !(a[i] < a[i-1]) {
			return "NO"
		}
	}
	return "YES"
}

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

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

	fmt.Fprintf(writer, "%s\n", Solve(n, a))
}

package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	scanner.Scan()
	total, _ := strconv.Atoi(scanner.Text())
	arr := make([]int, 0, total)
	for scanner.Scan() {
		e, _ := strconv.Atoi(scanner.Text())
		arr = append(arr, e)
	}
	max := 0
	i := 0
	for ; i < len(arr); i++ {
		v := arr[i]
		if v > max {
			max = v
		} else {
			break
		}
	}
	for ; i < len(arr); i++ {
		v1 := arr[i-1]
		v2 := arr[i]
		if v2 > v1 {
			fmt.Println("NO")
			return
		}
	}
	fmt.Println("YES")
}

package main

import (
	"fmt"
)

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

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

func abs (a, b int) int {
	return max (a, b) - min (a, b)
}

const N = 2 * 1e5 + 5

func main () {

	var x[N] int
	var n int

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

	var a int
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &a)
		x[a] = i + 1
	}

	var left, right int
	left = 1
	right = 1
	for i := n - 1; i >= 1; i-- {
		if x[i] < x[n] {
			if abs (x[i], x[n]) <= left {
				left++
			} else {
				fmt.Println("NO")
				return
			}
		}

		if x[i] > x[n] {
			if abs (x[i], x[n]) <= right {
				right++
			} else {
				fmt.Println("NO")
				return
			}
		}
	}

	fmt.Println("YES")

}

package main

import "fmt"

func main() {
	var num int

	_, err := fmt.Scan(&num)
	if err != nil {
	}

	var pillar = make([]int, num)
	var index, max int

	for i := 0; i < num; i++ {
		_, err := fmt.Scan(&pillar[i])
		if pillar[i] > max {
			max = pillar[i]
			index = i
		}
		if err != nil {
		}
	}

	for i, j := 1, 1; ; {
		left := 0
		right := 0
		if index-i >= 0 {
			left = pillar[index-i]
		}
		if index+j < num {
			right = pillar[index+j]
		}
		if index-i < 0 && index+j >= num {
			break
		}

		if left < max && left >= right {
			max = left
			i++
			continue
		}
		if right < max && right > left {
			max = right
			j++
			continue
		}
		fmt.Println("NO")
		break
	}
	fmt.Println("YES")

}

package main

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

func main() {

	//stdin, err := os.Open("test.txt")
	//if err != nil {
	///	panic(err)
	//}
	//defer stdin.Close()
	stdin := os.Stdin
	reader := bufio.NewReaderSize(stdin, 1024*1024)

	//stdout, err := os.Create("test.txt")
	//if err != nil {
	//	panic(err)
	//}
	//defer stdout.Close()
	stdout := os.Stdout
	writer := bufio.NewWriterSize(stdout, 1024*1024)

	var n, c, p, f int

	fmt.Fscanf(reader, "%d\n", &n)

	a := make([]int, n, n)
	m := make(map[int]bool)

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

		fmt.Fscanf(reader, "%d", &a[i])
		m[a[i]] = true
		if i > 0 {
			c = a[i] - a[i-1]
			if i == 0 {
				p = c
			}
			if (p > 0 && c < 0) || (p < 0 && c > 0) || (p == 0 && c < 0) || (p < 0 && c == 0) {
				//fmt.Println("+")
				f++
			}
			//fmt.Println(p, c)
			p = c
		}
	}

	if f == 1 && len(m) == n {
		fmt.Fprintf(writer, "YES\n")
	} else {
		fmt.Fprintf(writer, "NO\n")
	}

	writer.Flush()
}

package main

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

func main() {

	//stdin, err := os.Open("test.txt")
	//if err != nil {
	///	panic(err)
	//}
	//defer stdin.Close()
	stdin := os.Stdin
	reader := bufio.NewReaderSize(stdin, 1024*1024)

	//stdout, err := os.Create("test.txt")
	//if err != nil {
	//	panic(err)
	//}
	//defer stdout.Close()
	stdout := os.Stdout
	writer := bufio.NewWriterSize(stdout, 1024*1024)

	var n, c, p, f int

	fmt.Fscanf(reader, "%d\n", &n)

	a := make([]int, n, n)
	m := make(map[int]bool)

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

		fmt.Fscanf(reader, "%d", &a[i])
		m[a[i]] = true
		if i > 0 {
			c = a[i] - a[i-1]
			if i == 0 {
				p = c
			}
			if (p > 0 && c < 0) || (p < 0 && c > 0) {
				f++
			}
			p = c
		}
	}

	if f == 1 && len(m) == n {
		fmt.Fprintf(writer, "YES\n")
	} else {
		fmt.Fprintf(writer, "NO\n")
	}

	writer.Flush()
}


package main

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

// github.com/EndlessCheng/codeforces-go
func CF633D(_r io.Reader, out io.Writer) {
	in := bufio.NewReader(_r)
	cnt := map[int]int{}
	var n, v, ans int
	Fscan(in, &n)
	a := []int{}
	for ; n > 0; n-- {
		Fscan(in, &v)
		cnt[v]++
		if v != 0 {
			a = append(a, v)
		}
	}
	if c := cnt[0]; c > 0 {
		ans = c
		a = append(a, 0)
	}
	for i, v := range a {
		for _, w := range a[i+1:] {
			c := 2
			mp := map[int]int{v: 1}
			mp[w]++
			for x, y := v, w; mp[x+y] < cnt[x+y]; x, y = y, x+y {
				mp[x+y]++
				c++
			}
			for x, y := w, v; mp[x-y] < cnt[x-y]; x, y = y, x-y {
				mp[x-y]++
				c++
			}
			if c > ans {
				ans = c
			}
		}
	}
	Fprint(out, ans)
}

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

package main

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

var stdin *bufio.Reader
var stdout *bufio.Writer

func init() {
	stdin = bufio.NewReader(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func lengthOfFib(frequency map[int]int, f1 int, f2 int) int {

	if f1 == 0 && f2 == 0 {
		return frequency[0] + 2
	}

	length := 2

	if frequency[f1+f2] > 0 {
		frequency[f1+f2]--
		length = 1 + lengthOfFib(frequency, f2, f1+f2)
		frequency[f1+f2]++
	}

	return length
}

func main() {

	var (
		n         int
		max       int
		numbers   []int
		frequency map[int]int
	)

	fmt.Fscanf(stdin, "%d\n", &n)

	numbers = make([]int, n)
	frequency = make(map[int]int)

	for i := 0; i < n; i++ {
		fmt.Fscanf(stdin, "%d", &numbers[i])
		frequency[numbers[i]]++
	}

    sort.Ints(numbers)

	max = 0
	for i := 0; i < n; i++ {
        if i > 0 && numbers[i - 1] == numbers[i] {
            continue
        }
		frequency[numbers[i]]--
		for j := 0; j < n; j++ {

			if i == j {
				continue
			}
            if j > 0 && j - 1 != i && numbers[j - 1] == numbers[j] {
                continue
            }

			frequency[numbers[j]]--
			length := lengthOfFib(frequency, numbers[i], numbers[j])

			if length > max {
				max = length
			}
            frequency[numbers[j]]++
		}
        frequency[numbers[i]]++
	}

	fmt.Fprintf(stdout, "%d\n", max)

	stdout.Flush()
}

package main

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

var stdin *bufio.Reader
var stdout *bufio.Writer

func init() {
	stdin = bufio.NewReader(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func lengthOfFib(frequency map[int]int, f1 int, f2 int) int {

	if f1 == 0 && f2 == 0 {
		return frequency[0] + 2
	}

	length := 2

	if frequency[f1+f2] > 0 {
		frequency[f1+f2]--
		length = 1 + lengthOfFib(frequency, f2, f1+f2)
		frequency[f1+f2]++
	}

	return length
}

func main() {

	var (
		n         int
		max       int
		numbers   []int
		frequency map[int]int
	)

	fmt.Fscanf(stdin, "%d\n", &n)

	numbers = make([]int, n)
	frequency = make(map[int]int)

	for i := 0; i < n; i++ {
		fmt.Fscanf(stdin, "%d", &numbers[i])
		frequency[numbers[i]]++
	}

    sort.Ints(numbers)

	max = 0
	for i := 0; i < n; i++ {
        if i > 0 && numbers[i - 1] == numbers[i] {
            continue
        }
		frequency[numbers[i]]--
		for j := 0; j < n; j++ {

			if i == j {
				continue
			}
            if j > 0 && numbers[j - 1] == numbers[j] {
                continue
            }

			frequency[numbers[j]]--
			length := lengthOfFib(frequency, numbers[i], numbers[j])

			if length > max {
				max = length
			}
            frequency[numbers[j]]++
		}
        frequency[numbers[i]]++
	}

	fmt.Fprintf(stdout, "%d\n", max)

	stdout.Flush()
}


package main

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

// github.com/EndlessCheng/codeforces-go
func CF1440B(_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*k)
		for i := range a {
			Fscan(in, &a[i])
		}
		s := int64(0)
		for i, c := n*k, 0; c < k; c++ {
			i -= n/2 + 1
			s += int64(a[i])
		}
		Fprintln(out, s)
	}
}

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

package main

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

// github.com/EndlessCheng/codeforces-go
func CF1440B(_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*k)
		for i := range a {
			Fscan(in, &a[i])
		}
		sort.Ints(a)
		s := int64(0)
		for i, c := n*k, 0; c < k; c++ {
			i -= n/2 + 1
			s += int64(a[i])
		}
		Fprintln(out, s)
	}
}

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

package main

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

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

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

	for ; t > 0; t-- {
		fmt.Fscan(in, &n, &k)
		sum := int64(0)
		offset := n/2 + 1
		nextMedian := (n-offset)*k + 1

		for i := 1; i <= n*k; i++ {
			fmt.Fscan(in, &a)
			if i == nextMedian {
				sum += int64(a)
				nextMedian += offset
			}
		}
		fmt.Println(sum)
	}
}

package main

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

const (
	SCANNER_BUF_SIZE = 2 << 20

	INF = int64(math.MaxInt64)
	MOD = 1e9 + 7
)

var (
	writer  *bufio.Writer
	scanner *bufio.Scanner
)

func init() {
	writer = bufio.NewWriter(os.Stdout)
	scanner = bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, SCANNER_BUF_SIZE), SCANNER_BUF_SIZE)
}

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

func sint64() int64 {
	scanner.Scan()
	bb := scanner.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 suint64() uint64 {
	scanner.Scan()
	bb := scanner.Bytes()
	i := uint64(0)
	for _, b := range bb {
		i *= 10
		i += uint64(b - '0')
	}
	return i
}

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

func main() {
	defer writer.Flush()
	t := sint64()
	for ; t > 0; t-- {
		n, k := sint64(), sint64()
		a := make([]int64, n*k)
		for i := range a {
			a[i] = sint64()
		}
		printf("%d\n", sol(n, k, a))
	}
}

func sol(n, k int64, a []int64) int64 {
	sort.Slice(a, func(il, ir int) bool {
		return a[il] < a[ir]
	})
	var (
		start int64
		jump int64
	)
	if n&1 == 0 {
		p := (n / 2) - 1
		start = p * k
		jump = n - p
	} else {
		p := n / 2
		start = p * k
		jump = n - p
	}
	ret := int64(0)
	for i := start; i < n*k; i += jump {
		ret += a[i]
	}
	return ret
}

package main

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

func solve(in *bufio.Reader, out *bufio.Writer) {
    var n, k int
    fmt.Fscan(in, &n, &k)
    var arr = make([]int, n * k)
    for i := range arr {
        fmt.Fscan(in, &arr[len(arr) - i - 1])
    }
    n = n / 2 + 1
    var ans int64 = 0;
    for i := 1; i <= k; i++ {
        ans += int64(arr[i * n - 1])
    }
    fmt.Fprintln(out, ans)
}

func main() {
    var n int
    var in, out = bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)
    defer out.Flush()
    fmt.Fscan(in, &n)
    for ;n > 0; n-- {
        solve(in, out)
    }
}

package main

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

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

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

	for ; t > 0; t-- {
		fmt.Fscan(in, &n, &k)
		sum := 0
		offset := n/2 + 1
		nextMedian := (n-offset)*k + 1

		for i := 1; i <= n*k; i++ {
			fmt.Fscan(in, &a)
			if i == nextMedian {
				sum += a
				nextMedian += offset
			}
		}
		fmt.Println(sum)
	}
}


package main

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

func main() {
    var n, i int
    var sum, a, minodd int64
    fmt.Scan(&n)

    bs := bufio.NewScanner(os.Stdin)
    bs.Split(bufio.ScanWords)
    minodd = 1e9
    for i = 0; i < n; i++ {
        bs.Scan()
        a, _ = strconv.ParseInt(bs.Text(), 10, 64)
        if a % 2 == 0 {
            sum += a
        } else {
            if minodd > a {
                if minodd != 1e9 {
                    sum += minodd
                }
                minodd = a
            } else {
                sum += a
            }
        }
    }

    if sum % 2 != 0 {
        sum += minodd
    }

    fmt.Println(sum)
}

package main

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

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

	var line string
	scanner := bufio.NewScanner(os.Stdin)

	buf := make([]byte, 0, 64*1024)
	scanner.Buffer(buf, 2048*1024)

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

	integers := strings.Split(line, " ")

	var sum, minOdd uint64
	sum = 0
	minOdd = 10000000001
	for i := 0; i < n; i++ {
		integer, _ := strconv.ParseUint(integers[i], 10, 64)
		sum += integer
		if integer%2 == 1 && integer < minOdd {
			minOdd = integer
		}
	}

	if sum%2 == 0 {
		fmt.Println(sum)
	} else {
		fmt.Println(sum - minOdd)
	}
}


package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	for fmt.Fscan(in, &t); t > 0; t-- {
		var n int
		fmt.Fscan(in, &n)
		if n%3 == 0 {
			fmt.Fprintln(out, n/3, n/3+1, n/3-1)
		} else if n%3 == 1 {
			fmt.Fprintln(out, n/3, n/3+2, n/3-1)
		} else {
			fmt.Fprintln(out, n/3+1, n/3+2, n/3-1)
		}
	}
}

package main

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

const (
	MaxInt32 = 1 << 31 - 1
)

func main(){
	cin := bufio.NewReader(os.Stdin)
	var t int
	fmt.Fscan(cin, &t)
	for tc := 0; tc < t; tc++ {
		var n int
		fmt.Fscan(cin, &n)
		h2, h1, h3 := n / 3, n / 3, n /3
		if n % 3 == 0 {
			h1 += 1
			h3 -= 1
		}else {
			r := n % 3
			h1 += r
			h2 += 1
			h3 -= 1
			if h1 == h2 {
				h1 += 1
				h2 -= 1
			}
		}

		fmt.Printf("%d %d %d\n", h2, h1, h3)
	}
}

package main

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

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

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

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

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

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

/**
Run solve the problem CF1690A
Date: 8/06/22
User: pepradere
URL: https://codeforces.com/problemset/problem/1690/A
Problem: CF1690A
**/
func (in *CF1690A) Run() {
	for t := in.NextInt(); t > 0; t-- {
		n := in.NextInt()
		a, b, c := 2, n-3, 1
		for i := b; i >= 0; i-- {
			if i-1 > 0 && n-i-(i-1) > 0 && n-i-(i-1) < i-1 {
				a = i - 1
				b = i
				c = n - i - (i - 1)
			}
		}
		fmt.Println(a, b, c)
	}
}

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

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

package main

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

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

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

		var h1, h2, h3 int
		h2 = n / 3
		h3 = h2 - 1
		if n%3 == 0 {
			h1 = h2 + 1
		} else if n%3 == 1 {
			h1 = h2 + 2
		} else {
			h1 = h2 + 2
			h2++
		}
		fmt.Fprintln(out, h2, h1, h3)
	}
}

package main

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

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

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

		h3 := n / 3
		h2 := (n - h3) / 2
		h1 := n - h2 - h3
		if h1 == h2 {
			h1++
			h3--
		}

		if h2 == h3 {
			h1++
			h3--
		}

		fmt.Fprintln(out, h2, h1, h3)
	}
}

package main

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

func A1() {
	_in, _out := os.Stdin, os.Stdout
	in, out := bufio.NewReader(_in), bufio.NewWriter(_out)
	defer out.Flush()
	var cas int = 1
	Fscan(in, &cas)
	var sol func()
	// Coding...beg!
	sol = func() {
		var n int
		Fscan(in, &n)
		if n%3 == 0 {
			Fprintln(out, n/3, n/3+1, n/3-1)
		} else if n%3 == 1 {
			Fprintln(out, n/3, n/3+2, n/3-1)
		} else if n%3 == 2 {
			Fprintln(out, n/3+1, n/3+2, n/3-1)
		}

	}
	// Coding...ove!
	for i := 0; i < cas; i++ {
		sol()
	}
}
func main() { A1() }

package main
import(
    "fmt"
)
func main() {
	var t int
	fmt.Scan(&t)
	for i:=0;i<t;i++{
		var n int
		fmt.Scan(&n)
		if n%3 == 0 {
			fmt.Println((n/3),(n/3)+1,(n/3)-1)
		} else if n%3 == 1 {
			fmt.Println((n/3),(n/3)+2,(n/3)-1)
		} else {
			fmt.Println((n/3)+1,(n/3)+2,(n/3)-1)
		}
	}
}

package main

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

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

func solve(n int) string {
	var x, y, z = 2 + (n-6)/3, 3 + (n-6)/3, 1 + (n-6)/3
	if n%3 == 1 {
		y++
	}
	if n%3 == 2 {
		x++
		y++
	}
	return fmt.Sprintf("%d %d %d", x, y, z)
}

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

package main

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

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

func scan(a ...interface{}) {
	fmt.Fscan(in, a...)
}
func printf(f string, a ...interface{}) {
	fmt.Fprintf(out, f, a...)
}
func solve() {
	n := 0
	scan(&n)
	hmin := int((n - 3) / 3)
	// printf("%dabc\n", hmin)
	for ; ; hmin++ {
		h1 := hmin
		h2 := hmin - 1
		for ; h2 > 1; h2-- {
			h3 := n - (h1 + h2)
			if h2 > h3 && h3 > 0 {
				printf("%d %d %d\n", h2, h1, h3)
				return
			}
		}
	}
}
func main() {
	defer out.Flush()
	n := 0
	scan(&n)
	// printf("a")
	for i := 0; i < n; i++ {
		solve()
	}
}

package main

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

func main() {
	in, out := bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)
	defer out.Flush()
	t := 0
	fmt.Fscan(in, &t)
	for ii := 0; ii < t; ii++ {
		n := 0
		fmt.Fscan(in, &n)
		l, h := 0, n
		for l < h {
			one := (l + h) / 2
			two := (n-one)/2 + 1
			if two >= one {
				l = one + 1
			} else {
				h = one
			}
		}
		s := (n-l)/2 + 1
		fmt.Fprintln(out, s, l, n-s-l)
	}

}

package main

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

/*

 */

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

	h1 := n/3 + 1
	h2 := h1 - 1
	h3 := h2 - 1

	rem := n - h1 - h2 - h3

	if rem == 1 {
		h1++
	} else if rem == 2 {
		h1++
		h2++
	}

	fmt.Fprintln(writer, h2, h1, h3)
}

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

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

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

const maxUint = ^uint(0)

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

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

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

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

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

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

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

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

	return minNumIdx
}

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

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

	return maxNumIdx
}

//goland:noinspection GoUnusedFunction
func sum(nums ...int) (sum int) {
	for _, num := range nums {
		sum += num
	}
	return
}

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

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

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

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

	return true
}

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

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

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

	num = abs(num)

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

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

//goland:noinspection GoUnusedFunction
func factorize(num int64) []int64 {
	factors := make([]int64, 0)

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

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

	return factors
}

package main

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

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

func slove() {
	var n int
	fmt.Fscan(r, &n)
	if n % 3 == 0 {
		fmt.Fprintln(w, n/3, n/3+1, n/3-1)
	} else if n % 3 == 1 {
		fmt.Fprintln(w, n/3, n/3+2, n/3-1)
	} else {
		fmt.Fprintln(w, n/3+1, n/3+2, n/3-1)
	}
}

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

package main

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

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

	var T, N int
	for fmt.Fscan(in, &T); T > 0; T-- {
		fmt.Fscan(in, &N)
		t := N / 3
		if N%3 == 0 {
			fmt.Fprintln(out, t, t+1, t-1)
		} else if N%3 == 1 {
			fmt.Fprintln(out, t, t+2, t-1)
		} else {
			fmt.Fprintln(out, t+1, t+2, t-1)
		}
	}
}

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

package main

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

func run(_r io.Reader, _w io.Writer){
    in := bufio.NewScanner(_r)
    out := bufio.NewWriter(_w)
    defer out.Flush()
    in.Split(bufio.ScanWords)
    read := func() (x int) {
        in.Scan()
        for _, v := range in.Bytes() {
            x = x*10 + int(v & 15)
        }
        return
    }
    for t := read(); t > 0; t-- {
        n := read() - 6
        tmp := n % 3
        n /= 3
        switch tmp {
            case 1:
                Fprintln(out, n+2, n+4, n+1)
            case 2:
                Fprintln(out, n+3, n+4, n+1)
            default:
                Fprintln(out, n+2, n+3, n+1)
        }
    }
}

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

package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	t, _ := strconv.Atoi(scanner.Text())
	for i := 0; i < t; i++ {
		scanner.Scan()
		n, _ := strconv.Atoi(scanner.Text())
		if n%3 == 0 {
			fmt.Println(n/3, n/3+1, n/3-1)
		} else if n%3 == 1 {
			fmt.Println(n/3, n/3+2, n/3-1)
		} else {
			fmt.Println(n/3+1, n/3+2, n/3-1)
		}
	}
}

package main

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

var in = bufio.NewReader(os.Stdin)

func main() {
	var t int
	for fmt.Fscan(in, &t); t > 0; t-- {
		var n int
		fmt.Fscan(in, &n)
		if n%3 == 0 {
			fmt.Println(n/3, n/3+1, n/3-1)
		} else if n == 7 {
			fmt.Println(2, 4, 1)
		} else if n%3 == 1 {
			fmt.Println(n/3, n/3+2, n/3-1)
		} else {
			fmt.Println(n/3+1, n/3+2, n/3-1)
		}
	}
}

package main

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

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

	var T, N int
	for fmt.Fscan(in, &T); T > 0; T-- {
		fmt.Fscan(in, &N)
		t := N / 3
		if N%3 == 0 {
			fmt.Fprintln(out, t, t+1, t-1)
		} else if N%3 == 1 {
			fmt.Fprintln(out, t-1, t+1, t-2)
		} else {
			fmt.Fprintln(out, t+1, t+2, t-1)
		}
	}
}

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

package main

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

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

	var T, N int
	for fmt.Fscan(in, &T); T > 0; T-- {
		fmt.Fscan(in, &N)
		t := N / 3
		if N%3 == 0 {
			fmt.Fprintln(out, t, t+1, t-1)
		} else if N%3 == 1 {
			fmt.Fprintln(out, t+1, t+2, t-2)
		} else {
			fmt.Fprintln(out, t+1, t+2, t-1)
		}
	}
}

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

package main

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

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

	var T, N int
	for fmt.Fscan(in, &T); T > 0; T-- {
		fmt.Fscan(in, &N)
		N /= 3
		if N%3 == 0 {
			fmt.Fprintln(out, N, N+1, N-1)
		} else if N%3 == 1 {
			fmt.Fprintln(out, N+1, N+2, N-2)
		} else {
			fmt.Fprintln(out, N+1, N+2, N-1)
		}
	}
}

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

package main

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

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

	var T, N int
	for fmt.Fscan(in, &T); T > 0; T-- {
		fmt.Fscan(in, &N)
		N /= 3
		if N%3 == 0 {
			fmt.Fprintln(out, N, N+1, N-1)
		} else if N%3 == 1 {
			fmt.Fprintln(out, N, N+2, N-1)
		} else {
			fmt.Fprintln(out, N+1, N+2, N-1)
		}
	}
}

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

package main

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

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

	var T, N int
	for fmt.Fscan(in, &T); T > 0; T-- {
		fmt.Fscan(in, &N)
		N--
		if N%2 == 0 {
			fmt.Fprintln(out, N/2-1, N/2+1, 1)
		} else {
			fmt.Fprintln(out, (N-1)/2, (N+1)/2, 1)
		}
	}
}

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

package main

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

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

	var T, N int
	for fmt.Fscan(in, &T); T > 0; T-- {
		fmt.Fscan(in, &N)
		N--
		if N%2 == 0 {
			fmt.Fprintln(out, N-1, N+1, 1)
		} else {
			fmt.Fprintln(out, (N-1)/2, (N+1)/2, 1)
		}
	}
}

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

package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	t, _ := strconv.Atoi(scanner.Text())
	for i := 0; i < t; i++ {
		scanner.Scan()
		n, _ := strconv.Atoi(scanner.Text())
		if n%3 == 0 {
			fmt.Println(n/3, n/3+1, n/3-1)
		} else if n%3 == 1 {
			fmt.Println(n/3, n/3+2, n/3-1)
		} else {
			fmt.Println(n/3, +1, n/3+2, n/3-1)
		}
	}
}

package main

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

var in = bufio.NewReader(os.Stdin)

func main() {
	var t int
	for fmt.Fscan(in, &t); t > 0; t-- {
		var n int
		fmt.Scan(&n)
		if n%3 == 0 {
			fmt.Println(n/3, n/3+1, n/3-1)
		} else if n == 7 {
			fmt.Println(2, 4, 1)
		} else if n%3 == 1 {
			fmt.Println(n/3, n/3+2, n/3-1)
		} else {
			fmt.Println(n/3+1, n/3+2, n/3-1)
		}
	}
}

package main

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

const (
	MaxInt32 = 1 << 31 - 1
)

func main(){
	cin := bufio.NewReader(os.Stdin)
	var t int
	fmt.Fscan(cin, &t)
	for tc := 0; tc < t; tc++ {
		var n int
		fmt.Fscan(cin, &n)
		a, b, c := 2, n - 3, 1
		fmt.Printf("%d %d %d\n", a, b, c)
	}
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	for fmt.Fscan(in, &t); t > 0; t-- {
		var n int
		fmt.Fscan(in, &n)
		fmt.Fprintln(out, n/3, n-n/3*2+1, n/3-1)
	}
}

package main

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

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

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

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

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

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

/**
Run solve the problem CF1690A
Date: 8/06/22
User: pepradere
URL: https://codeforces.com/problemset/problem/1690/A
Problem: CF1690A
**/
func (in *CF1690A) Run() {
	for t := in.NextInt(); t > 0; t-- {
		n := in.NextInt()
		fmt.Println("2", n-3, 1)
	}
}

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

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

package main

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

func A1() {
	_in, _out := os.Stdin, os.Stdout
	in, out := bufio.NewReader(_in), bufio.NewWriter(_out)
	defer out.Flush()
	var cas int = 1
	Fscan(in, &cas)
	var sol func()
	// Coding...beg!
	sol = func() {
		var n int
		Fscan(in, &n)

		Fprintln(out, 2, n-3, 1)
	}
	// Coding...ove!
	for i := 0; i < cas; i++ {
		sol()
	}
}
func main() { A1() }


package main

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

func Abs(x int) int {
	switch {
	case x < 0:
		return -x
	case x == 0:
		return 0
	}
	return x
}

func Scan(args ...interface{}) (e error)             { _, e = fmt.Fscan(in, args...); return }
func Scanf(ft string, args ...interface{}) (e error) { _, e = fmt.Fscanf(in, ft, args...); return }
func Scanln(args ...interface{}) (e error)           { _, e = fmt.Fscanln(in, args...); return }
func Print(args ...interface{})                      { out.WriteString(fmt.Sprint(args...)) }
func Printf(ft string, args ...interface{})          { out.WriteString(fmt.Sprintf(ft, args...)) }
func Println(args ...interface{})                    { out.WriteString(fmt.Sprintln(args...)) }

var (
	dataIn = "data.in"
	in     = bufio.NewReader(os.Stdin)
	//in, _ = os.Open(dataIn)
	out   = bufio.NewWriter(os.Stdout)
)

var bat string

func solve() {
	stack := make([]rune, len(bat))
	top := 0
	cnt := 0
	for _, char := range bat {
		switch char {
		case '<', '{', '[', '(':
			stack[top] = char
			top++
		case '>', '}', ']', ')':
			if top == 0 {
				cnt = -1
				break
			} else {
				if Abs(int(char-stack[top-1])) > 2 {
					cnt++
				}
				top--
			}
		}
	}
	if top > 0 || cnt == -1 {
		Println("Impossible")
	} else {
		Println(cnt)
	}
}

func main() {
	defer out.Flush()
	for Scan(&bat) != io.EOF {
		solve()
	}
	return
}

package main

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

func check(seq string) bool {
	open := 0
	for _, v := range seq {
		if v == '<' || v == '{' || v == '[' || v == '(' {
			open++
		} else {
			open--
			if open < 0 {
				return false
			}
		}
	}
	return open == 0
}

func pair(c rune) rune {
	switch c {
	case '<':
		return '>'
	case '{':
		return '}'
	case '[':
		return ']'
	case '(':
		return ')'
	default:
		panic("no way")
	}
}

func solve(seq string) int {
	ans := 0
	stack := []rune{}
	for _, v := range seq {
		if v == '<' || v == '{' || v == '[' || v == '(' {
			stack = append(stack, pair(v))
		} else {
			if v != stack[len(stack)-1] {
				ans++
			}
			stack = stack[:len(stack)-1]
		}
	}
	return ans
}

func main() {
	in := bufio.NewReader(os.Stdin)
	var seq string
	fmt.Fscanln(in, &seq)
	if !check(seq) {
		fmt.Println("Impossible")
	} else {
		fmt.Println(solve(seq))
	}
}

package main

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

/*
    You are given string s consists of opening and closing brackets of four kinds <>, {}, [], ().
    There are two types of brackets: opening and closing. You can replace any bracket by another of the same type.
    For example, you can replace < by the bracket {, but you can't replace it by ) or >.

    Determine the least number of replaces to make the string s regular braket sequence.
*/

type BracketStack struct {
    Brackets []byte
    Size int
}

func (s *BracketStack) Push(value byte) {
    s.Brackets = append(s.Brackets, value)
    s.Size += 1
}

func (s *BracketStack) Pop() (value byte) {
    if s.Size > 0 {
        value = s.Brackets[s.Size-1]
        s.Brackets = s.Brackets[0:s.Size-1]
        s.Size -= 1
        return value
    }
    return 'n'
}

func main() {
    stin := bufio.NewReader(os.Stdin)
    var s string
    fmt.Fscanln(stin, &s)
    //fmt.Printf("%s\n", s)
    sl := len(s)
    q := BracketStack{Brackets:make([]byte, 0), Size:0}
    answer := 0
    for i := 0; i < sl; i++ {
        if s[i] == '{' || s[i] == '<' || s[i] == '(' || s[i] == '[' {
            q.Push(s[i])
        } else {
            if q.Size == 0 {
                fmt.Printf("Impossible")
                return
            } else {
                currentTop := q.Brackets[q.Size-1]
                if (s[i] == '}' && currentTop == '{') ||
                   (s[i] == '>' && currentTop == '<') ||
                   (s[i] == ')' && currentTop == '(') ||
                   (s[i] == ']' && currentTop == '[') {
                    q.Pop()
                } else {
                    q.Pop()
                    answer += 1
                }
            }
        }
    }
    if q.Size == 0 {
        fmt.Printf("%d", answer)
    } else {
        fmt.Printf("Impossible")
    }
}

package main

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

/*
    You are given string s consists of opening and closing brackets of four kinds <>, {}, [], ().
    There are two types of brackets: opening and closing. You can replace any bracket by another of the same type.
    For example, you can replace < by the bracket {, but you can't replace it by ) or >.

    Determine the least number of replaces to make the string s regular braket sequence.
*/

type BracketStack struct {
    Brackets []byte
    Size int
}

func (s *BracketStack) Push(value byte) {
    s.Brackets = append(s.Brackets, value)
    s.Size += 1
}

func (s *BracketStack) Pop() (value byte) {
    if s.Size > 0 {
        value = s.Brackets[s.Size-1]
        s.Brackets = s.Brackets[0:s.Size-1]
        s.Size -= 1
        return value
    }
    return 'n'
}

func main() {
    stin := bufio.NewReader(os.Stdin)
    var s string
    fmt.Fscanln(stin, &s)
    //fmt.Printf("%s\n", s)
    sl := len(s)
    q := BracketStack{Brackets:make([]byte, 0), Size:0}
    answer := 0
    for i := 0; i < sl; i++ {
        if s[i] == '{' || s[i] == '<' || s[i] == '(' || s[i] == '[' {
            q.Push(s[i])
        } else {
            if q.Size == 0 {
                fmt.Printf("Impossible")
                return
            } else {
                currentTop := q.Brackets[q.Size-1]
                if (s[i] == '}' && currentTop == '{') ||
                   (s[i] == '>' && currentTop == '<') ||
                   (s[i] == ')' && currentTop == '(') ||
                   (s[i] == ']' && currentTop == '[') {
                    q.Pop()
                } else {
                    answer += 1
                }
            }
        }
    }
    if q.Size == 0 {
        fmt.Printf("%d", answer)
    } else {
        fmt.Printf("Impossible")
    }
}

package main

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

/*
    You are given string s consists of opening and closing brackets of four kinds <>, {}, [], ().
    There are two types of brackets: opening and closing. You can replace any bracket by another of the same type.
    For example, you can replace < by the bracket {, but you can't replace it by ) or >.

    Determine the least number of replaces to make the string s regular braket sequence.
*/

type BracketStack struct {
    Brackets []byte
    Size int
}

func (s *BracketStack) Push(value byte) {
    s.Brackets = append(s.Brackets, value)
    s.Size += 1
}

func (s *BracketStack) Pop() (value byte) {
    if s.Size > 0 {
        value = s.Brackets[s.Size-1]
        s.Brackets = s.Brackets[0:s.Size-1]
        s.Size -= 1
        return value
    }
    return 'n'
}

func main() {
    stin := bufio.NewReader(os.Stdin)
    var s string
    fmt.Fscanln(stin, &s)
    //fmt.Printf("%s\n", s)
    sl := len(s)
    q := BracketStack{Brackets:make([]byte, 0), Size:0}
    answer := 0
    for i := 0; i < sl; i++ {
        if s[i] == '{' || s[i] == '<' || s[i] == '(' || s[i] == '[' {
            q.Push(s[i])
        } else {
            if q.Size == 0 {
                fmt.Printf("Impossible")
                return
            } else {
                currentTop := q.Brackets[q.Size-1]
                if (s[i] == '}' && currentTop == '{') ||
                   (s[i] == '>' && currentTop == '<') ||
                   (s[i] == ')' && currentTop == '(') ||
                   (s[i] == ']' && currentTop == '[') {
                    q.Pop()
                } else {
                    answer += 1
                }
            }
        }
    }
    fmt.Printf("%d", answer)
}


// 274A-mic
package main

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

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

package main

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

func main() {
    scanner := bufio.NewScanner(os.Stdin)
    scanner.Split(bufio.ScanWords)
    var n,k int
    fmt.Scan(&n,&k)
    a := make([]int,n)
    x := make(map[int64]bool)
    for i := 0; i < n; i++ {
        scanner.Scan()
        a[i], _ = strconv.Atoi(scanner.Text())
    }
    sort.Ints(a)
    ans := 0
    for i := n-1; i >= 0; i-- {
        if (a[i] > a[n-1]/k) || (x[int64(a[i])*int64(k)] == false) {
            ans++
            x[int64(a[i])] = true
        }
    }
    fmt.Println(ans)
}

package main

import (
	"bufio"
	"errors"
	"flag"
	"os"
	"sort"
	"strconv"
	"time"
)

// ******************************** CODE STARTS ********************************

var ()

func solve() {
	n := readInt()
	k := readInt()

	was := NewSet()
	array := make([]int, n)

	for i := 0; i < n; i++ {
		array[i] = readInt()
		if array[i]%k != 0 {
			was.Insert(Int(array[i]))
		}
	}

	sort.Sort(sort.IntSlice(array))

	for i := 0; i < n; i++ {
		if array[i]%k == 0 && !was.Find(Int(array[i]/k)) {
			was.Insert(Int(array[i]))
		}
	}

	printInt(was.Len())
	printLine()
}

type Int int

func (p Int) Equals(key Key) bool {
	return int(p) == int(key.(Int))
}

func (p Int) Less(key Key) bool {
	return int(p) < int(key.(Int))
}

// ********************************* CODE ENDS *********************************

// IO.

var (
	scanner *bufio.Scanner
	writer  *bufio.Writer
)

func main() {
	local := flag.Bool("local", false, "Defines whether run is local or remote.")
	flag.Parse()

	var (
		input  *os.File
		output *os.File
	)

	if *local {
		input, _ = os.Open("/home/outside/coding/workspace/go/io/input.txt")
		output, _ = os.Create("/home/outside/coding/workspace/go/io/output.txt")
		startTime := time.Now()
		defer func() {
			print("Time: ")
			print(strconv.FormatFloat(time.Since(startTime).Seconds(), 'f', 5, 64))
			println("s")
		}()
	} else {
		input = os.Stdin
		output = os.Stdout
		// input, _ = os.Open("")
		// output, _ = os.Create("")
	}
	defer input.Close()
	defer output.Close()

	scanner = bufio.NewScanner(input)
	writer = bufio.NewWriter(output)
	defer writer.Flush()

	scanner.Split(bufio.ScanWords)

	solve()
}

// Read.

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

func readLine() string {
	scanner.Split(bufio.ScanLines)
	defer scanner.Split(bufio.ScanWords)
	return readString()
}

func readInt() int {
	ans, _ := strconv.ParseInt(readString(), 10, 0)
	return int(ans)
}

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

func readFloat64() float64 {
	ans, _ := strconv.ParseFloat(readString(), 64)
	return ans
}

// Write.

func printString(value string) {
	writer.WriteString(value)
}

func printLine() {
	printString("\n")
}

func printInt(value int) {
	printString(strconv.FormatInt(int64(value), 10))
}

func printInt64(value int64) {
	printString(strconv.FormatInt(value, 10))
}

func printFLoat64(value float64) {
	printString(strconv.FormatFloat(value, 'f', 20, 64))
}

// Min, max, abs.

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

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

// Set.

type Key interface {
	Equals(key Key) bool
	Less(key Key) bool
}

type node struct {
	key   Key
	left  *node
	right *node
}

func newNode(key Key) *node {
	return &node{key, nil, nil}
}

type SplayTree struct {
	root *node
	tmp  *node
	len  int
}

func NewSplayTree() *SplayTree {
	return &SplayTree{nil, newNode(nil), 0}
}

func rotateLeft(x, p *node) {
	p.right = x.left
	x.left = p
}

func rotateRight(x, p *node) {
	p.left = x.right
	x.right = p
}

func (p *SplayTree) splay(x *node, key Key) *node {
	if x == nil {
		return nil
	}

	left := p.tmp
	right := p.tmp

	for {
		if key.Less(x.key) {
			y := x.left
			if y == nil {
				break
			}
			if key.Less(y.key) { // zig-zig
				rotateRight(y, x)
				x = y
				if x.left == nil {
					break
				}
			}
			// link right
			right.left = x
			right = x
			// move left
			x = x.left
		} else if x.key.Less(key) {
			y := x.right
			if y == nil {
				break
			}
			if y.key.Less(key) { // zig-zig
				rotateLeft(y, x)
				x = y
				if x.right == nil {
					break
				}
			}
			// link left
			left.right = x
			left = x
			// move right
			x = x.right
		} else {
			break
		}
	}

	left.right = x.left
	right.left = x.right
	x.left = p.tmp.right
	x.right = p.tmp.left

	return x
}

// left <= key < right
func (p *SplayTree) split(key Key) (left, right *node) {
	p.root = p.splay(p.root, key)
	if p.root.key.Equals(key) || p.root.key.Less(key) {
		right := p.root.right
		p.root.right = nil
		return p.root, right
	} else {
		left := p.root.left
		p.root.left = nil
		return left, p.root
	}
}

// keys from left tree must be less then keys from right tree
func (p *SplayTree) join(left, right *node) *node {
	if left == nil {
		return right
	} else if right == nil {
		return left
	}
	left = p.splay(left, right.key)
	left.right = right
	return left
}

type Set interface {
	Len() int
	Insert(key Key) error
	Find(key Key) bool
	Remove(key Key) error
}

func NewSet() Set {
	return Set(NewSplayTree())
}

func (p *SplayTree) Len() int {
	return p.len
}

func (p *SplayTree) Insert(key Key) error {
	if p.root == nil {
		p.root = newNode(key)
		p.len++
	} else {
		p.root = p.splay(p.root, key)
		if p.root.key.Equals(key) {
			return errors.New("Such key already exists")
		} else {
			left, right := p.split(key)
			p.root = newNode(key)
			p.root.left = left
			p.root.right = right
			p.len++
		}
	}
	return nil
}

func (p *SplayTree) Find(key Key) bool {
	if p.root == nil {
		return false
	}
	p.root = p.splay(p.root, key)
	return p.root.key.Equals(key)
}

func (p *SplayTree) Remove(key Key) error {
	p.root = p.splay(p.root, key)
	if p.root == nil || !p.root.key.Equals(key) {
		return errors.New("Such key doesn't exist")
	}
	p.root = p.join(p.split(key))
	return nil
}

package main

import (
	"bufio"
	"errors"
	"flag"
	"fmt"
	"os"
	"sort"
	"strconv"
	"time"
)

// ******************************** CODE STARTS ********************************

var ()

func solve() {
	n := readInt()
	k := readInt()

	was := NewSet()
	array := make([]int, n)

	for i := 0; i < n; i++ {
		array[i] = readInt()
		if array[i]%k != 0 {
			was.Insert(Int(array[i]))
		}
	}

	sort.Sort(sort.IntSlice(array))

	for i := 0; i < n; i++ {
		if array[i]%k == 0 && !was.Find(Int(array[i]/k)) {
			was.Insert(Int(array[i]))
		}
	}

	printInt(was.Len())
	printString("\n")

}

type Int int

func (p Int) Equals(key Key) bool {
	return int(p) == int(key.(Int))
}

func (p Int) Less(key Key) bool {
	return int(p) < int(key.(Int))
}

// ********************************* CODE ENDS *********************************

// IO.

var (
	scanner *bufio.Scanner
	writer  *bufio.Writer
)

func main() {
	local := flag.Bool("local", false, "Defines whether run is local or remote.")
	flag.Parse()

	var (
		input  *os.File
		output *os.File
	)

	if *local {
		input, _ = os.Open("/home/outside/coding/workspace/go/io/input.txt")
		output, _ = os.Create("/home/outside/coding/workspace/go/io/output.txt")
		startTime := time.Now()
		defer func() {
			println("Time: " +
				fmt.Sprintf("%f", time.Since(startTime).Seconds()) + "s")
		}()
	} else {
		input = os.Stdin
		output = os.Stdout
		// input, _ = os.Open("")
		// output, _ = os.Create("")
	}
	defer input.Close()
	defer output.Close()

	scanner = bufio.NewScanner(input)
	writer = bufio.NewWriter(output)
	defer writer.Flush()

	scanner.Split(bufio.ScanWords)

	solve()
}

// Read.

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

func readInt() int {
	scanner.Scan()
	ans, _ := strconv.ParseInt(scanner.Text(), 10, 0)
	return int(ans)
}

func readInt32() int32 {
	scanner.Scan()
	ans, _ := strconv.ParseInt(scanner.Text(), 10, 32)
	return int32(ans)
}

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

// Write.

func printString(value string) {
	writer.WriteString(value)
}

func printInt(value int) {
	writer.WriteString(strconv.FormatInt(int64(value), 10))
}

// Min, max, abs.

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

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

// Set.

type Key interface {
	Equals(key Key) bool
	Less(key Key) bool
}

type node struct {
	key   Key
	left  *node
	right *node
}

func newNode(key Key) *node {
	return &node{key, nil, nil}
}

type SplayTree struct {
	root *node
	tmp  *node
	len  int
}

func NewSplayTree() *SplayTree {
	return &SplayTree{nil, newNode(nil), 0}
}

func rotateLeft(x, p *node) {
	p.right = x.left
	x.left = p
}

func rotateRight(x, p *node) {
	p.left = x.right
	x.right = p
}

func (p *SplayTree) splay(x *node, key Key) *node {
	if x == nil {
		return nil
	}

	left := p.tmp
	right := p.tmp

	for {
		if key.Less(x.key) {
			y := x.left
			if y == nil {
				break
			}
			if key.Less(y.key) { // zig-zig
				rotateRight(y, x)
				x = y
				if x.left == nil {
					break
				}
			}
			// link right
			right.left = x
			right = x
			// move left
			x = x.left
		} else if x.key.Less(key) {
			y := x.right
			if y == nil {
				break
			}
			if y.key.Less(key) { // zig-zig
				rotateLeft(y, x)
				x = y
				if x.right == nil {
					break
				}
			}
			// link left
			left.right = x
			left = x
			// move right
			x = x.right
		} else {
			break
		}
	}

	left.right = x.left
	right.left = x.right
	x.left = p.tmp.right
	x.right = p.tmp.left

	return x
}

// key should not be present in the tree
// left <= key < right
func (p *SplayTree) split(key Key) (left, right *node) {
	p.root = p.splay(p.root, key)
	if p.root.key.Equals(key) || p.root.key.Less(key) {
		right := p.root.right
		p.root.right = nil
		return p.root, right
	} else {
		left := p.root.left
		p.root.left = nil
		return left, p.root
	}
}

// keys from left tree must be less then keys from right tree
func (p *SplayTree) join(left, right *node) *node {
	if left == nil {
		return right
	} else if right == nil {
		return left
	}
	left = p.splay(left, right.key)
	left.right = right
	return left
}

type Set interface {
	Len() int
	Insert(key Key) error
	Find(key Key) bool
	Remove(key Key) error
}

func NewSet() Set {
	return Set(NewSplayTree())
}

func (p *SplayTree) Len() int {
	return p.len
}

func (p *SplayTree) Insert(key Key) error {
	if p.root == nil {
		p.root = newNode(key)
		p.len++
	} else {
		p.root = p.splay(p.root, key)
		if p.root.key.Equals(key) {
			return errors.New("Such key already exists")
		} else {
			left, right := p.split(key)
			p.root = newNode(key)
			p.root.left = left
			p.root.right = right
			p.len++
		}
	}
	return nil
}

func (p *SplayTree) Find(key Key) bool {
	if p.root == nil {
		return false
	}
	p.root = p.splay(p.root, key)
	return p.root.key.Equals(key)
}

func (p *SplayTree) Remove(key Key) error {
	p.root = p.splay(p.root, key)
	if p.root == nil || !p.root.key.Equals(key) {
		return errors.New("Such key doesn't exist")
	}
	p.root = p.join(p.split(key))
	return nil
}

package main

import (
	"bufio"
	"errors"
	"flag"
	"os"
	"sort"
	"strconv"
)

// ******************************** CODE STARTS ********************************

var ()

func solve() {
	n := readInt()
	k := readInt()

	was := NewSet()
	array := make([]int, n)

	for i := 0; i < n; i++ {
		array[i] = readInt()
		if array[i]%k != 0 {
			was.Insert(Int{array[i]})
		}
	}

	sort.Sort(sort.IntSlice(array))

	for i := 0; i < n; i++ {
		if array[i]%k == 0 && !was.Find(Int{array[i]/k}) {
			was.Insert(Int{array[i]})
		}
	}

	printInt(was.Len())
	printString("\n")

}

type Int struct {
	value int
}

func (p Int) Equals(key Key) bool {
	return p.value == key.(Int).value
}

func (p Int) Less(key Key) bool {
	return p.value < key.(Int).value
}

// ********************************* CODE ENDS *********************************

// IO.

var (
	scanner *bufio.Scanner
	writer  *bufio.Writer
)

func main() {
	local := flag.Bool("local", false, "Defines whether run is local or remote.")
	flag.Parse()

	var (
		input  *os.File
		output *os.File
	)

	if *local {
		input, _ = os.Open("/home/outside/coding/workspace/go/io/input.txt")
		output, _ = os.Create("/home/outside/coding/workspace/go/io/output.txt")
	} else {
		input = os.Stdin
		output = os.Stdout
		// input, _ = os.Open("")
		// output, _ = os.Create("")
	}

	scanner = bufio.NewScanner(input)
	writer = bufio.NewWriter(output)

	defer input.Close()
	defer output.Close()
	defer writer.Flush()
	scanner.Split(bufio.ScanWords)

	solve()
}

// Read.

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

func readInt() int {
	scanner.Scan()
	ans, _ := strconv.ParseInt(scanner.Text(), 10, 0)
	return int(ans)
}

func readInt32() int32 {
	scanner.Scan()
	ans, _ := strconv.ParseInt(scanner.Text(), 10, 32)
	return int32(ans)
}

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

// Write.

func printString(value string) {
	writer.WriteString(value)
}

func printInt(value int) {
	writer.WriteString(strconv.FormatInt(int64(value), 10))
}

// Min, max, abs.

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

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

// Set.

type Key interface {
	Equals(key Key) bool
	Less(key Key) bool
}

type node struct {
	key   Key
	left  *node
	right *node
}

func newNode(key Key) *node {
	return &node{key, nil, nil}
}

type SplayTree struct {
	root *node
	tmp  *node
	len  int
}

func NewSplayTree() *SplayTree {
	return &SplayTree{nil, newNode(nil), 0}
}

func rotateLeft(x, p *node) {
	p.right = x.left
	x.left = p
}

func rotateRight(x, p *node) {
	p.left = x.right
	x.right = p
}

func (p *SplayTree) splay(x *node, key Key) *node {
	if x == nil {
		return nil
	}

	left := p.tmp
	right := p.tmp

	for {
		if key.Less(x.key) {
			y := x.left
			if y == nil {
				break
			}
			if key.Less(y.key) { // zig-zig
				rotateRight(y, x)
				x = y
				if x.left == nil {
					break
				}
			}
			// link right
			right.left = x
			right = x
			// move left
			x = x.left
		} else if x.key.Less(key) {
			y := x.right
			if y == nil {
				break
			}
			if y.key.Less(key) { // zig-zig
				rotateLeft(y, x)
				x = y
				if x.right == nil {
					break
				}
			}
			// link left
			left.right = x
			left = x
			// move right
			x = x.right
		} else {
			break
		}
	}

	left.right = x.left
	right.left = x.right
	x.left = p.tmp.right
	x.right = p.tmp.left

	return x
}

// key should not be present in the tree
// left <= key < right
func (p *SplayTree) split(key Key) (left, right *node) {
	p.root = p.splay(p.root, key)
	if p.root.key.Equals(key) || p.root.key.Less(key) {
		right := p.root.right
		p.root.right = nil
		return p.root, right
	} else {
		left := p.root.left
		p.root.left = nil
		return left, p.root
	}
}

// keys from left tree must be less then keys from right tree
func (p *SplayTree) join(left, right *node) *node {
	if left == nil {
		return right
	} else if right == nil {
		return left
	}
	left = p.splay(left, right.key)
	left.right = right
	return left
}

type Set interface {
	Len() int
	Insert(key Key) error
	Find(key Key) bool
	Remove(key Key) error
}

func NewSet() Set {
	return Set(NewSplayTree())
}

func (p *SplayTree) Len() int {
	return p.len
}

func (p *SplayTree) Insert(key Key) error {
	if p.root == nil {
		p.root = newNode(key)
		p.len++
	} else {
		p.root = p.splay(p.root, key)
		if p.root.key.Equals(key) {
			return errors.New("Such key already exists")
		} else {
			left, right := p.split(key)
			p.root = newNode(key)
			p.root.left = left
			p.root.right = right
			p.len++
		}
	}
	return nil
}

func (p *SplayTree) Find(key Key) bool {
	if p.root == nil {
		return false
	}
	p.root = p.splay(p.root, key)
	return p.root.key.Equals(key)
}

func (p *SplayTree) Remove(key Key) error {
	p.root = p.splay(p.root, key)
	if p.root == nil || !p.root.key.Equals(key) {
		return errors.New("Such key doesn't exist")
	}
	p.root = p.join(p.split(key))
	return nil
}

package main

import (
	"bufio"
	"errors"
	"flag"
	"fmt"
	"os"
	"sort"
	"strconv"
	"time"
)

// ******************************** CODE STARTS ********************************

var ()

func solve() {
	n := readInt()
	k := readInt()

	was := NewSet()
	array := make([]int, n)

	for i := 0; i < n; i++ {
		array[i] = readInt()
		if array[i]%k != 0 {
			was.Insert(Int(array[i]))
		}
	}

	sort.Sort(sort.IntSlice(array))

	for i := 0; i < n; i++ {
		if array[i]%k == 0 && !was.Find(Int(array[i]/k)) {
			was.Insert(Int(array[i]))
		}
	}

	printInt(was.Len())
	printString("\n")

}

type Int int

func (p Int) Equals(key Key) bool {
	return int(p) == int(key.(Int))
}

func (p Int) Less(key Key) bool {
	return int(p) < int(key.(Int))
}

// ********************************* CODE ENDS *********************************

// IO.

var (
	scanner *bufio.Scanner
	writer  *bufio.Writer
)

func main() {
	local := flag.Bool("local", false, "Defines whether run is local or remote.")
	flag.Parse()

	var (
		input  *os.File
		output *os.File
	)

	if *local {
		input, _ = os.Open("/home/outside/coding/workspace/go/io/input.txt")
		output, _ = os.Create("/home/outside/coding/workspace/go/io/output.txt")
		startTime := time.Now()
		defer func() {
			println(fmt.Sprintf("Time: %fs", time.Since(startTime).Seconds()))
		}()
	} else {
		input = os.Stdin
		output = os.Stdout
		// input, _ = os.Open("")
		// output, _ = os.Create("")
	}
	defer input.Close()
	defer output.Close()

	scanner = bufio.NewScanner(input)
	writer = bufio.NewWriter(output)
	defer writer.Flush()

	scanner.Split(bufio.ScanWords)

	solve()
}

// Read.

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

func readInt() int {
	scanner.Scan()
	ans, _ := strconv.ParseInt(scanner.Text(), 10, 0)
	return int(ans)
}

func readInt32() int32 {
	scanner.Scan()
	ans, _ := strconv.ParseInt(scanner.Text(), 10, 32)
	return int32(ans)
}

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

// Write.

func printString(value string) {
	writer.WriteString(value)
}

func printInt(value int) {
	writer.WriteString(strconv.FormatInt(int64(value), 10))
}

// Min, max, abs.

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

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

// Set.

type Key interface {
	Equals(key Key) bool
	Less(key Key) bool
}

type node struct {
	key   Key
	left  *node
	right *node
}

func newNode(key Key) *node {
	return &node{key, nil, nil}
}

type SplayTree struct {
	root *node
	tmp  *node
	len  int
}

func NewSplayTree() *SplayTree {
	return &SplayTree{nil, newNode(nil), 0}
}

func rotateLeft(x, p *node) {
	p.right = x.left
	x.left = p
}

func rotateRight(x, p *node) {
	p.left = x.right
	x.right = p
}

func (p *SplayTree) splay(x *node, key Key) *node {
	if x == nil {
		return nil
	}

	left := p.tmp
	right := p.tmp

	for {
		if key.Less(x.key) {
			y := x.left
			if y == nil {
				break
			}
			if key.Less(y.key) { // zig-zig
				rotateRight(y, x)
				x = y
				if x.left == nil {
					break
				}
			}
			// link right
			right.left = x
			right = x
			// move left
			x = x.left
		} else if x.key.Less(key) {
			y := x.right
			if y == nil {
				break
			}
			if y.key.Less(key) { // zig-zig
				rotateLeft(y, x)
				x = y
				if x.right == nil {
					break
				}
			}
			// link left
			left.right = x
			left = x
			// move right
			x = x.right
		} else {
			break
		}
	}

	left.right = x.left
	right.left = x.right
	x.left = p.tmp.right
	x.right = p.tmp.left

	return x
}

// key should not be present in the tree
// left <= key < right
func (p *SplayTree) split(key Key) (left, right *node) {
	p.root = p.splay(p.root, key)
	if p.root.key.Equals(key) || p.root.key.Less(key) {
		right := p.root.right
		p.root.right = nil
		return p.root, right
	} else {
		left := p.root.left
		p.root.left = nil
		return left, p.root
	}
}

// keys from left tree must be less then keys from right tree
func (p *SplayTree) join(left, right *node) *node {
	if left == nil {
		return right
	} else if right == nil {
		return left
	}
	left = p.splay(left, right.key)
	left.right = right
	return left
}

type Set interface {
	Len() int
	Insert(key Key) error
	Find(key Key) bool
	Remove(key Key) error
}

func NewSet() Set {
	return Set(NewSplayTree())
}

func (p *SplayTree) Len() int {
	return p.len
}

func (p *SplayTree) Insert(key Key) error {
	if p.root == nil {
		p.root = newNode(key)
		p.len++
	} else {
		p.root = p.splay(p.root, key)
		if p.root.key.Equals(key) {
			return errors.New("Such key already exists")
		} else {
			left, right := p.split(key)
			p.root = newNode(key)
			p.root.left = left
			p.root.right = right
			p.len++
		}
	}
	return nil
}

func (p *SplayTree) Find(key Key) bool {
	if p.root == nil {
		return false
	}
	p.root = p.splay(p.root, key)
	return p.root.key.Equals(key)
}

func (p *SplayTree) Remove(key Key) error {
	p.root = p.splay(p.root, key)
	if p.root == nil || !p.root.key.Equals(key) {
		return errors.New("Such key doesn't exist")
	}
	p.root = p.join(p.split(key))
	return nil
}

package main

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

// ******************************** CODE STARTS ********************************

var ()

func solve() {
	n := readInt()
	k := readInt()

	was := make(map[int]bool)
	array := make([]int, n)

	for i := 0; i < n; i++ {
		array[i] = readInt()
		if array[i]%k != 0 {
			was[array[i]] = true
		}
	}

	sort.Ints(array)

	for i := 0; i < n; i++ {
		_, present := was[array[i]/k]
		if array[i]%k == 0 && !present {
			was[array[i]] = true
		}
	}

	printInt(len(was))

}

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

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

// ********************************* CODE ENDS *********************************

var (
	scanner *bufio.Scanner
	writer  *bufio.Writer
)

func main() {
	local := flag.Bool("local", false, "Defines whether run is local or remote.")
	flag.Parse()

	var (
		input  *os.File
		output *os.File
	)

	if *local {
		input, _ = os.Open("/home/outside/coding/workspace/go/io/input.txt")
		output, _ = os.Create("/home/outside/coding/workspace/go/io/output.txt")
	} else {
		input = os.Stdin
		output = os.Stdout
		// input, _ = os.Open("")
		// output, _ = os.Create("")
	}

	scanner = bufio.NewScanner(input)
	writer = bufio.NewWriter(output)

	defer input.Close()
	defer output.Close()
	defer writer.Flush()
	scanner.Split(bufio.ScanWords)

	solve()
}

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

func readInt() int {
	scanner.Scan()
	ans, _ := strconv.ParseInt(scanner.Text(), 10, 0)
	return int(ans)
}

func readInt32() int32 {
	scanner.Scan()
	ans, _ := strconv.ParseInt(scanner.Text(), 10, 32)
	return int32(ans)
}

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

func printString(value string) {
	writer.WriteString(value)
}

func printInt(value int) {
	writer.WriteString(strconv.FormatInt(int64(value), 10))
}

package main

import (
	"bufio"
	"errors"
	"flag"
	"os"
	"sort"
	"strconv"
)

// ******************************** CODE STARTS ********************************

var ()

func solve() {
	n := readInt()
	k := readInt()

	was := NewSet()
	array := make([]int, n)

	for i := 0; i < n; i++ {
		array[i] = readInt()
		if array[i]%k != 0 {
			was.Insert(Int(array[i]))
		}
	}

	sort.Ints(array)

	for i := 0; i < n; i++ {
		if array[i]%k == 0 && !was.Find(Int(array[i]/k)) {
			was.Insert(Int(array[i]))
		}
	}

	printInt(was.Len())
	printString("\n")

}

type Int int

func (p Int) Equals(key Key) bool {
	return int(p) == int(key.(Int))
}

func (p Int) Less(key Key) bool {
	return int(p) < int(key.(Int))
}

// ********************************* CODE ENDS *********************************

// IO.

var (
	scanner *bufio.Scanner
	writer  *bufio.Writer
)

func main() {
	local := flag.Bool("local", false, "Defines whether run is local or remote.")
	flag.Parse()

	var (
		input  *os.File
		output *os.File
	)

	if *local {
		input, _ = os.Open("/home/outside/coding/workspace/go/io/input.txt")
		output, _ = os.Create("/home/outside/coding/workspace/go/io/output.txt")
	} else {
		input = os.Stdin
		output = os.Stdout
		// input, _ = os.Open("")
		// output, _ = os.Create("")
	}

	scanner = bufio.NewScanner(input)
	writer = bufio.NewWriter(output)

	defer input.Close()
	defer output.Close()
	defer writer.Flush()
	scanner.Split(bufio.ScanWords)

	solve()
}

// Read.

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

func readInt() int {
	scanner.Scan()
	ans, _ := strconv.ParseInt(scanner.Text(), 10, 0)
	return int(ans)
}

func readInt32() int32 {
	scanner.Scan()
	ans, _ := strconv.ParseInt(scanner.Text(), 10, 32)
	return int32(ans)
}

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

// Write.

func printString(value string) {
	writer.WriteString(value)
}

func printInt(value int) {
	writer.WriteString(strconv.FormatInt(int64(value), 10))
}

// Min, max, abs.

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

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

// Set.

type Key interface {
	Equals(key Key) bool
	Less(key Key) bool
}

type node struct {
	key   Key
	left  *node
	right *node
}

func newNode(key Key) *node {
	return &node{key, nil, nil}
}

type SplayTree struct {
	root *node
	tmp  *node
	len  int
}

func NewSplayTree() *SplayTree {
	return &SplayTree{nil, newNode(nil), 0}
}

func rotateLeft(x, p *node) {
	p.right = x.left
	x.left = p
}

func rotateRight(x, p *node) {
	p.left = x.right
	x.right = p
}

func (p *SplayTree) splay(x *node, key Key) *node {
	if x == nil {
		return nil
	}

	left := p.tmp
	right := p.tmp

	for {
		if key.Less(x.key) {
			y := x.left
			if y == nil {
				break
			}
			if key.Less(y.key) { // zig-zig
				rotateRight(y, x)
				x = y
				if x.left == nil {
					break
				}
			}
			// link right
			right.left = x
			right = x
			// move left
			x = x.left
		} else if x.key.Less(key) {
			y := x.right
			if y == nil {
				break
			}
			if y.key.Less(key) { // zig-zig
				rotateLeft(y, x)
				x = y
				if x.right == nil {
					break
				}
			}
			// link left
			left.right = x
			left = x
			// move right
			x = x.right
		} else {
			break
		}
	}

	left.right = x.left
	right.left = x.right
	x.left = p.tmp.right
	x.right = p.tmp.left

	return x
}

// key should not be present in the tree
// left <= key < right
func (p *SplayTree) split(key Key) (left, right *node) {
	p.root = p.splay(p.root, key)
	if p.root.key.Equals(key) || p.root.key.Less(key) {
		right := p.root.right
		p.root.right = nil
		return p.root, right
	} else {
		left := p.root.left
		p.root.left = nil
		return left, p.root
	}
}

// keys from left tree must be less then keys from right tree
func (p *SplayTree) join(left, right *node) *node {
	if left == nil {
		return right
	} else if right == nil {
		return left
	}
	left = p.splay(left, right.key)
	left.right = right
	return left
}

type Set interface {
	Len() int
	Insert(key Key) error
	Find(key Key) bool
	Remove(key Key) error
}

func NewSet() Set {
	return Set(NewSplayTree())
}

func (p *SplayTree) Len() int {
	return p.len
}

func (p *SplayTree) Insert(key Key) error {
	if p.root == nil {
		p.root = newNode(key)
		p.len++
	} else {
		p.root = p.splay(p.root, key)
		if p.root.key.Equals(key) {
			return errors.New("Such key already exists")
		} else {
			left, right := p.split(key)
			p.root = newNode(key)
			p.root.left = left
			p.root.right = right
			p.len++
		}
	}
	return nil
}

func (p *SplayTree) Find(key Key) bool {
	if p.root == nil {
		return false
	}
	p.root = p.splay(p.root, key)
	return p.root.key.Equals(key)
}

func (p *SplayTree) Remove(key Key) error {
	p.root = p.splay(p.root, key)
	if p.root == nil || !p.root.key.Equals(key) {
		return errors.New("Such key doesn't exist")
	}
	p.root = p.join(p.split(key))
	return nil
}

package main

import (
	"bufio"
	"errors"
	"flag"
	"os"
	"sort"
	"strconv"
)

// ******************************** CODE STARTS ********************************

var ()

func solve() {
	n := readInt()
	k := readInt()

	was := NewSet()
	array := make([]int, n)

	for i := 0; i < n; i++ {
		array[i] = readInt()
		if array[i]%k != 0 {
			was.Insert(Int(array[i]))
		}
	}

	sort.Sort(sort.IntSlice(array))

	for i := 0; i < n; i++ {
		if array[i]%k == 0 && !was.Find(Int(array[i]/k)) {
			was.Insert(Int(array[i]))
		}
	}

	printInt(was.Len())
	printString("\n")

}

type Int int

func (p Int) Equals(key Key) bool {
	return int(p) == int(key.(Int))
}

func (p Int) Less(key Key) bool {
	return int(p) < int(key.(Int))
}

// ********************************* CODE ENDS *********************************

// IO.

var (
	scanner *bufio.Scanner
	writer  *bufio.Writer
)

func main() {
	local := flag.Bool("local", false, "Defines whether run is local or remote.")
	flag.Parse()

	var (
		input  *os.File
		output *os.File
	)

	if *local {
		input, _ = os.Open("/home/outside/coding/workspace/go/io/input.txt")
		output, _ = os.Create("/home/outside/coding/workspace/go/io/output.txt")
	} else {
		input = os.Stdin
		output = os.Stdout
		// input, _ = os.Open("")
		// output, _ = os.Create("")
	}

	scanner = bufio.NewScanner(input)
	writer = bufio.NewWriter(output)

	defer input.Close()
	defer output.Close()
	defer writer.Flush()
	scanner.Split(bufio.ScanWords)

	solve()
}

// Read.

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

func readInt() int {
	scanner.Scan()
	ans, _ := strconv.ParseInt(scanner.Text(), 10, 0)
	return int(ans)
}

func readInt32() int32 {
	scanner.Scan()
	ans, _ := strconv.ParseInt(scanner.Text(), 10, 32)
	return int32(ans)
}

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

// Write.

func printString(value string) {
	writer.WriteString(value)
}

func printInt(value int) {
	writer.WriteString(strconv.FormatInt(int64(value), 10))
}

// Min, max, abs.

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

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

// Set.

type Key interface {
	Equals(key Key) bool
	Less(key Key) bool
}

type node struct {
	key   Key
	left  *node
	right *node
}

func newNode(key Key) *node {
	return &node{key, nil, nil}
}

type SplayTree struct {
	root *node
	tmp  *node
	len  int
}

func NewSplayTree() *SplayTree {
	return &SplayTree{nil, newNode(nil), 0}
}

func rotateLeft(x, p *node) {
	p.right = x.left
	x.left = p
}

func rotateRight(x, p *node) {
	p.left = x.right
	x.right = p
}

func (p *SplayTree) splay(x *node, key Key) *node {
	if x == nil {
		return nil
	}

	left := p.tmp
	right := p.tmp

	for {
		if key.Less(x.key) {
			y := x.left
			if y == nil {
				break
			}
			if key.Less(y.key) { // zig-zig
				rotateRight(y, x)
				x = y
				if x.left == nil {
					break
				}
			}
			// link right
			right.left = x
			right = x
			// move left
			x = x.left
		} else if x.key.Less(key) {
			y := x.right
			if y == nil {
				break
			}
			if y.key.Less(key) { // zig-zig
				rotateLeft(y, x)
				x = y
				if x.right == nil {
					break
				}
			}
			// link left
			left.right = x
			left = x
			// move right
			x = x.right
		} else {
			break
		}
	}

	left.right = x.left
	right.left = x.right
	x.left = p.tmp.right
	x.right = p.tmp.left

	return x
}

// key should not be present in the tree
// left <= key < right
func (p *SplayTree) split(key Key) (left, right *node) {
	p.root = p.splay(p.root, key)
	if p.root.key.Equals(key) || p.root.key.Less(key) {
		right := p.root.right
		p.root.right = nil
		return p.root, right
	} else {
		left := p.root.left
		p.root.left = nil
		return left, p.root
	}
}

// keys from left tree must be less then keys from right tree
func (p *SplayTree) join(left, right *node) *node {
	if left == nil {
		return right
	} else if right == nil {
		return left
	}
	left = p.splay(left, right.key)
	left.right = right
	return left
}

type Set interface {
	Len() int
	Insert(key Key) error
	Find(key Key) bool
	Remove(key Key) error
}

func NewSet() Set {
	return Set(NewSplayTree())
}

func (p *SplayTree) Len() int {
	return p.len
}

func (p *SplayTree) Insert(key Key) error {
	if p.root == nil {
		p.root = newNode(key)
		p.len++
	} else {
		p.root = p.splay(p.root, key)
		if p.root.key.Equals(key) {
			return errors.New("Such key already exists")
		} else {
			left, right := p.split(key)
			p.root = newNode(key)
			p.root.left = left
			p.root.right = right
			p.len++
		}
	}
	return nil
}

func (p *SplayTree) Find(key Key) bool {
	if p.root == nil {
		return false
	}
	p.root = p.splay(p.root, key)
	return p.root.key.Equals(key)
}

func (p *SplayTree) Remove(key Key) error {
	p.root = p.splay(p.root, key)
	if p.root == nil || !p.root.key.Equals(key) {
		return errors.New("Such key doesn't exist")
	}
	p.root = p.join(p.split(key))
	return nil
}

package main

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

// ******************************** CODE STARTS ********************************

var ()

func solve() {
	n := readInt()
	k := readInt()

	was := make(map[int]bool)
	array := make([]int, n)

	for i := 0; i < n; i++ {
		array[i] = readInt()
		if array[i]%k != 0 {
			was[array[i]] = true
		}
	}

	sort.Sort(sort.IntSlice(array))

	for i := 0; i < n; i++ {
		_, present := was[array[i]/k]
		if array[i]%k == 0 && !present {
			was[array[i]] = true
		}
	}

	printInt(len(was))

}

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

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

// ********************************* CODE ENDS *********************************

var (
	scanner *bufio.Scanner
	writer  *bufio.Writer
)

func main() {
	local := flag.Bool("local", false, "Defines whether run is local or remote.")
	flag.Parse()

	var (
		input  *os.File
		output *os.File
	)

	if *local {
		input, _ = os.Open("/home/outside/coding/workspace/go/io/input.txt")
		output, _ = os.Create("/home/outside/coding/workspace/go/io/output.txt")
	} else {
		input = os.Stdin
		output = os.Stdout
		// input, _ = os.Open("")
		// output, _ = os.Create("")
	}

	scanner = bufio.NewScanner(input)
	writer = bufio.NewWriter(output)

	defer input.Close()
	defer output.Close()
	defer writer.Flush()
	scanner.Split(bufio.ScanWords)

	solve()
}

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

func readInt() int {
	scanner.Scan()
	ans, _ := strconv.ParseInt(scanner.Text(), 10, 0)
	return int(ans)
}

func readInt32() int32 {
	scanner.Scan()
	ans, _ := strconv.ParseInt(scanner.Text(), 10, 32)
	return int32(ans)
}

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

func printString(value string) {
	writer.WriteString(value)
}

func printInt(value int) {
	writer.WriteString(strconv.FormatInt(int64(value), 10))
}

package main

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

// ******************************** CODE STARTS ********************************

var ()

func solve() {
	n := readInt()
	k := readInt()

	was := make(map[int]bool)
	array := make([]int, 0)

	for i := 0; i < n; i++ {
		array = append(array, readInt())
		if array[i]%k != 0 {
			was[array[i]] = true
		}
	}

	sort.Sort(sort.IntSlice(array))

	for i := 0; i < n; i++ {
		_, present := was[array[i]/k]
		if array[i]%k == 0 && !present {
			was[array[i]] = true
		}
	}

	printInt(len(was))

}

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

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

// ********************************* CODE ENDS *********************************

var (
	scanner *bufio.Scanner
	writer  *bufio.Writer
)

func main() {
	local := flag.Bool("local", false, "Defines whether run is local or remote.")
	flag.Parse()

	var (
		input  *os.File
		output *os.File
	)

	if *local {
		input, _ = os.Open("/home/outside/coding/workspace/go/io/input.txt")
		output, _ = os.Create("/home/outside/coding/workspace/go/io/output.txt")
	} else {
		input = os.Stdin
		output = os.Stdout
		// input, _ = os.Open("")
		// output, _ = os.Create("")
	}

	scanner = bufio.NewScanner(input)
	writer = bufio.NewWriter(output)

	defer input.Close()
	defer output.Close()
	defer writer.Flush()
	scanner.Split(bufio.ScanWords)

	solve()
}

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

func readInt() int {
	scanner.Scan()
	ans, _ := strconv.ParseInt(scanner.Text(), 10, 0)
	return int(ans)
}

func readInt32() int32 {
	scanner.Scan()
	ans, _ := strconv.ParseInt(scanner.Text(), 10, 32)
	return int32(ans)
}

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

func printString(value string) {
	writer.WriteString(value)
}

func printInt(value int) {
	writer.WriteString(strconv.FormatInt(int64(value), 10))
}

// Author: sighduck
// URL: https://codeforces.com/problemset/problem/274/A

package main

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

func Solve(n int, k int, a []int) int {
	S := make(map[int]bool)
	sort.Ints(a)
	for _, elem := range a {
		if elem%k != 0 {
			S[elem] = true
		} else if elem%k == 0 && !S[elem/k] {
			S[elem] = true
		}
	}
	return len(S)
}

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

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

	fmt.Fprintf(writer, "%d\n", Solve(n, k, a))
}

package main

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

// ******************************** CODE STARTS ********************************

var ()

func solve() {
	n := readInt()
	k := readInt()

	was := make(map[int]bool)
	array := make([]int, n)

	for i := 0; i < n; i++ {
		array[i] = readInt()
		if array[i]%k != 0 {
			was[array[i]] = true
		}
	}

	sort.Sort(sort.IntSlice(array))

	for i := 0; i < n; i++ {
		_, present := was[array[i]/k]
		if array[i]%k == 0 && !present {
			was[array[i]] = true
		}
	}

	printInt(len(was))

}

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

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

// ********************************* CODE ENDS *********************************

var (
	scanner *bufio.Scanner
	writer  *bufio.Writer
)

func main() {
	local := flag.Bool("local", false, "Defines whether run is local or remote.")
	flag.Parse()

	var (
		input  *os.File
		output *os.File
	)

	if *local {
		input, _ = os.Open("/home/outside/coding/workspace/go/io/input.txt")
		output, _ = os.Create("/home/outside/coding/workspace/go/io/output.txt")
	} else {
		// input = os.Stdin
		// output = os.Stdout
		input, _ = os.Open("war.in")
		output, _ = os.Create("war.out")
	}

	scanner = bufio.NewScanner(input)
	writer = bufio.NewWriter(output)

	defer input.Close()
	defer output.Close()
	defer writer.Flush()
	scanner.Split(bufio.ScanWords)

	solve()
}

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

func readInt() int {
	scanner.Scan()
	ans, _ := strconv.ParseInt(scanner.Text(), 10, 0)
	return int(ans)
}

func readInt32() int32 {
	scanner.Scan()
	ans, _ := strconv.ParseInt(scanner.Text(), 10, 32)
	return int32(ans)
}

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

func printString(value string) {
	writer.WriteString(value)
}

func printInt(value int) {
	writer.WriteString(strconv.FormatInt(int64(value), 10))
}