package main

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

func main() {
	// map to save index of previous occurence
	indexes := make(map[int64]int)
	var exist bool
	var index int
	// slice to save number
	var arr []int64
	var total int
	var n int64

	// read len from console
	var reader *bufio.Reader = bufio.NewReader(os.Stdin)
	fmt.Fscanf(reader, "%d\n", &total)

	// make a slice with cap total
	arr = make([]int64, total)

	// read num by num
	for i := 0; i < cap(arr); i++ {
		fmt.Fscanf(reader, "%d", &n)
		// attempt to get n from map
		index, exist = indexes[n]

		if exist == false {
			arr[i] = n
			indexes[n] = i
			continue
		}

		for exist == true {
			arr[index] = 0 // set to null
			delete(indexes, n) // forget
			total-- // decrement total of num by 1
			n *= 2
			arr[i] = n
			// repetively search for n * 2
			index, exist = indexes[n]
		}

		// update map when n becomes the first occurence
		indexes[n] = i
	}

	// print out result. omit 0 elements
	fmt.Println(total)
	for _, elem := range arr {
		if elem != 0 {
			fmt.Printf("%d ", elem)
		}
	}
}

package main

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

type data struct {
	i int
	v int64
}
type dataHeap []data

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

func nextInt() int {
	in.Scan()
	r := 0
	for _, c := range in.Bytes() {
		r *= 10
		r += int(c - '0')
	}
	return r
}

func main() {
	in.Split(bufio.ScanWords)
	var d dataHeap
	var r []data
	for i, n := 0, nextInt(); i < n; i++ {
		heap.Push(&d, data{i, int64(nextInt())})
	}
	for len(d) > 1 {
		a := heap.Pop(&d).(data)
		b := heap.Pop(&d).(data)
		if a.v == b.v {
			b.v *= 2
		} else {
			r = append(r, a)
		}
		heap.Push(&d, b)
	}
	r = append(r, heap.Pop(&d).(data))
	sort.Slice(r, func(i, j int) bool { return r[i].i < r[j].i })
	fmt.Fprintln(out, len(r))
	for i, r := range r {
		if i != 0 {
			out.WriteByte(' ')
		}
		fmt.Fprint(out, r.v)
	}
	out.Flush()
}

func (h dataHeap) Len() int { return len(h) }
func (h dataHeap) Less(i, j int) bool {
	if h[i].v != h[j].v {
		return h[i].v < h[j].v
	}
	return h[i].i < h[j].i
}
func (h dataHeap) Swap(i, j int)       { h[i], h[j] = h[j], h[i] }
func (h *dataHeap) Push(x interface{}) { *h = append(*h, x.(data)) }
func (h *dataHeap) Pop() interface{}   { r := (*h)[len(*h)-1]; *h = (*h)[:len(*h)-1]; return r }

package main

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

type caseInput struct {
	originalSize uint32
	valueToLastIndex map[uint64]uint32
}

func readCaseInput(scanner *bufio.Scanner) caseInput {
	valueToLastIndex := make(map[uint64]uint32)
	size := uint32(readInt(scanner))

	for i := uint32(0); i < size; i++ {
		v := uint64(readInt64(scanner))

		for {
			_, prs := valueToLastIndex[v]

			if !prs {
				valueToLastIndex[v] = i
				break
			} else {
				delete(valueToLastIndex, v)
				v *= 2
			}
		}
	}

	return caseInput{size, valueToLastIndex}
}

type caseOutput struct {
	nums []uint64
}

func writeCaseOutput(writer *bufio.Writer, out caseOutput) {
	writef(writer, "%d\n", len(out.nums))
	for idx, num := range out.nums {
		if idx+1 < len(out.nums) {
			writef(writer, "%d ", num)
		} else {
			writef(writer, "%d\n", num)
		}
	}
}

func solveCase(in caseInput) caseOutput {
	temp := make([]uint64, in.originalSize)
	for value, lastIndex := range in.valueToLastIndex {
		temp[lastIndex] = value
	}

	res := make([]uint64, 0, len(in.valueToLastIndex))
	for _, v := range temp {
		if v > 0 {
			res = append(res, v)
		}
	}

	return caseOutput{res}
}

func solveSequential(scanner *bufio.Scanner, writer *bufio.Writer) {
	writeCaseOutput(writer, solveCase(readCaseInput(scanner)))
}

func main() {
	var scanner *bufio.Scanner
	if len(os.Args) > 1 {
		reader, err := os.Open(os.Args[1])
		if err != nil {
			panic(err)
		}
		defer reader.Close()
		scanner = bufio.NewScanner(reader)
	} else {
		scanner = bufio.NewScanner(os.Stdin)
	}
	scanner.Split(bufio.ScanWords)

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

	solveSequential(scanner, writer)
}

func readInt64(sc *bufio.Scanner) int64 {
	sc.Scan()
	res, err := strconv.ParseInt(sc.Text(), 10, 64)
	if err != nil {
		panic(err)
	}
	return res
}

func readInt(sc *bufio.Scanner) int {
	return int(readInt64(sc))
}

func writef(writer *bufio.Writer, formatStr string, values ...interface{}) {
	out := fmt.Sprintf(formatStr, values...)
	_, err := writer.WriteString(out)
	if err != nil {
		panic(err)
	}
}

package main

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

type num struct {
	val int64
	index int
}

type hp []*num

func (h hp) Len() int {
	return len(h)
}

func (h hp) Less(i, j int) bool {
	if h[i].val < h[j].val {
		return true
	}
	if h[i].val > h[j].val {
		return false
	}
	return h[i].index < h[j].index
}

func (h hp) Swap(i, j int) {
	h[i], h[j] = h[j], h[i]
}

func (h *hp) Push(x interface{}) {
	*h = append(*h, x.(*num))
}

func (h *hp) Pop() interface{} {
	old := *h
	size := len(old)
	last := old[size-1]
	*h = old[0 : size-1]
	return last
}

var n int
var h hp
var b []num

func main() {
	inBuf := bufio.NewReader(os.Stdin)
	fmt.Fscanf(inBuf, "%d\n", &n)
	h = make([]*num, n)
	for i := 0; i < n; i++ {
		var tmp int64
		fmt.Fscanf(inBuf, "%d", &tmp)
		h[i] = &num{val: tmp, index: i}
	}
	heap.Init(&h)
	b = make([]num, 0)
	for len(h) > 0 {
		t1 := heap.Pop(&h).(*num)
		if len(h) == 0 {
			b = append(b, *t1)
			break
		}
		var t2 *num
		for len(h) > 0 {
			t2 = heap.Pop(&h).(*num)
			if t1.val == t2.val {
				heap.Push(&h, &num{val: 2 * t1.val, index: t2.index})
				break
			}
			b = append(b, *t1)
			t1 = t2
			if len(h) == 0 {
				b = append(b, *t2)
			}
		}
	}
	sort.Slice(b, func(i, j int) bool {
		return b[i].index < b[j].index
	})
	outBuf := bufio.NewWriter(os.Stdout)
	defer func() { outBuf.Flush() } ()
	fmt.Fprintln(outBuf, len(b))
	for i := 0; i < len(b); i++ {
		fmt.Fprintf(outBuf, "%d ", b[i].val)
	}
}

package main

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

type data struct{ i, v int }
type dataHeap []data

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

func nextInt() int {
	in.Scan()
	r := 0
	for _, c := range in.Bytes() {
		r *= 10
		r += int(c - '0')
	}
	return r
}

func main() {
	in.Split(bufio.ScanWords)
	var d dataHeap
	var r []data
	for i, n := 0, nextInt(); i < n; i++ {
		heap.Push(&d, data{i, nextInt()})
	}
	for len(d) > 1 {
		a := heap.Pop(&d).(data)
		b := heap.Pop(&d).(data)
		if a.v == b.v {
			b.v *= 2
		} else {
			r = append(r, a)
		}
		heap.Push(&d, b)
	}
	r = append(r, heap.Pop(&d).(data))
	sort.Slice(r, func(i, j int) bool { return r[i].i < r[j].i })
	fmt.Fprintln(out, len(r))
	for i, r := range r {
		if i != 0 {
			out.WriteByte(' ')
		}
		fmt.Fprint(out, r.v)
	}
	out.Flush()
}

func (h dataHeap) Len() int { return len(h) }
func (h dataHeap) Less(i, j int) bool {
	if h[i].v != h[j].v {
		return h[i].v < h[j].v
	}
	return h[i].i < h[j].i
}
func (h dataHeap) Swap(i, j int)       { h[i], h[j] = h[j], h[i] }
func (h *dataHeap) Push(x interface{}) { *h = append(*h, x.(data)) }
func (h *dataHeap) Pop() interface{}   { r := (*h)[len(*h)-1]; *h = (*h)[:len(*h)-1]; return r }

package main

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

type caseInput struct {
	nums []int
}

//	FIXME read the input
func readCaseInput(scanner *bufio.Scanner) caseInput {
	size := readInt(scanner)
	nums := make([]int, size)
	for i := range nums {
		nums[i] = readInt(scanner)
	}
	in := caseInput{nums}
	return in
}

type caseOutput struct {
	nums []int
}

func writeCaseOutput(writer *bufio.Writer, out caseOutput) {
	writef(writer, "%d\n", len(out.nums))
	for idx, num := range out.nums {
		if idx+1 < len(out.nums) {
			writef(writer, "%d ", num)
		} else {
			writef(writer, "%d\n", num)
		}
	}
}

func solveCase(in caseInput) caseOutput {
	// FIXME actual solution
	v2indexes, vSorted := buildIndexes(in)

	for i := 0; i < len(vSorted); i++ {
		v := vSorted[i]
		indexes := v2indexes[v]
		for len(indexes) > 1 {
			deleted := indexes[:2]
			inserted := deleted[1]
			indexes = indexes[2:]
			v2indexes[v] = indexes

			insertedIndexes, prs := v2indexes[2*v]
			if prs {
				iSearch := sort.SearchInts(insertedIndexes, inserted)
				if iSearch == len(insertedIndexes) {
					v2indexes[2*v] = append(insertedIndexes, inserted)
				} else if insertedIndexes[iSearch] != inserted {
					v2indexes[2*v] = append(insertedIndexes[:iSearch], append([]int{inserted}, insertedIndexes[iSearch:]...)...)
				}
			} else {
				v2indexes[2*v] = append(make([]int, 0, 2), inserted)

				vSearch := sort.SearchInts(vSorted, 2*v)
				if vSearch == len(vSorted) {
					vSorted = append(vSorted, 2*v)
				} else if vSorted[vSearch] != 2*v {
					vSorted = append(vSorted[:vSearch], append([]int{2 * v}, vSorted[vSearch:]...)...)
				}
			}
		}
	}

	temp := make([]int, len(in.nums))
	for v, indexes := range v2indexes {
		for _, index := range indexes {
			temp[index] = v
		}
	}

	res := make([]int, 0, len(in.nums))
	for _, v := range temp {
		if v > 0 {
			res = append(res, v)
		}
	}

	return caseOutput{res}
}

func buildIndexes(in caseInput) (map[int][]int, []int) {
	v2indexes := make(map[int][]int)
	vSorted := make([]int, 0, len(in.nums))
	for i, v := range in.nums {

		indexes, prs := v2indexes[v]
		if prs {
			v2indexes[v] = append(indexes, i)
		} else {
			v2indexes[v] = append(make([]int, 0, 2), i)
		}

		vSearch := sort.SearchInts(vSorted, v)
		if vSearch == len(vSorted) {
			vSorted = append(vSorted, v)
		} else if vSorted[vSearch] != v {
			vSorted = append(vSorted[:vSearch], append([]int{v}, vSorted[vSearch:]...)...)
		}
	}
	return v2indexes, vSorted
}

func solveSequential(scanner *bufio.Scanner, writer *bufio.Writer) {
	writeCaseOutput(writer, solveCase(readCaseInput(scanner)))
}

func main() {
	var scanner *bufio.Scanner
	if len(os.Args) > 1 {
		reader, err := os.Open(os.Args[1])
		if err != nil {
			panic(err)
		}
		defer reader.Close()
		scanner = bufio.NewScanner(reader)
	} else {
		scanner = bufio.NewScanner(os.Stdin)
	}
	scanner.Split(bufio.ScanWords)

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

	solveSequential(scanner, writer)
}

func readInt64(sc *bufio.Scanner) int64 {
	sc.Scan()
	res, err := strconv.ParseInt(sc.Text(), 10, 64)
	if err != nil {
		panic(err)
	}
	return res
}

func readInt(sc *bufio.Scanner) int {
	return int(readInt64(sc))
}

func writef(writer *bufio.Writer, formatStr string, values ...interface{}) {
	out := fmt.Sprintf(formatStr, values...)
	_, err := writer.WriteString(out)
	if err != nil {
		panic(err)
	}
}

package main

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

type caseInput struct {
	nums []int
}

func readCaseInput(scanner *bufio.Scanner) caseInput {
	size := readInt(scanner)
	nums := make([]int, size)
	for i := range nums {
		nums[i] = readInt(scanner)
	}
	in := caseInput{nums}
	return in
}

type caseOutput struct {
	nums []int
}

func writeCaseOutput(writer *bufio.Writer, out caseOutput) {
	writef(writer, "%d\n", len(out.nums))
	for idx, num := range out.nums {
		if idx+1 < len(out.nums) {
			writef(writer, "%d ", num)
		} else {
			writef(writer, "%d\n", num)
		}
	}
}

func solveCase(in caseInput) caseOutput {
	v2indexes, vSorted := buildIndexes(in)

	for i := 0; i < len(vSorted); i++ {
		v := vSorted[i]
		indexes := v2indexes[v]
		for len(indexes) > 1 {
			deleted := indexes[:2]
			inserted := deleted[1]
			indexes = indexes[2:]
			v2indexes[v] = indexes

			insertedIndexes, prs := v2indexes[2*v]
			if prs {
				iSearch := sort.SearchInts(insertedIndexes, inserted)
				if iSearch == len(insertedIndexes) {
					v2indexes[2*v] = append(insertedIndexes, inserted)
				} else if insertedIndexes[iSearch] != inserted {
					v2indexes[2*v] = append(insertedIndexes[:iSearch], append([]int{inserted}, insertedIndexes[iSearch:]...)...)
				}
			} else {
				v2indexes[2*v] = append(make([]int, 0, 2), inserted)

				vSearch := sort.SearchInts(vSorted, 2*v)
				if vSearch == len(vSorted) {
					vSorted = append(vSorted, 2*v)
				} else if vSorted[vSearch] != 2*v {
					vSorted = append(vSorted[:vSearch], append([]int{2 * v}, vSorted[vSearch:]...)...)
				}
			}
		}
	}

	temp := make([]int, len(in.nums))
	for v, indexes := range v2indexes {
		for _, index := range indexes {
			temp[index] = v
		}
	}

	res := make([]int, 0, len(in.nums))
	for _, v := range temp {
		if v > 0 {
			res = append(res, v)
		}
	}

	return caseOutput{res}
}

func buildIndexes(in caseInput) (map[int][]int, []int) {
	v2indexes := make(map[int][]int)
	vSorted := make([]int, 0, len(in.nums))
	for i, v := range in.nums {

		indexes, prs := v2indexes[v]
		if prs {
			v2indexes[v] = append(indexes, i)
		} else {
			v2indexes[v] = append(make([]int, 0, 2), i)
		}

		vSearch := sort.SearchInts(vSorted, v)
		if vSearch == len(vSorted) {
			vSorted = append(vSorted, v)
		} else if vSorted[vSearch] != v {
			vSorted = append(vSorted[:vSearch], append([]int{v}, vSorted[vSearch:]...)...)
		}
	}
	return v2indexes, vSorted
}

func solveSequential(scanner *bufio.Scanner, writer *bufio.Writer) {
	writeCaseOutput(writer, solveCase(readCaseInput(scanner)))
}

func main() {
	var scanner *bufio.Scanner
	if len(os.Args) > 1 {
		reader, err := os.Open(os.Args[1])
		if err != nil {
			panic(err)
		}
		defer reader.Close()
		scanner = bufio.NewScanner(reader)
	} else {
		scanner = bufio.NewScanner(os.Stdin)
	}
	scanner.Split(bufio.ScanWords)

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

	solveSequential(scanner, writer)
}

func readInt64(sc *bufio.Scanner) int64 {
	sc.Scan()
	res, err := strconv.ParseInt(sc.Text(), 10, 64)
	if err != nil {
		panic(err)
	}
	return res
}

func readInt(sc *bufio.Scanner) int {
	return int(readInt64(sc))
}

func writef(writer *bufio.Writer, formatStr string, values ...interface{}) {
	out := fmt.Sprintf(formatStr, values...)
	_, err := writer.WriteString(out)
	if err != nil {
		panic(err)
	}
}

package main

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

func main() {
	// map to save index of previous occurence
	indexes := make(map[int]int)
	var exist bool
	var index int
	// slice to save number
	var arr []int
	var total, n int

	// read len from console
	var reader *bufio.Reader = bufio.NewReader(os.Stdin)
	fmt.Fscanf(reader, "%d\n", &total)

	// make a slice with cap total
	arr = make([]int, total)

	// read num by num
	for i := 0; i < cap(arr); i++ {
		fmt.Fscanf(reader, "%d", &n)
		// attempt to get n from map
		index, exist = indexes[n]

		if exist == false {
			arr[i] = n
			indexes[n] = i
			continue
		}

		for exist == true {
			arr[index] = 0 // set to null
			delete(indexes, n) // forget
			total-- // decrement total of num by 1
			n *= 2
			arr[i] = n
			// repetively search for n * 2
			index, exist = indexes[n]
		}

		// update map when n becomes the first occurence
		indexes[n] = i
	}

	// print out result. omit 0 elements
	fmt.Println(total)
	for _, elem := range arr {
		if elem != 0 {
			fmt.Printf("%d ", elem)
		}
	}
}

package main

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

type num struct {
	val, index int
}

type hp []*num

func (h hp) Len() int {
	return len(h)
}

func (h hp) Less(i, j int) bool {
	if h[i].val < h[j].val {
		return true
	}
	if h[i].val > h[j].val {
		return false
	}
	return h[i].index < h[j].index
}

func (h hp) Swap(i, j int) {
	h[i], h[j] = h[j], h[i]
}

func (h *hp) Push(x interface{}) {
	*h = append(*h, x.(*num))
}

func (h *hp) Pop() interface{} {
	old := *h
	size := len(old)
	last := old[size-1]
	*h = old[0 : size-1]
	return last
}

var n int
var h hp
var b []num

func main() {
	inBuf := bufio.NewReader(os.Stdin)
	fmt.Fscanf(inBuf, "%d\n", &n)
	h = make([]*num, n)
	for i := 0; i < n; i++ {
		var tmp int
		fmt.Fscanf(inBuf, "%d", &tmp)
		h[i] = &num{val: tmp, index: i}
	}
	heap.Init(&h)
	b = make([]num, 0)
	for len(h) > 0 {
		t1 := heap.Pop(&h).(*num)
		if len(h) == 0 {
			b = append(b, *t1)
			break
		}
		var t2 *num
		for len(h) > 0 {
			t2 = heap.Pop(&h).(*num)
			if t1.val == t2.val {
				heap.Push(&h, &num{val: 2 * t1.val, index: t2.index})
				break
			}
			b = append(b, *t1)
			t1 = t2
			if len(h) == 0 {
				b = append(b, *t2)
			}
		}
	}
	sort.Slice(b, func(i, j int) bool {
		return b[i].index < b[j].index
	})
	outBuf := bufio.NewWriter(os.Stdout)
	defer func() { outBuf.Flush() } ()
	fmt.Fprintln(outBuf, len(b))
	for i := 0; i < len(b); i++ {
		fmt.Fprintf(outBuf, "%d ", b[i].val)
	}
}


package main

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

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)
func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{}) { fmt.Fscanf(reader, f, a...) }

func main(){
	defer writer.Flush()
	var n, i int
	var a [2004]int
	var ans []int
	scanf("%d\n", &n)
	for i=0;i<n;i++ {
		scanf("%d", &a[i])
		a[i] += 900000
	}
	ans = append(ans, 900000)
	for i=0;i<n-1;i++ {
		ans = append(ans, a[i]-i)
		a[i] %= a[i]-i
	}
	printf("%d\n1 %d 900000\n", n, n)
	for i=1;i<n;i++ {
		printf("2 %d %d\n", i, ans[i])
	}
	// printf("debug:")
	// for i=0;i<n;i++ {
	// 	printf(" %d", a[i])
	// }
	// printf("\n")
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	n := 0
	fmt.Fscanf(in, "%d\n", &n)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscanf(in, "%d", &a[i])
	}
	currentSum := 0
	fmt.Fprintf(out, "%d\n", n+1)
	for i := n - 1; i >= 0; i-- {
		j := i - (a[i]+currentSum)%n
		if j < 0 {
			j += n
		}
		currentSum += j
		a[i] = (a[i] + currentSum) % n
		fmt.Fprintf(out, "%d %d %d\n", 1, i+1, j)
	}
	fmt.Fprintf(out, "%d %d %d\n", 2, n, n)
	//fmt.Println(a)
	return
}

package main
import "fmt"
func main() {
	var n int
	fmt.Scanf("%d",&n)
	for i:= 1;i<=n;i++{
		var x int
		fmt.Scanf("%d",&x)
	}
	ps := 1000000
	fmt.Println(n+1)
	fmt.Printf("2 %d 1\n",n)
	fmt.Printf("1 %d %d\n",n,ps)
	for i:=1;i<n;i++{
		fmt.Printf("2 %d %d\n",i,ps+1-i)
	}
}

package main

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

var scanner = bufio.NewScanner(os.Stdin)

func scanNum() int {
	scanner.Scan()
	num, _ := strconv.Atoi(scanner.Text())
	return num
}

func main() {
	scanner.Split(bufio.ScanWords)
	n := scanNum()
	res := []string{}
	// n is also gen the final 2 n n+1
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = scanNum()
	}
	counter := 0
	for i := 1; i < n; i++ {
		if a[i] > a[i-1] {
			counter++
		}
	}
	// if counter == (len(a) - 1) {
	// 	fmt.Println(0)
	// 	os.Exit(0)
	// }

	sum, width := 0, n+1
	for i := n - 1; i >= 0; i-- {
		if (a[i]+sum)%width == i {
			continue
		}
		add := i - (a[i]+sum)%width
		if add < 0 {
			add += width
		}
		res = append(res, fmt.Sprintln(1, i+1, add))
		sum = (sum + add) % width
	}
	if len(res) == 0 {
		fmt.Println(0)
	} else {
		fmt.Println(len(res) + 1)
		for _, v := range res {
			fmt.Print(v)
		}
		fmt.Println(2, n, width)
	}
}

package main

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

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)
func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{}) { fmt.Fscanf(reader, f, a...) }

func main(){
	defer writer.Flush()
	var n, i int
	var a [2004]int
	var ans []int
	scanf("%d\n", &n)
	for i=0;i<n;i++ {
		scanf("%d", &a[i])
		a[i] += 900000
	}
	ans = append(ans, 900000)
	for i=0;i<n-1;i++ {
		ans = append(ans, a[i]-i)
		a[i] %= a[i]-i
	}
	printf("%d\n1 %d 900000\n", n, n)
	for i=0;i<n-1;i++ {
		printf("2 %d %d\n", i, ans[i+1])
	}
	// printf("debug:")
	// for i=0;i<n;i++ {
	// 	printf(" %d", a[i])
	// }
	// printf("\n")
}

package main

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

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)
func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{}) { fmt.Fscanf(reader, f, a...) }

func main(){
	defer writer.Flush()
	var n, i, j int
	var a [2004]int
	var ans []int
	scanf("%d\n", &n)
	for i=0;i<n;i++ {
		scanf("%d", &a[i])
		a[i] += 1000000
	}
	ans = append(ans, 1000000)
	for i=n-2;i>=0;i-- {
		ans = append(ans, a[i+1])
		for j=0;j<=i;j++ {
			a[j] %= a[i+1]
		}
	}
	printf("%d\n1 %d 1000000\n", n, n)
	for i=1;i<n;i++ {
		printf("2 %d %d\n", n-i, ans[i])
	}
	// printf("debug:")
	// for i=0;i<n;i++ {
	// 	printf(" %d", a[i])
	// }
	// printf("\n")
}

package main
import "fmt"
func main() {
	var n int
	fmt.Scanf("%d",&n)
	for i:= 1;i<=n;i++{
		var x int
		fmt.Scanf("%d",&x)
	}
	ps := 1000000
	fmt.Println(n+1)
	fmt.Printf("2 %d 1\n",n)
	fmt.Printf("2 %d %d\n",n,ps)
	for i:=1;i<n;i++{
		fmt.Printf("2 %d %d\n",i,ps+1-i)
	}
}

package main

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

var scanner = bufio.NewScanner(os.Stdin)

func scanNum() int {
	scanner.Scan()
	num, _ := strconv.Atoi(scanner.Text())
	return num
}

func main() {
	scanner.Split(bufio.ScanWords)
	n := scanNum()
	// n is also gen the final 2 n n+1
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = scanNum()
	}
	counter := 0
	for i := 1; i < n; i++ {
		if a[i] > a[i-1] {
			counter++
		}
	}
	if counter == (len(a) - 1) {
		fmt.Println(0)
		os.Exit(0)
	}

	sum, printNone, width := 0, true, n+1
	for i := n - 1; i >= 0; i-- {
		if (a[i]+sum)%width == i {
			continue
		}
		add := i - (a[i]+sum)%width
		if add < 0 {
			add += width
		}
		fmt.Println(1, i+1, add)
		printNone, sum = false, (sum+add)%width
	}
	if printNone {
		fmt.Println(0)
	} else {
		fmt.Println(2, n, width)
	}
}

package main

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

var scanner = bufio.NewScanner(os.Stdin)

func scanNum() int {
	scanner.Scan()
	num, _ := strconv.Atoi(scanner.Text())
	return num
}
func main() {
	scanner.Split(bufio.ScanWords)
	n := scanNum()
	// n is also gen the final 2 n n+1
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = scanNum()
	}

	sum, printNone, width := 0, true, n+1
	for i := n - 1; i >= 0; i-- {
		expectVal := i + 1
		if (a[i]+sum)%width == expectVal {
			continue
		}
		add := expectVal - (a[i]+sum)%width
		if add < 0 {
			add += width
		}
		fmt.Println(1, i+1, add)
		printNone, sum = false, sum+add
	}
	if printNone {
		fmt.Println(0)
	} else {
		fmt.Println(2, n, width)
	}
}

package main

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

var scanner = bufio.NewScanner(os.Stdin)

func scanNum() int {
	scanner.Scan()
	num, _ := strconv.Atoi(scanner.Text())
	return num
}
func main() {
	scanner.Split(bufio.ScanWords)
	n := scanNum()
	// n is also gen the final 2 n n+1
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = scanNum()
	}

	sum, pos, printNone, width := 0, n, true, n+1
	for i := n - 1; i >= 0; i-- {
		cur := a[i] + sum
		if cur%width != pos {
			diff := pos - cur%width
			add := width + diff
			fmt.Println(1, i+1, add)
			printNone, sum = false, (sum+add)%width
		}
		pos--
	}
	if printNone {
		fmt.Println(0)
	} else {
		fmt.Println(2, n, width)
	}
}

package main

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

var scanner = bufio.NewScanner(os.Stdin)

func scanNum() int {
	scanner.Scan()
	num, _ := strconv.Atoi(scanner.Text())
	return num
}

func main() {
	scanner.Split(bufio.ScanWords)
	n := scanNum()
	// n is also gen the final 2 n n+1
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = scanNum()
	}

	sum, printNone, width := 0, true, n+1
	for i := n - 1; i >= 0; i-- {
		if (a[i]+sum)%width == i {
			continue
		}
		add := i - (a[i]+sum)%width
		if add < 0 {
			add += width
		}
		fmt.Println(1, i+1, add)
		printNone, sum = false, (sum+add)%width
	}
	if printNone {
		fmt.Println(0)
	} else {
		fmt.Println(2, n, width)
	}
}

package main

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

var scanner = bufio.NewScanner(os.Stdin)

func scanNum() int {
	scanner.Scan()
	num, _ := strconv.Atoi(scanner.Text())
	return num
}
func main() {
	scanner.Split(bufio.ScanWords)
	n := scanNum()
	// n is also gen the final 2 n n+1
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = scanNum()
	}

	sum, width := 0, n+1
	for i := n - 1; i >= 0; i-- {
		expectVal := i + 1
		add := expectVal - (a[i]+sum)%width
		if add < 0 {
			add += width
		}
		fmt.Println(1, i+1, add)
		sum += add
	}

	fmt.Println(2, n, width)
}


package main

import "fmt"

// Next permutation.
func next(p []int) bool {
	var k, l int
	for k = len(p) - 2; ; k-- {
		if k < 0 {
			return false
		}
		if p[k] < p[k+1] {
			break
		}
	}
	for l = len(p) - 1; p[k] >= p[l]; l-- {
	}
	p[k], p[l] = p[l], p[k]
	for i, j := k+1, len(p)-1; i < j; i++ {
		p[i], p[j] = p[j], p[i]
		j--
	}
	return true
}

func main() {
	var n, m int
	fmt.Scan(&n, &m)
	maze := make([]string, n)
	for i := range maze {
		fmt.Scan(&maze[i])
	}
	var s string
	fmt.Scan(&s)

	perm := []int{0, 1, 2, 3}
	ans := 0
	for {
		if exit(maze, perm, s) {
			ans++
		}
		if !next(perm) {
			break
		}
	}
	fmt.Println(ans)
}

func exit(maze []string, instr []int, s string) bool {
	r, c := find(maze)
	for i := range s {
		switch instr[s[i]-'0'] {
		case 0:
			r++
		case 1:
			r--
		case 2:
			c++
		case 3:
			c--
		}
		if r < 0 || r >= len(maze) || c < 0 || c >= len(maze[0]) || maze[r][c] == '#' {
			return false
		}
		if maze[r][c] == 'E' {
			return true
		}
	}
	return false
}

func find(m []string) (r, c int) {
	for r = 0; r < len(m); r++ {
		for c = 0; c < len(m[0]); c++ {
			if m[r][c] == 'S' {
				return
			}
		}
	}
	return
}

package main

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

var start Pos
var goal Pos

var check = map[int]int{}
var s string
var N, M int

var ans int

func recv(field []string, count int) {

	if count == 4 {

		current := start

		for i, _ := range s {
			m, _ := strconv.Atoi(string(s[i]))
			v := check[m]
			next := current

			if v == 0 {
				next.x = current.x + 1
			} else if v == 1 {
				next.x = current.x - 1
			} else if v == 2 {
				next.y = current.y + 1
			} else if v == 3 {
				next.y = current.y - 1
			}
			if 0 <= next.x && next.x < N && 0 <= next.y && next.y < M {

			} else {
				return
			}
			if field[next.x][next.y] == '#' {
				return
			}
			if field[next.x][next.y] == 'E' {

				ans++
				return
			}

			current = next
		}
		return
	}
	for i := 0; i < 4; i++ {
		if _, ok := check[i]; ok {
			continue
		}
		check[i] = count
		recv(field, count+1)
		delete(check, i)
	}
}

type Pos struct {
	x int
	y int
}

func main() {
	sc := NewScanner()
	N, M = sc.NextInt(), sc.NextInt()

	field := make([]string, N)

	for i := 0; i < N; i++ {
		field[i] = sc.NextLine()
		for j := 0; j < M; j++ {
			if field[i][j] == 'S' {
				start = Pos{i, j}
			} else if field[i][j] == 'E' {
				goal = Pos{i, j}
			}
		}
	}
	s = sc.NextLine()
	recv(field, 0)
	fmt.Println(ans)
}

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

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

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

	return result
}
func (s *Scanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

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

	return mp
}

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


package main

import (
	"fmt"
)

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

	Board := make([][]byte, n)
	var buf string
	for i := 0; i < len(Board); i++ {
		fmt.Scanf("%s\n", &buf)
		Board[i] = []byte(buf)
	}

	Moves := make([][]byte, 2*n - 1)
	for i := 0; i < len(Moves); i++ {
		for j := 0; j < len(Moves); j++ {
			Moves[i] = append(Moves[i], 'x')
		}
	}
	Moves[n-1][n-1] = 'o'

	for i := 0; i < n; i++ {
		for j := 0; j < n; j++ {
			if Board[i][j] == 'o' {
				l := n-i-1
				for ; l < 2*n-i-1; l++ {
					for r := n-j-1; r < 2*n-j-1; r++ {
						if Board[i+l-n+1][j+r-n+1] == '.' {
							Moves[l][r] = '.'
						}
					}
				}
			}
		}
	}

	for i := 0; i < n; i++ {
		for j := 0; j < n; j++ {
			if Board[i][j] == 'o' {
				l := n-i-1
				for ; l < 2*n-i-1; l++ {
					for r := n-j-1; r < 2*n-j-1; r++ {
						if Moves[l][r] == 'x' && Board[i+l-n+1][j+r-n+1] != 'o' {
							Board[i+l-n+1][j+r-n+1] = '.'
						}
					}
				}
			}
		}
	}

	for i := 0; i < n; i++ {
		for j := 0; j < n; j++ {
			if Board[i][j] == 'x' {
				fmt.Println("NO")
				return
			}
		}
	}

	fmt.Println("YES")
	for i := 0; i < 2*n-1; i++ {
		fmt.Println(string(Moves[i]))
	}
}

package main

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

func work(Board, Moves [][]byte, n int) {
	for i := 0; i < n; i++ {
		for j := 0; j < n; j++ {
			if Board[i][j] == 'o' {
				l := n-i-1
				for ; l < 2*n-i-1; l++ {
					for r := n-j-1; r < 2*n-j-1; r++ {
						if Board[i+l-n+1][j+r-n+1] == '.' {
							Moves[l][r] = '.'
						}
					}
				}
			}
		}
	}
}

func workHard(Board, Moves [][]byte, n int) {
	for i := 0; i < n; i++ {
		for j := 0; j < n; j++ {
			if Board[i][j] == 'o' {
				l := n-i-1
				for ; l < 2*n-i-1; l++ {
					for r := n-j-1; r < 2*n-j-1; r++ {
						if Moves[l][r] == 'x' && Board[i+l-n+1][j+r-n+1] != 'o' {
							Board[i+l-n+1][j+r-n+1] = '.'
						}
					}
				}
			}
		}
	}
}

func read() (int, [][]byte, [][]byte) {
	stdin := bufio.NewReader(os.Stdin)

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

	Board := make([][]byte, n)
	var buf string
	for i := 0; i < len(Board); i++ {
		fmt.Fscanf(stdin, "%s\n", &buf)
		Board[i] = []byte(buf)
	}

	Moves := make([][]byte, 2*n - 1)
	for i := 0; i < len(Moves); i++ {
		for j := 0; j < len(Moves); j++ {
			Moves[i] = append(Moves[i], 'x')
		}
	}
	Moves[n-1][n-1] = 'o'
	return n, Board, Moves
}

func main() {
	n, Board, Moves := read()

	work(Board, Moves, n)
	workHard(Board, Moves, n)

	for i := 0; i < n; i++ {
		for j := 0; j < n; j++ {
			if Board[i][j] == 'x' {
				fmt.Println("NO")
				return
			}
		}
	}

	s := "YES\n"
	for i := 0; i < 2*n-1; i++ {
		s += string(Moves[i]) + "\n"
	}
	fmt.Print(s)
}

package main

import "fmt"

func work(Board, Moves [][]byte, n int) {
	for i := 0; i < n; i++ {
		for j := 0; j < n; j++ {
			if Board[i][j] == 'o' {
				l := n-i-1
				for ; l < 2*n-i-1; l++ {
					for r := n-j-1; r < 2*n-j-1; r++ {
						if Board[i+l-n+1][j+r-n+1] == '.' {
							Moves[l][r] = '.'
						}
					}
				}
			}
		}
	}
}

func workHard(Board, Moves [][]byte, n int) {
	for i := 0; i < n; i++ {
		for j := 0; j < n; j++ {
			if Board[i][j] == 'o' {
				l := n-i-1
				for ; l < 2*n-i-1; l++ {
					for r := n-j-1; r < 2*n-j-1; r++ {
						if Moves[l][r] == 'x' && Board[i+l-n+1][j+r-n+1] != 'o' {
							Board[i+l-n+1][j+r-n+1] = '.'
						}
					}
				}
			}
		}
	}
}

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

	Board := make([][]byte, n)
	var buf string
	for i := 0; i < len(Board); i++ {
		fmt.Scanf("%s\n", &buf)
		Board[i] = []byte(buf)
	}

	Moves := make([][]byte, 2*n - 1)
	for i := 0; i < len(Moves); i++ {
		for j := 0; j < len(Moves); j++ {
			Moves[i] = append(Moves[i], 'x')
		}
	}
	Moves[n-1][n-1] = 'o'

	work(Board, Moves, n)
	workHard(Board, Moves, n)

	for i := 0; i < n; i++ {
		for j := 0; j < n; j++ {
			if Board[i][j] == 'x' {
				fmt.Println("NO")
				return
			}
		}
	}

	fmt.Println("YES")
	for i := 0; i < 2*n-1; i++ {
		fmt.Println(string(Moves[i]))
	}
}

package main

import "fmt"

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

	Board := make([]string, n)
	for i := 0; i < n; i++ {
		fmt.Scanf("%s\n", &Board[i])
	}

	Moves := make([]string, 2*n - 1)
	for i := 0; i < len(Moves); i++ {
		for j := 0; j < len(Moves); j++ {
			if i == n-1 && j == n-1 {
				Moves[i] += "o"
			} else {
				Moves[i] += "x"
			}
		}
	}

	for i := 0; i < n; i++ {
		for j := 0; j < n; j++ {
			if Board[i][j] == 'o' {
				l := n-i-1
				for ; l < 2*n-i-1; l++ {
					for r := n-j-1; r < 2*n-j-1; r++ {
						if Board[i+l-n+1][j+r-n+1] == '.' {
							Moves[l] = Moves[l][:r] + "." + Moves[l][r+1:]
						}
					}
				}
			}
		}
	}

	for i := 0; i < n; i++ {
		for j := 0; j < n; j++ {
			if Board[i][j] == 'o' {
				l := n-i-1
				for ; l < 2*n-i-1; l++ {
					for r := n-j-1; r < 2*n-j-1; r++ {
						if Moves[l][r] == 'x' && Board[i+l-n+1][j+r-n+1] != 'o' {
							Board[i+l-n+1] = Board[i+l-n+1][:j+r-n+1] + "." + Board[i+l-n+1][j+r-n+2:]
						}
					}
				}
			}
		}
	}

	for i := 0; i < n; i++ {
		for j := 0; j < n; j++ {
			if Board[i][j] == 'x' {
				fmt.Println("NO")
				return
			}
		}
	}

	fmt.Println("YES")
	for i := 0; i < 2*n-1; i++ {
		fmt.Println(Moves[i])
	}
}

package main

import "fmt"

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

	Board := make([]string, n)
	for i := 0; i < n; i++ {
		fmt.Scanf("%s\n", &Board[i])
	}

	Moves := make([]string, 2*n - 1)
	for i := 0; i < len(Moves); i++ {
		for j := 0; j < len(Moves); j++ {
			if i == n-1 && j == n-1 {
				Moves[i] += "o"
			} else {
				Moves[i] += "x"
			}
		}
	}

	for i := 0; i < n; i++ {
		for j := 0; j < n; j++ {
			if Board[i][j] == 'o' {
				l := n-i-1
				for ; l < 2*n-i-1; l++ {
					for r := n-j-1; r < 2*n-j-1; r++ {
						if Board[i+l-n+1][j+r-n+1] == '.' {
							Moves[l] = Moves[l][:r] + "." + Moves[l][r+1:]
						}
					}
					fmt.Println("")
				}
			}
		}
	}

	for i := 0; i < n; i++ {
		for j := 0; j < n; j++ {
			if Board[i][j] == 'o' {
				l := n-i-1
				for ; l < 2*n-i-1; l++ {
					for r := n-j-1; r < 2*n-j-1; r++ {
						if Moves[l][r] == 'x' {
							Board[i+l-n+1] = Board[i+l-n+1][:j+r-n+1] + "." + Board[i+l-n+1][j+r-n+2:]
						}
					}
				}
			}
		}
	}

	for i := 0; i < n; i++ {
		for j := 0; j < n; j++ {
			if Board[i][j] == 'x' {
				fmt.Println("NO")
				return
			}
		}
	}

	fmt.Println("YES")
	for i := 0; i < 2*n-1; i++ {
		fmt.Println(Moves[i])
	}
}


package main

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

var scanner *bufio.Scanner

func getI64() int64 {
  scanner.Scan()
  x, _ := strconv.ParseInt(scanner.Text(), 10, 64)
  return x
}
func getI() int {
  return int(getI64())
}
func getF() float64 {
  scanner.Scan()
  x, _ := strconv.ParseFloat(scanner.Text(), 64)
  return x
}
func getS() string {
  scanner.Scan()
  return scanner.Text()
}

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

  vowels := "aeiou"
  counts := make([]int, 3)
  for i := range counts {
    line, _ := reader.ReadString('\n')
    for _, ch := range line {
      if strings.IndexRune(vowels, ch) != -1 {
        counts[i]++
      }
    }
  }
  if counts[0] == 5 && counts[1] == 7 && counts[2] == 5 {
    writer.WriteString("YES\n")
  } else {
    writer.WriteString("NO\n")
  }
}

package main

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

func main(){
	phrases := make([]string, 3)
	ans := []int{5, 7, 5}
	r := bufio.NewScanner(os.Stdin)
	for i:=0; i<3; i++ {
		count := 0
		r.Scan()
		phrases[i] = r.Text()
		for k:=0; k<len(phrases[i]); k++ {
			if string(phrases[i][k]) == "a" || string(phrases[i][k]) == "i" || string(phrases[i][k]) == "u" || string(phrases[i][k]) == "e" || string(phrases[i][k]) == "o" {
				count += 1
			}
		}
		if count != ans[i] {
			fmt.Println("NO")
			return
		}
	}
	fmt.Println("YES")
}

package main

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

func CountVowel(s string) int {
    cnt := 0
    for _, v := range s {
        if (v == 'a') || (v == 'e') || (v == 'i') || (v == 'o') || (v == 'u') {
            cnt++
        }
    }
    return cnt
}

func main() {
    scanner := bufio.NewScanner(os.Stdin)
    var s [3]string
    for i := 0; i < 3; i++ {
        scanner.Scan()
        s[i] = scanner.Text()
    }
    if (CountVowel(s[0]) == 5) && (CountVowel(s[1]) == 7) && (CountVowel(s[2]) == 5) {
        fmt.Println("YES")
    } else {
        fmt.Println("NO")
    }
}

// 78A
package main

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

func main() {
	var s string
	in := bufio.NewScanner(os.Stdin)
	i, k, j, b := 0, 0, 0, 0
	for j = 0; j < 3; j++ {
		in.Scan()
		s = in.Text()
		for k = 0; k < len(s); k++ {
			if s[k] == 'a' || s[k] == 'o' || s[k] == 'u' || s[k] == 'e' || s[k] == 'i' {
				i++
			}
		}

		if j == 0 && i != 5 {
			b = 1
			break
		}
		if j == 1 && i != 7 {
			b = 1
			break
		}
		if j == 2 && i != 5 {
			b = 1
			break
		}
		i = 0
	}

	if b == 0 {
		fmt.Print("YES")
	}
	if b == 1 {
		fmt.Print("NO")
	}
}

package main
import (
    "fmt"
    "bufio"
    "os"
)
func main() {
    var b [3]int
    var s string
    input:= bufio.NewScanner(os.Stdin)
    for i:=0;i<3;i++ {
        input.Scan()
        s =input.Text()
        for j:=0;j<len(s);j++ {
            if s[j]=='a' || s[j]=='e' || s[j]=='o' || s[j]=='u' || s[j]=='i'{
                b[i]++
            }
        }
    }
    if b[0]==5 && b[1]==7 && b[2]==5 {
        fmt.Println("YES")
    } else {
        fmt.Println("NO")
    }
}

package main

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

func main(){
	phrases := make([]string, 3)
	for i:=0; i<3; i++ {
		r := bufio.NewScanner(os.Stdin)
		r.Scan()
		phrases[i] = r.Text()
	}
	count := make([]int, 3)
	for j:=0; j<3; j++ {
		len := len(phrases[j])
		for k:=0; k<len; k++ {
			if string(phrases[j][k]) == "a" || string(phrases[j][k]) == "i" || string(phrases[j][k]) == "u" || string(phrases[j][k]) == "e" || string(phrases[j][k]) == "o"{
				count[j] += 1
			}
		}
	}
	if count[0] == 5 && count[1] == 7 && count[2] == 5 {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
		fmt.Println(count[0], count[1], count[2])
	}
}

package main

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

func main(){
	phrases := make([]string, 3)
	for i:=0; i<3; i++ {
		r := bufio.NewScanner(os.Stdin)
		r.Scan()
		phrases[i] = r.Text()
	}
	count := make([]int, 3)
	for j:=0; j<3; j++ {
		len := len(phrases[j])
		for k:=0; k<len; k++ {
			if string(phrases[j][k]) == "a" || string(phrases[j][k]) == "i" || string(phrases[j][k]) == "u" || string(phrases[j][k]) == "e" || string(phrases[j][k]) == "o"{
				count[j] += 1
			}
		}
	}
	if count[0] == 5 && count[1] == 7 && count[2] == 5 {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}


package main

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

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

	var n, m int
	Fscan(in, &n, &m)
	a := make([][]int, n)
	for i := range a {
		a[i] = make([]int, m)
		for j := range a[i] {
			Fscan(in, &a[i][j])
		}
	}
	var f func(int) bool
	f = func(e int) bool {
		for _, r := range a[1:] {
			d := []int{}
			for j, v := range r {
				if v != a[0][j] {
					d = append(d, j)
				}
			}
			if len(d) < 3 {
				continue
			}
			if len(d) <= 2+e {
				for _, j := range d {
					tmp := a[0][j]
					a[0][j] = r[j]
					if f(e - 1) {
						return true
					}
					a[0][j] = tmp
				}
			}
			return false
		}
		return true
	}
	if f(2) {
		Fprintln(out, "Yes")
		for _, v := range a[0] {
			Fprint(out, v, " ")
		}
	} else {
		Fprint(out, "No")
	}
}

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

package main

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

func main() {
	input := bufio.NewReader(os.Stdin)
	output := bufio.NewWriter(os.Stdout)

	defer output.Flush()

	var n, m int

	fmt.Fscan(input, &n, &m)

	s := make([][]int, n)
	for i := range s {
		s[i] = make([]int, m)
		for j := range s[i] {
			fmt.Fscan(input, &s[i][j])
		}
	}

	var a func(int) bool
	a = func(e int) bool {
		for _, r := range s[1:] {
			d := []int{}
			for j, v := range r {
				if v != s[0][j] {
					d = append(d, j)
				}
			}

			if len(d) > 2 {
				if len(d) <= 2+e {
					for _, j := range d {
						tmp := s[0][j]
						s[0][j] = r[j]
						if a(e - 1) {
							return true
						}
						s[0][j] = tmp
					}
				}
				return false
			}

		}

		return true

	}

	if a(2) {
		fmt.Fprint(output, "Yes \n")
		for _, v := range s[0] {
			fmt.Fprint(output, v, "  ")
		}
	} else {
		fmt.Fprint(output, "No")
	}

}

package main

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

// github.com/EndlessCheng/codeforces-go
func CF1492E(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()
	var n, m int
	Fscan(in, &n, &m)
	a := make([][]int, n)
	for i := range a {
		a[i] = make([]int, m)
		for j := range a[i] {
			Fscan(in, &a[i][j])
		}
	}
	var f func(int) bool
	f = func(canModify int) bool {
		for _, r := range a[1:] {
			d := []int{}
			for j, v := range r {
				if v != a[0][j] {
					d = append(d, j)
				}
			}
			if len(d) <= 2 {
				continue
			}
			if len(d) <= 2+canModify {
				for _, j := range d {
					tmp := a[0][j]
					a[0][j] = r[j]
					if f(canModify - 1) {
						return true
					}
					a[0][j] = tmp
				}
			}
			return false
		}
		return true
	}
	if f(2) {
		Fprintln(out, "Yes")
		for _, v := range a[0] {
			Fprint(out, v, " ")
		}
	} else {
		Fprint(out, "No")
	}
}

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

package main

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

// github.com/EndlessCheng/codeforces-go
func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()

	var n, m int
	Fscan(in, &n, &m)
	a := make([][]int, n)
	for i := range a {
		a[i] = make([]int, m)
		for j := range a[i] {
			Fscan(in, &a[i][j])
		}
	}
	var f func(int) bool
	f = func(e int) bool {
		for _, r := range a[1:] {
			d := []int{}
			for j, v := range r {
				if v != a[0][j] {
					d = append(d, j)
				}
			}
			if len(d) > 2 {
				if len(d) <= 2+e {
					for _, j := range d {
						tmp := a[0][j]
						a[0][j] = r[j]
						if f(e - 1) {
							return true
						}
						a[0][j] = tmp
					}
				}
				return false
			}
		}
		return true
	}
	if f(2) {
		Fprintln(out, "Yes")
		for _, v := range a[0] {
			Fprint(out, v, " ")
		}
	} else {
		Fprint(out, "No")
	}
}

package main

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

func main() {
	input := bufio.NewReader(os.Stdin)
	output := bufio.NewWriter(os.Stdout)

	defer output.Flush()

	var n, m int

	fmt.Fscan(input, &n, &m)

	s := make([][]int, n)
	for i := range s {
		s[i] = make([]int, m)
		for j := range s[i] {
			fmt.Fscan(input, &s[i][j])
		}
	}

	var a func(int) bool
	a = func(e int) bool {
		for _, r := range s[1:] {
			d := []int{}
			for j, v := range r {
				if v != s[0][j] {
					d = append(d, j)
				}
			}

			if len(d) > 2 {
				if len(d) <= 2+e {
					for _, j := range d {
						tmp := s[0][j]
						s[0][j] = r[j]
						if a(e - 1) {
							return true
						}
						s[0][j] = tmp
					}
				}
				return false
			}

		}

		return true

	}

	if a(2) {
		fmt.Fprint(output, "Yes")
		for _, v := range s[0] {
			fmt.Fprint(output, v, "  ")
		}
	} else {
		fmt.Fprint(output, "No")
	}

}


package main

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

func main() {
	var n, m int
	if _, err := fmt.Scanf("%d\n%d\n", &n, &m); err != nil {
		return
	}

	u := make([]int, n)
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	for i := 0; i < n && scanner.Scan(); i++ {
		a, err := strconv.Atoi(scanner.Text())
		if err != nil {
			return
		}
		u[i] = a
	}

	bubble_sort(u, n)

	disks := 0
	capacity := 0
	for i := 0; i < n; i++ {
		disks += 1
		capacity += u[i]
		if capacity >= m {
			break
		}
	}
	fmt.Println(disks)
}

func swap(a, b int, array []int) {
	tmp := array[a]
	array[a] = array[b]
	array[b] = tmp
}

func bubble_sort(array []int, length int) {
	for i := 0; i < length; i++ {
		for j := 0; j < length; j++ {
			if array[i] > array[j] {
				swap(i, j, array)
			}
		}
	}
}

package main

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

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

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

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

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

	sort.Ints(a)

	totalM := 0
	usb := 0

	for totalM < m {
		totalM += a[n-1]
		n--
		usb++
	}

	println(usb)
}

func scan(a ...interface{}) {
	fmt.Fscan(reader, a...)
}

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

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

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

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

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

package main

import (
	"fmt"
	"sort"
)

func main() {
	var n, m int
	fmt.Scan(&n, &m)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i])
	}
	sort.Ints(a)
	i := 1
	for ; m > 0; i++ {
		m -= a[n-i]
	}
	fmt.Println(i - 1)
}

package main

import (
	"fmt"
	"sort"
)

func main() {
	var n, m int
	var a [1010]int

	fmt.Scanln(&n)
	fmt.Scanln(&m)
	for i := 0; i < n; i++ {
		fmt.Scanln(&a[i])
	}

	sort.Sort(sort.Reverse(sort.IntSlice(a[:n])))

	var result int
	for total := 0; total < m; total, result = total+a[result], result+1 {
	}

	fmt.Println(result)
}

package main

import "fmt"

import "sort"

func main() {
        var n, v int
        var m [200]int
        fmt.Scanln(&n)
        fmt.Scanln(&v)
        for i := 0; i < n; i++ {
                fmt.Scanln(&m[i])
        }
        var s []int = m[:n]
        sort.Sort(sort.Reverse(sort.IntSlice(s)))
        //      fmt.Println(s)
        cnt := 0
        for i := 0; i < n; i++ {
                v -= m[i]
                cnt++
                if v <= 0 {
                        fmt.Println(cnt)
                        break
                }
        }

}

package main

import (
	"fmt"
	"sort"
)

func main() {
	var n, m int
	fmt.Scan(&n)
	fmt.Scan(&m)
	a := make([]int, n)
	for i := range a {
		fmt.Scan(&a[i])
	}
	sort.Ints(a)
	var out int
	for i := len(a) - 1; i >= 0; i-- {
		temp := m - a[i]
		if temp > 0 {
			out++
			m -= a[i]
		} else {
			break
		}
	}
	fmt.Println(out + 1)
}

package main

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

//N _
const (
	N = 2*1e5 + 5
)

func inputter(inputReader *bufio.Reader,strs chan *string){
	for {
		input , _ := inputReader.ReadString('\n')
		input = strings.TrimSpace(input)
		if len(input) > 0 {
			inputs := strings.Split(input, " ")
			for i := range inputs{
				strs <- &inputs[i]
			}
		}
	}
}

func main(){
	rs := bufio.NewReader(os.Stdin)
	ws := bufio.NewWriter(os.Stdout)

	strs := make(chan *string, 100)

	go inputter(rs, strs)

	n , _ := strconv.ParseInt(*<-strs, 10, 64)
	m , _ := strconv.ParseInt(*<-strs, 10, 64)

	a := make([]int, 0, N)

	for i := 0; i < int(n); i++ {
		x, _ := strconv.ParseInt(*<-strs, 10, 32)
		a = append(a, int(x))
	}

	sort.SliceStable(a, func(i,j int)bool{return a[i] > a[j]})

	tot := int64(0)

	for i := 0; i < int(n); i++ {
		tot += int64(a[i])
		if tot >= m{
			ws.WriteString(fmt.Sprint(i + 1))
			break
		}
	}

	ws.Flush()
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"math/rand"
	"os"
)

const INF  = 1000000001

type Pair struct {
	first, second int
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}
func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}
func sort(arr []int) []int {
	if len(arr) < 2 {
		return arr
	}
	left := 0
	right := len(arr) - 1
	pivot := rand.Int() % len(arr)

	arr[pivot], arr[right] = arr[right], arr[pivot]

	for i := 0; i < len(arr); i++ {
		if arr[i] > arr[right] {
			arr[i], arr[left] = arr[left], arr[i]
			left++
		}
	}

	arr[left], arr[right] = arr[right], arr[left]

	sort(arr[:left])
	sort(arr[left+1:])
	return arr
}

func solution(reader io.Reader, writer io.Writer) {
	var n, m int

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

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

	a = sort(a)

	for i := 0; i < n; i++ {
		m-=a[i]
		if m <= 0 {
			fmt.Fprintf(writer, "%d\n", i + 1)
			return
		}
	}

}

func main() {

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

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

	solution(reader, writer)
}

package main

import (
	"fmt"
	"sort"
)

func main() {
	var n, m int
	var a [1010]int

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

	sort.Sort(sort.Reverse(sort.IntSlice(a[:n])))

	var result int
	for total := 0; total < m; total, result = total+a[result], result+1 {
	}

	fmt.Println(result)
}

package main

import "fmt"

import "sort"

func main() {
        var n, v int
        var m [200]int
        fmt.Scanf("%d\n%d", &n, &v)
        for i := 0; i < n; i++ {
                fmt.Scanf("%d\n", &m[i])
        }
        var s []int = m[:n]
        sort.Sort(sort.Reverse(sort.IntSlice(s)))
        //      fmt.Println(s)
        cnt := 0
        for i := 0; i < n; i++ {
                v -= m[i]
                cnt++
                if v <= 0 {
                        fmt.Println(cnt)
                        break
                }
        }

}

package main

import "fmt"

import "sort"

func main() {
        var n, v int
        var m [200]int
        fmt.Scanf("%d\n%d", &n, &v)
        for i := 0; i < n; i++ {
                fmt.Scanf("%d", &m[i])
        }
        var s []int = m[:n]
        sort.Sort(sort.Reverse(sort.IntSlice(s)))
        //fmt.Println(s)
        cnt := 0
        for i := 0; i < n; i++ {
                v -= m[i]
                cnt++
                if v <= 0 {
                        fmt.Println(cnt)
                        break
                }
        }

}

package main

import "fmt"

import "sort"

func main() {
        var n, v int
        var m [200]int
        fmt.Scanf("%d", &n)
        fmt.Scanf("%d", &v)
        for i := 0; i < n; i++ {
                fmt.Scanf("%d", &m[i])
        }
        var s []int = m[:n]
        sort.Sort(sort.Reverse(sort.IntSlice(s)))
        //fmt.Println(s)
        cnt := 0
        for i := 0; i < n; i++ {
                v -= m[i]
                cnt++
                if v <= 0 {
                        fmt.Println(cnt)
                        break
                }
        }

}

package main

import "fmt"

import "sort"

func main() {
	var n, v int
	var m [200]int
	fmt.Scanf("%d\n%d", &n, &v)
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &m[i])
	}
	var s []int = m[:n]
	sort.Sort(sort.Reverse(sort.IntSlice(s)))
	//	fmt.Println(s)
	cnt := 0
	for i := 0; i < n; i++ {
		v -= m[i]
		cnt++
		if v <= 0 {
			fmt.Println(cnt)
			break
		}
	}

}


package main

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

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

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

func main() {
	defer writer.Flush()

	var n int
	scanf("%d\n", &n)
	for i := 0; i < n; i++ {
		var l int
		var x string
		scanf("%d\n", &l)
		scanf("%s\n", &x)

		index := -1
		for j := 0; j < l; j++ {
			if x[j] == '8' {
				index = j
				break
			}
		}

		if index != -1 && l-index > 10 {
			printf("YES\n")
			continue
		}
		printf("NO\n")
		continue
	}
}

package main

import (
	"fmt"
	"strconv"
)

func main() {
	var t, n int
	var str string
	var can bool
	fmt.Scanln(&str)
	t, _ = strconv.Atoi(str)
	for i := 0; i < t; i++ {
		can = false
		fmt.Scanln(&str)
		n, _ = strconv.Atoi(str)
		fmt.Scanln(&str)
		//fmt.Printf("string was: %s with length: %d", str, n)
		for j := 0; j < n-10; j++ {
			if str[j] == '8' {
				can = true
				break
			}
		}
		if can {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

import (
	"bufio"
	"os"
	"strings"
	"fmt"
)
var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)
func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{}) { fmt.Fscanf(reader, f, a...) }
func readLine()(string,error) 			{ return reader.ReadString('\n') }

func main() {
	defer writer.Flush()
	var n int
	scanf("%d\n", &n)
	for i := 0; i < n; i++ {
		var t int
		var s string
		scanf("%d\n", &t)
		scanf("%s\n", &s)
		j := strings.Index(s,"8")
		if (j != -1 && t - j > 10) {
			printf("YES\n")
		} else {
			printf("NO\n")
		}
	}
}

package main

import (
	"fmt"
	"strings"
)

func main() {
	t := 0
	fmt.Scanf("%d\n", &t)
	for ; t != 0; t-- {
		n := 0
		s := ""
		fmt.Scanf("%d\n%s\n", &n, &s)
		if p := strings.IndexByte(s, '8'); p < 0 || p+11 > len(s) {
			fmt.Printf("NO\n")
		} else {
			fmt.Printf("YES\n")
		}
	}
}

package main

import (
	"fmt"
	"strings"
)

func main() {
	t := 0
	n := 0
	s := ""
	fmt.Scanf("%d\n", &t)
	for true {
		t--

		fmt.Scanf("%d\n%s\n", &n, &s)
		if n < 11 {
			fmt.Printf("NO\n")
		} else if n == 11 {
			if s[0] != '8' {
				fmt.Printf("NO\n")
			} else {
				fmt.Printf("YES\n")
			}
		} else {
			if p := strings.IndexByte(s, '8'); p < 0 || p+11 > len(s) {
				fmt.Printf("NO\n")
			} else {
				fmt.Printf("YES\n")
			}
		}

		if t == 0 {
			break
		}
	}
}

package main

import "fmt"

func answer(s string)(res bool)  {
	var ans int

	for i := range s{
		if(s[i] =='8'){
			break;
		}
		ans ++;
	}
	if(len(s) - ans >= 11){
		res = true
	}else{
		res = false;
	}
	return
}

func main(){
	var n int
	fmt.Scan(&n)
	for ;n >= 1;n--{
	var s string
	fmt.Scan(&s)
	fmt.Scan(&s)
		if(answer(s) == true){
			fmt.Println("YES")
		}else{
			fmt.Println("NO")
		}
	}
}

package main

import "fmt"

func main() {
	n := 0
	var strs []string
	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		n1 := 0
		var s string
		fmt.Scan(&n1)
		fmt.Scan(&s)
		strs = append(strs, s)
	}

	for _, vals := range strs {
		res := "NO"
		nl := len(vals) - 10
		for x := 0; x < nl; x++ {
			c := string([]rune(vals)[x])
			if c == "8" {
				res = "YES"
				break
			}
		}
		fmt.Println(res)
	}

}

// A. Telephone Number
/*
A telephone number is a sequence of exactly 11 digits, where the first digit is 8. For example, the sequence 80011223388 is a telephone number, but the sequences 70011223388 and 80000011223388 are not.

You are given a string 𝑠 of length 𝑛, consisting of digits.

In one operation you can delete any character from string 𝑠. For example, it is possible to obtain strings 112, 111 or 121 from string 1121.

You need to determine whether there is such a sequence of operations (possibly empty), after which the string 𝑠 becomes a telephone number.

Input
The first line contains one integer 𝑡 (1≤𝑡≤100) — the number of test cases.

The first line of each test case contains one integer 𝑛 (1≤𝑛≤100) — the length of string 𝑠.

The second line of each test case contains the string 𝑠 (|𝑠|=𝑛) consisting of digits.

Output
For each test print one line.

If there is a sequence of operations, after which 𝑠 becomes a telephone number, print YES.

Otherwise, print NO.

Example
Input
2
13
7818005553535
11
31415926535

Output
YES
NO

Note
In the first test case you need to delete the first and the third digits. Then the string 7818005553535 becomes 88005553535.
*/
package main

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

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

	for ; t > 0; t-- {
		input2, _ := reader.ReadString('\n')
		n, _ := strconv.Atoi(strings.TrimSpace(input2))

		input3, _ := reader.ReadString('\n')
		s := strings.TrimSpace(input3)

		p := n
		for i := 0; i < n; i++ {
			if s[i] == '8' {
				p = i
				break
			}
		}

		if n-p >= 11 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

import (
	"fmt"
	"strings"
)

func main() {
	var t, n int
	var s string
	fmt.Scan(&t)
	for ; t > 0; t-- {
		fmt.Scan(&n, &s)
		start := strings.Index(s, "8")
		if start < 0 || n-start < 11 {
			fmt.Println("NO")
		} else {
			fmt.Println("YES")
		}
	}

}

package main

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

func solve(j Jam) {
	t := j.Int()
	for i := int64(0); i < t; i++ {
		n, s := j.Int(), j.Str()

		if n >= 11 && strings.IndexRune(s[0:len(s)-10], '8') >= 0{
			fmt.Printf("YES\n")
		} else {
			fmt.Printf("NO\n")
		}
	}
}

func main() {
	jam, closeFunc := JamNew()
	defer closeFunc()
	solve(jam)
}

type Jam interface {
	Scanner() *bufio.Scanner
	Writer() *bufio.Writer
	Close()

	Str() string
	Int() int64
	Float() float64

	P(format string, values ...interface{})
	PF(format string, values ...interface{})
}

func JamNew() (Jam, func()) {
	if len(os.Args) > 1 {
		panic("running with input file path is not supported")
	}

	var scanner = bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 0, 1024*1024), 1024*1024)

	var writer = bufio.NewWriter(os.Stdout)
	jam := &jam{scanner, writer}
	return jam, jam.Close
}

type jam struct {
	sc *bufio.Scanner
	wr *bufio.Writer
}

func (j *jam) Close() {
	if err := j.wr.Flush(); err != nil {
		panic(err)
	}
}

func (j *jam) Scanner() *bufio.Scanner {
	return j.sc
}

func (j *jam) Writer() *bufio.Writer {
	return j.wr
}

func (j *jam) Str() string {
	if !j.sc.Scan() {
		panic("failed to scan next token")
	}

	return j.sc.Text()
}

func (j *jam) Int() int64 {
	if !j.sc.Scan() {
		panic("failed to scan next token")
	}

	res, err := strconv.ParseInt(j.sc.Text(), 10, 64)
	if err != nil {
		panic(err)
	}

	return res
}

func (j *jam) Float() float64 {
	j.sc.Scan()
	res, err := strconv.ParseFloat(j.sc.Text(), 64)
	if err != nil {
		panic(err)
	}
	return res
}

func (j *jam) P(format string, values ...interface{}) {
	_, err := fmt.Fprintf(j.wr, format, values...)
	if err != nil {
		panic(err)
	}
}

func (j *jam) PF(format string, values ...interface{}) {
	_, err := fmt.Fprintf(j.wr, format, values...)
	if err != nil {
		panic(err)
	}
	if err = j.wr.Flush(); err != nil {
		panic(err)
	}
}

package main

import "fmt"

func main() {
	var t int
	fmt.Scan(&t);
	for i:=1; i<=t; i++ {
		var n int
		var s string
		fmt.Scan(&n, &s);
		switch {
		case n>=11:
			for _, char := range s {
				if (char=='8' && n>=11) {
					fmt.Println("YES")
					break;
				}
				n--;
				if (n<11) {
					fmt.Println("NO");
					break;
				}
			}
		case n<=11:
			fmt.Println("NO")
		}
	}
}

package main

	import "fmt"
	import "strconv"
	import "os"
	import "bufio"
	import "strings"

func CheckPhone(len int, phone string) bool {
	for i,val := range(phone) {
		if int(val) -48 == 8 {
			if len - i >= 11{
				fmt.Println("YES")
				return true
			}
		}
	}
	fmt.Println("NO")
	return false
}

func main() {
	var testcase int
	reader := bufio.NewReader(os.Stdin)
	text, _ := reader.ReadString('\n')
	text =  strings.TrimRight(text,"\r\n")
	testcase,_ = strconv.Atoi(text)
	numbers := []string{}
	lens := []int{}
	for i:=0 ;i <testcase;i++ {
		text, _ := reader.ReadString('\n')
		text =  strings.TrimRight(text,"\r\n")
		lenz,_ := strconv.Atoi(text)
		lens = append(lens,lenz)
		text, _ = reader.ReadString('\n')
		text =  strings.TrimRight(text,"\r\n")
		numbers = append(numbers,text)
	}
	for i,_ := range(lens) {
		CheckPhone(lens[i],numbers[i])
	}
}

package main

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

func main() {
    input := bufio.NewScanner(os.Stdin)
    input.Split(bufio.ScanWords)

    input.Scan()
    t, _ := strconv.Atoi(input.Text())

    for kase := 0; kase < t; kase++ {
        input.Scan()
        n, _ := strconv.Atoi(input.Text())

        input.Scan()
        s := input.Text()

        ok := false
        for i, ch := range s {
            if ch == '8' && n - i >= 11 {
                ok = true
                break
            }
        }

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

        package main

        import "fmt"

        func isTelephoneNumber(length int, number string) bool {
        	if length < 11 {
        		return false
        	}
        	for index, value := range number {
        		if value == '8' && length-index >= 11 {
        			return true
        		}

        	}
        	return false
        }
        func main() {
        	var countCheck int
        	var length int
        	var number string
        	fmt.Scan(&countCheck)
        	for i := 0; i < countCheck; i++ {
        		fmt.Scan(&length)
        		fmt.Scan(&number)
        		if isTelephoneNumber(length, number) {
        			fmt.Println("YES")
        		} else {
        		    fmt.Println("NO")
        		}
        	}
        }

package main

import (
	"fmt"
)

func isTelephoneNumber(len int ,number string) bool  {
	if len <11 {
		return false
	}
	for index, value := range number{
		if value == '8'{
			if len - index >=11{
				return true
			}
		}
	}
	return false
}
func main()  {
	var num_of_check int
	var len int
	var number string
	fmt.Scan(&num_of_check)
	for i := 0 ; i< num_of_check; i++ {
		fmt.Scan(&len)
		fmt.Scan(&number)
		if isTelephoneNumber(len, number){
			fmt.Println("YES")
		}else {
			fmt.Println("NO")
		}
	}

}

package main

import (
	"fmt"
)

func isTelephoneNumber(len int, number string) bool {
	if len < 11 {
		return false
	}
	for index, value := range number {
		if value == '8' && len-index >= 11 {
			return true
		}

	}
	return false
}
func main() {
	var num_of_check int
	var len int
	var number string
	fmt.Scan(&num_of_check)
	for i := 0; i < num_of_check; i++ {
		fmt.Scan(&len)
		fmt.Scan(&number)
		if isTelephoneNumber(len, number) {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}

}

package main

import "fmt"

func main() {
	var t, n int
	fmt.Scanf("%d\n", &t)
	for i := 0; i < t; i++ {
		fmt.Scanf("%d\n", &n)
		var tel string
		fmt.Scanf("%s\n", &tel)

		flag := false
		for j := 0; j < n-10; j++ {
			if tel[j] == '8' && n-j >= 11 {
				flag = true
				break
			}
		}

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

package main

import (
	"fmt"
	"strings"
)

type Number struct {
	Len int
	Num string
}

func main() {
	var caseNum int
	fmt.Scan(&caseNum)
	numbers := make([]Number, caseNum)
	for i := 0; i < caseNum; i++ {
		fmt.Scan(&numbers[i].Len)
		fmt.Scan(&numbers[i].Num)
	}
	for _, number := range numbers {
		if !(strings.Contains(number.Num, "8")) {
			fmt.Println("NO")
			continue
		}
		if number.Len-strings.Index(number.Num, "8") >= 11 {
			fmt.Println("YES")
			continue
		}
		fmt.Println("NO")
	}
}

package main

import (
	"fmt"
	"log"
	"strings"
)

type Number struct {
	Len int
	Num string
}

func main() {
	var caseNum int
	_, err := fmt.Scanf("%d\n", &caseNum)
	if err != nil {
		log.Fatal(err)
	}
	numbers := make([]Number, caseNum)
	for i := 0; i < caseNum; i += 1 {
		var slen int
		var snum string
		_, err = fmt.Scanf("%d\n", &slen)
		if err != nil {
			log.Fatal(err)
		}
		_, err = fmt.Scanf("%s\n", &snum)
		if err != nil {
			log.Fatal(err)
		}
		numbers[i] = Number{slen, snum}
	}
	for _, element := range numbers {
		if (strings.Contains(element.Num, "8")) {
			if element.Len-strings.Index(element.Num, "8") >= 11 {
				fmt.Println("YES")
			} else {
				fmt.Println("NO")
			}
		} else {
			fmt.Println("NO")
		}
	}
}

package main

import (
	"fmt"
	"strings"
)

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

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

func main(){
	var t int
	fmt.Scanln(&t)
	for i := 0;i < t ;i++  {
		var n int
		var s string
		fmt.Scanln(&n)
		fmt.Scanln(&s)
		c := strings.IndexAny(s, "8")
		if c < 0 || n -c <11{
			fmt.Println("NO")
		} else{
			fmt.Println("YES")
		}
	}
}

package main

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

const YES = "YES"
const NO = "NO"

func main() {
	reader := getReader()
	reader.Scan()
	for reader.Scan() {
		cnt, _ := strconv.ParseInt(reader.Text(), 0, 64)
		reader.Scan()
		str := reader.Text()
		if cnt < 11 {
			fmt.Println(NO)
		} else if isPhone(str) {
			fmt.Println(YES)
		} else {
			fmt.Println(NO)
		}
	}
}

func isPhone(str string) bool {
	ind := strings.Index(str, "8")
	if ind < 0 {
		return false
	}
	length := len(str)

	return (length - ind) > 10
}

func getReader() *bufio.Scanner {
	if isOnline() {
		return bufio.NewScanner(os.Stdin)
	}
	file, _ := os.Open("data.txt")
	return bufio.NewScanner(file)
}

func isOnline() bool {
	env := os.Getenv("ONLINE_JUDGE")
	return env != "false"
}

package main

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

const YES = "YES"

const NO = "NO"

func main() {
	reader := getReader()
	reader.Scan()
	for reader.Scan() {
		cnt, _ := strconv.ParseInt(reader.Text(), 0, 64)
		reader.Scan()
		str := reader.Text()
		if cnt < 11 {
			fmt.Println(NO)
		} else if isPhone(str) {
			fmt.Println(YES)
		} else {
			fmt.Println(NO)
		}
	}
}

func isPhone(str string) bool {
	ind := strings.Index(str, "8")
	if ind < 0 {
		return false
	}
	length := len(str)

	return (length - ind) > 10
}

func getReader() *bufio.Scanner {
	if isOnline() {
		return bufio.NewScanner(os.Stdin)
	}
	file, _ := os.Open("data.txt")
	return bufio.NewScanner(file)
}

func isOnline() bool {
	_, b := os.LookupEnv("LAVRUHIN_HOME")
	return !b
}

package main

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

const YES = "YES"

const NO = "NO"

func main() {
	reader := getReader()
	reader.Scan()
	for reader.Scan() {
		cnt, _ := strconv.ParseInt(reader.Text(), 0, 64)
		reader.Scan()
		str := reader.Text()
		if cnt < 11 {
			fmt.Println(NO)
		} else if isPhone(str) {
			fmt.Println(YES)
		} else {
			fmt.Println(NO)
		}
	}
}

func isPhone(str string) bool {
	ind := strings.Index(str, "8")
	if ind < 0 {
		return false
	}
	length := len(str)

	return (length - ind) > 10
}

func getReader() *bufio.Scanner {
	if isOnline() {
		return bufio.NewScanner(os.Stdin)
	}
	file, _ := os.Open("data.txt")
	return bufio.NewScanner(file)
}

func isOnline() bool {
	//env := os.Getenv("ONLINE_JUDGE")
	return true
}

package main

import "fmt"

func check(length int, data string) {
	pos := -1

	for i := range data {
		if data[i] == '8' {
			pos = i
			break
		}
	}

	if pos >= 0 && length-pos > 10 {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}

func main() {

	var numOfTests, length int
	var data string

	fmt.Scan(&numOfTests)

	for i := 0; i < numOfTests; i++ {
		fmt.Scan(&length)
		fmt.Scan(&data)
		check(length, data)
	}
}

package main

import (
	"fmt"
	"strings"
)

func main() {
	var t, n int
	var s string
	fmt.Scan(&t)
	for ; t > 0; t-- {
		fmt.Scan(&n, &s)
		start := strings.Index(s, "7")
		if start < 0 || n-start < 11 {
			fmt.Println("NO")
		} else {
			fmt.Println("YES")
		}
	}

}

package main

	import "fmt"
	import "strconv"
	import "os"
	import "bufio"
	import "strings"

func CheckPhone(len int, phone string) bool {
	for i,val := range(phone) {
		if int(val) -48 == 8 {
			if len - i -1 > 11{
				fmt.Println("YES")
				return true
			}
		}
	}
	fmt.Println("NO")
	return false
}

func main() {
	var testcase int
	reader := bufio.NewReader(os.Stdin)
	text, _ := reader.ReadString('\n')
	text =  strings.TrimRight(text,"\r\n")
	testcase,_ = strconv.Atoi(text)
	numbers := []string{}
	lens := []int{}
	for i:=0 ;i <testcase;i++ {
		text, _ := reader.ReadString('\n')
		text =  strings.TrimRight(text,"\r\n")
		lenz,_ := strconv.Atoi(text)
		lens = append(lens,lenz)
		text, _ = reader.ReadString('\n')
		text =  strings.TrimRight(text,"\r\n")
		numbers = append(numbers,text)
	}
	for i,_ := range(lens) {
		CheckPhone(lens[i],numbers[i])
	}
}

package main

	import "fmt"
	import "strconv"
	import "os"
	import "bufio"
	import "strings"

func CheckPhone(len int, phone string) bool {
	for i,val := range(phone) {
		if int(val) == 8 {
			if len - i -1 > 11{
				fmt.Println("YES")
				return true
			}
		}
	}
	fmt.Println("NO")
	return false
}

func main() {
	var testcase int
	reader := bufio.NewReader(os.Stdin)
	text, _ := reader.ReadString('\n')
	text =  strings.TrimRight(text,"\r\n")
	testcase,_ = strconv.Atoi(text)
	numbers := []string{}
	lens := []int{}
	for i:=0 ;i <testcase;i++ {
		text, _ := reader.ReadString('\n')
		text =  strings.TrimRight(text,"\r\n")
		lenz,_ := strconv.Atoi(text)
		lens = append(lens,lenz)
		text, _ = reader.ReadString('\n')
		text =  strings.TrimRight(text,"\r\n")
		numbers = append(numbers,text)
	}
	for i,_ := range(lens) {
		CheckPhone(lens[i],numbers[i])
	}
}

package main

	import "fmt"
	import "strconv"
	import "os"
	import "bufio"
	import "strings"

func CheckPhone(len int, phone string) bool {
	for i,val := range(phone) {
		if int(val) -48 == 8 {
			if len - i -1 >= 11{
				fmt.Println("YES")
				return true
			}
		}
	}
	fmt.Println("NO")
	return false
}

func main() {
	var testcase int
	reader := bufio.NewReader(os.Stdin)
	text, _ := reader.ReadString('\n')
	text =  strings.TrimRight(text,"\r\n")
	testcase,_ = strconv.Atoi(text)
	numbers := []string{}
	lens := []int{}
	for i:=0 ;i <testcase;i++ {
		text, _ := reader.ReadString('\n')
		text =  strings.TrimRight(text,"\r\n")
		lenz,_ := strconv.Atoi(text)
		lens = append(lens,lenz)
		text, _ = reader.ReadString('\n')
		text =  strings.TrimRight(text,"\r\n")
		numbers = append(numbers,text)
	}
	for i,_ := range(lens) {
		CheckPhone(lens[i],numbers[i])
	}
}

package main

import (
	"fmt"
	"math"
)

func isTelephoneNumber(len,number int) bool  {
	if len <11 {
		return false
	}
	for i:= 0; i<len; i++{
		term := math.Mod(float64(number),10)
		number /= 10
		if int(term)==8{
			if i+1 >=11 {
				return true
			}
		}
	}
	return false
}
func main()  {
	var num_of_check int
	fmt.Scan(&num_of_check)
	listLenNumber := make([][]int, num_of_check)
	for i := range listLenNumber {
		listLenNumber[i] = make([]int, num_of_check)
	}
	for i:=0; i<num_of_check; i++{
		fmt.Scan(&listLenNumber[i][0])
		fmt.Scan(&listLenNumber[i][1])
		}

	for i:=0; i<num_of_check; i++{
		if isTelephoneNumber(listLenNumber[i][0],listLenNumber[i][1]){
			fmt.Println("YES")
		}else {
			fmt.Println("NO")
		}
}

}

package main

import (
	"fmt"
	"math"
)

func isTelephoneNumber(len,number int) bool  {
	if len <11 {
		return false
	}
	for i:= 0; i<len; i++{
		term := math.Mod(float64(number),10)
		number = number/10
		if int(term)==8{
			if i+1 >=11 {
				return true
			}
		}
	}
	return false
}
func main()  {
	var num_of_check int
	fmt.Scan(&num_of_check)
	listLenNumber := make([][]int, num_of_check)
	for i := range listLenNumber {
		listLenNumber[i] = make([]int, num_of_check)
	}
	for i:=0; i<num_of_check; i++{
		fmt.Scan(&listLenNumber[i][0])
		fmt.Scan(&listLenNumber[i][1])
		}

	for i:=0; i<num_of_check; i++{
		if isTelephoneNumber(listLenNumber[i][0],listLenNumber[i][1]){
			fmt.Println("YES")
		}else {
			fmt.Println("NO")
		}
}

}

package main

import (
	"fmt"
	"math"
)

func isTelephoneNumber(len,number int) bool  {
	if len <11 {
		return false
	}
	for i:= 0; i<len; i++{
		term := math.Mod(float64(number),10)
		number = number/10
		if int(term)==8{
			if i+1 >=11 {
				return true
			}else {
				return false
			}
		}
	}
	return false
}
func main()  {
	var num_of_check int
	fmt.Scan(&num_of_check)
	listLenNumber := make([][]int, num_of_check)
	for i := range listLenNumber {
		listLenNumber[i] = make([]int, num_of_check)
	}
	for i:=0; i<num_of_check; i++{
		fmt.Scan(&listLenNumber[i][0])
		fmt.Scan(&listLenNumber[i][1])
		}

	for i:=0; i<num_of_check; i++{
		if isTelephoneNumber(listLenNumber[i][0],listLenNumber[i][1]){
			fmt.Println("YES")
		}else {
			fmt.Println("NO")
		}
}

}

package main

import (
	"fmt"
	"math"
)

func isTelephoneNumber(len,number int) bool  {
	if len <11 {
		return false
	}
	for i:= 0; i<len; i++{
		term := math.Mod(float64(number),10)
		number /= 10
		if int(term)==8{
			if i+1 >=11 {
				return true
			}
		}
	}
	return false
}
func main()  {
	var num_of_check int
	fmt.Scan(&num_of_check)
	listLenNumber := make([][]int, num_of_check)
	for i := range listLenNumber {
		listLenNumber[i] = make([]int, num_of_check)
	}
	for i:=0; i<num_of_check; i++{
		fmt.Scan(&listLenNumber[i][0])
		fmt.Scan(&listLenNumber[i][1])
		}

	for i:=0; i<num_of_check; i++{
		if isTelephoneNumber(listLenNumber[i][0],listLenNumber[i][1]){
			fmt.Println("YESsssss")
		}else {
			fmt.Println("NOooooooo")
		}
}

}

package main

import (
	"fmt"
	"strings"
)

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

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

func main(){
	var t int
	fmt.Scanln(&t)
	for i := 0;i < t ;i++  {
		var n int
		var s string
		fmt.Scanln(&n)
		fmt.Scanln(&s)
		c := strings.IndexAny(s, "8")
		if c <= 0 || len(s) -c <12{
			fmt.Println("NO")
		} else{
			fmt.Println("YES")
		}
	}
}

package main

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

const YES = "YES"

const NO = "NO"

func main() {
	reader := getReader()
	reader.Scan()
	for reader.Scan() {
		cnt, _ := strconv.ParseInt(reader.Text(), 0, 64)
		reader.Scan()
		str := reader.Text()
		if cnt < 11 {
			fmt.Println(NO)
		}
		if isPhone(str) {
			fmt.Println(YES)
		} else {
			fmt.Println(NO)
		}
	}
}

func isPhone(str string) bool {
	ind := strings.Index(str, "8")
	if ind < 0 {
		return false
	}
	length := len(str)

	return (length - ind) > 10
}

func getReader() *bufio.Scanner {
	if isOnline() {
		return bufio.NewScanner(os.Stdin)
	}
	file, _ := os.Open("data.txt")
	return bufio.NewScanner(file)
}

func isOnline() bool {
	env := os.Getenv("ONLINE_JUDGE")
	return env != ""
}

package main

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

const YES = "YES"
const NO = "NO"

func main() {
	reader := getReader()
	reader.Scan()
	for reader.Scan() {
		cnt, _ := strconv.ParseInt(reader.Text(), 0, 64)
		reader.Scan()
		str := reader.Text()
		if cnt < 11 {
			fmt.Println(NO)
		} else if isPhone(str) {
			fmt.Println(YES)
		} else {
			fmt.Println(NO)
		}
	}
}

func isPhone(str string) bool {
	ind := strings.Index(str, "8")
	if ind < 0 {
		return false
	}
	length := len(str)

	return (length - ind) > 10
}

func getReader() *bufio.Scanner {
	if isOnline() {
		return bufio.NewScanner(os.Stdin)
	}
	file, _ := os.Open("data.txt")
	return bufio.NewScanner(file)
}

func isOnline() bool {
	env := os.Getenv("ONLINE_JUDGE")
	return env == "true"
}

package main

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

const YES = "YES"

const NO = "NO"

func main() {
	reader := getReader()
	reader.Scan()
	for reader.Scan() {
		cnt, _ := strconv.ParseInt(reader.Text(), 0, 64)
		reader.Scan()
		str := reader.Text()
		if cnt < 11 {
			fmt.Println(NO)
		} else if isPhone(str) {
			fmt.Println(YES)
		} else {
			fmt.Println(NO)
		}
	}
}

func isPhone(str string) bool {
	ind := strings.Index(str, "8")
	if ind < 0 {
		return false
	}
	length := len(str)

	return (length - ind) > 10
}

func getReader() *bufio.Scanner {
	if isOnline() {
		return bufio.NewScanner(os.Stdin)
	}
	file, _ := os.Open("data.txt")
	return bufio.NewScanner(file)
}

func isOnline() bool {
	_, b := os.LookupEnv("ONLINE_JUDGE")
	return b
}

package main

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

const YES = "YES"

const NO = "NO"

func main() {
	reader := getReader()
	reader.Scan()
	for reader.Scan() {
		cnt, _ := strconv.ParseInt(reader.Text(), 0, 64)
		reader.Scan()
		str := reader.Text()
		if cnt < 11 {
			fmt.Println(NO)
		} else if isPhone(str) {
			fmt.Println(YES)
		} else {
			fmt.Println(NO)
		}
	}
}

func isPhone(str string) bool {
	ind := strings.Index(str, "8")
	if ind < 0 {
		return false
	}
	length := len(str)

	return (length - ind) > 10
}

func getReader() *bufio.Scanner {
	if isOnline() {
		return bufio.NewScanner(os.Stdin)
	}
	file, _ := os.Open("data.txt")
	return bufio.NewScanner(file)
}

func isOnline() bool {
	env := os.Getenv("ONLINE_JUDGE")
	return env != ""
}

package main

import "fmt"

func check(length int, data string) {
	pos := -1

	for i := range data {
		if data[i] == '8' {
			pos = i
			break
		}
	}

	if pos > 0 && (pos >= 10 || length-pos >= 10) {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}

func main() {

	var numOfTests, length int
	var data string

	fmt.Scan(&numOfTests)

	for i := 0; i < numOfTests; i++ {
		fmt.Scan(&length)
		fmt.Scan(&data)
		check(length, data)
	}
}

package main

import "fmt"

func check(length int, data string) {
	pos := -1

	for i := range data {
		if data[i] == '8' {
			pos = i
			break
		}
	}

	if pos >= 0 && length-pos >= 10 {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}

func main() {

	var numOfTests, length int
	var data string

	fmt.Scan(&numOfTests)

	for i := 0; i < numOfTests; i++ {
		fmt.Scan(&length)
		fmt.Scan(&data)
		check(length, data)
	}
}

package main

import "fmt"

func check(length int, data string) {
	pos := -1

	for i := range data {
		if data[i] == '8' {
			pos = i
			break
		}
	}

	if pos >= 0 && (pos >= 10 || length-pos >= 10) {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}

func main() {

	var numOfTests, length int
	var data string

	fmt.Scan(&numOfTests)

	for i := 0; i < numOfTests; i++ {
		fmt.Scan(&length)
		fmt.Scan(&data)
		check(length, data)
	}
}

package main

import (
	"fmt"
)

func main() {
	var t, n int
	var str string
	var can bool
	fmt.Scanf("%d", &t)
	for i := 0; i < t; i++ {
		can = false
		fmt.Scanf("%d", &n)
		fmt.Scanln(&str)
		for j := 0; j < len(str)-10; j++ {
			if str[j] == '8' {
				can = true
				break
			}
		}
		if can {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

import (
	"fmt"
	"strconv"
)

func main() {
	var t, n int
	var str string
	var can bool
	fmt.Scanln(&str)
	t, _ = strconv.Atoi(str)
	for i := 0; i < t; i++ {
		can = false
		fmt.Scanln(&str)
		n, _ = strconv.Atoi(str)
		fmt.Scanln(&str)
		fmt.Printf("string was: %s with length: %d", str, n)
		for j := 0; j < n-10; j++ {
			if str[j] == '8' {
				can = true
				break
			}
		}
		if can {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

import (
	"fmt"
	"strings"
)

func main() {
	t := 0
	n := 0
	s := ""
	fmt.Scanf("%d\n", &t)
	for true {
		t--

		fmt.Scanf("%d\n%s\n", &n, &s)
		if n < 11 {
			fmt.Printf("NO\n")
		} else if n == 11 {
			if s[0] != '8' {
				fmt.Printf("NO\n")
			} else {
				fmt.Printf("YES\n")
			}
		} else {
			if p := strings.IndexByte(s, '8'); p < 0 || p+7 > len(s) {
				fmt.Printf("NO\n")
			} else {
				fmt.Printf("YES\n")
			}
		}

		if t == 0 {
			break
		}
	}
}

package main

import (
	"fmt"
	"strings"
)

func main() {
	t := 0
	fmt.Scan(&t)
	for ; t != 0; t-- {
		n := 0
		s := ""
		fmt.Scanf("%d\n%s\n", &n, &s)
		if p := strings.IndexByte(s, '8'); p < 0 || p+11 > len(s) {
			fmt.Printf("NO\n")
		} else {
			fmt.Printf("YES\n")
		}
	}
}

package main

import (
	"fmt"
	"strings"
)

func main() {
	t := 0
	fmt.Scan("%d\n", &t)
	for ; t != 0; t-- {
		n := 0
		s := ""
		fmt.Scanf("%d\n%s\n", &n, &s)
		if p := strings.IndexByte(s, '8'); p < 0 || p+11 > len(s) {
			fmt.Printf("NO\n")
		} else {
			fmt.Printf("YES\n")
		}
	}
}

package main

import (
	"fmt"
	"strings"
)

func main() {
	t := 0
	n := 0
	s := ""
	fmt.Scanf("%d\n", &t)
	for true {
		t--

		fmt.Scanf("%d\n%s\n", &n, &s)
		if n < 11 {
			fmt.Printf("NO\n")
		} else if n == 11 {
			if s[0] != '8' {
				fmt.Printf("NO\n")
			} else {
				fmt.Printf("YES\n")
			}
		} else {
			if p := strings.IndexByte(s, '8'); p < 0 || p+10 > len(s) {
				fmt.Printf("NO\n")
			} else {
				fmt.Printf("YES\n")
			}
		}

		if t == 0 {
			break
		}
	}
}


// Codeforces 659 D cheating solution
package main

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

func main() {
	// reading n
    var n int
	in := bufio.NewReader(os.Stdin)
	s, err := in.ReadString('\n')
	if err != nil {
		fmt.Println("first read failure", err)
		return
	}
	ss := strings.Split(strings.Trim(s, " \n\r"), " ")
	n, err = strconv.Atoi(ss[0])
	if err != nil {
		fmt.Println("n atoi failure", err)
		return
	}
    // skipping lines with coordinates
    for i:=0; i<n+1; i++ {
        s, err = in.ReadString('\n')
        if err != nil {
            fmt.Println("read failure", err)
            return
        }
    }

    // result
    nd := (n-4) / 2
    fmt.Println(nd)
}

package main

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

var N int

type Pair struct {
	x int
	y int
}

func main() {
	fsc := NewFastScanner()
	N = fsc.NextInt()

	points := make([]Pair, 0)
	var ty, tx int
	ty = -1000000
	tx = -1000000
	for i := 0; i < N+1; i++ {
		var x, y int
		x, y = fsc.NextInt(), fsc.NextInt()
		points = append(points, Pair{x: x, y: y})
		if ty < y {
			ty = y
		}
		if tx < x {
			tx = x
		}
	}
	var sy, sx int
	sx = points[0].x
	sy = points[0].y

	var py, px int
	px = sx
	py = sy
	ans := 0
	dir := 0
	for i := 1; i < N+1; i++ {
		var ny, nx int
		ny = points[i].y
		nx = points[i].x

		if py < ny { //north
			if dir == 1 {
				ans++
			}
			dir = 0
		} else if py > ny { //south
			if dir == 3 {
				ans++
			}
			dir = 2
		} else if px < nx { //east
			if dir == 2 {
				ans++
			}
			dir = 1
		} else if px > nx { //west
			if dir == 0 {
				ans++
			}
			dir = 3
		}

		py = ny
		px = nx
	}
	fmt.Println(ans)
}

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

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

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

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

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


package main

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

/*type IntArray []int

func (p IntArray) Len() int           { return len(p) }
func (p IntArray) Less(i, j int) bool { return p[i] < p[j] }
func (p IntArray) Swap(i, j int)      { p[i], p[j] = p[j], p[i] }*/

const SIZE = 111

var res [SIZE]int

func main() {
	var t int
	r := bufio.NewReader(os.Stdin)
	Fscan(r, &t)
	for te := 0; te < t; te++ {
		var s, n int
		Fscan(r, &s)
		Fscan(r, &n)
		for i := 0; i < n; i++ {
			res[i] = 1
		}
		s -= n
		for i := 0; i < n; i++ {
			for j := 9; s >= j; j *= 10 {
				res[i] += j
				s -= j
			}
		}
		for i := 0; i < n; i++ {
			Printf("%d ", res[i]+s)
			s = 0
		}
		Println()
	}
}

package main

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

// github.com/EndlessCheng/codeforces-go
func CF1567D(in io.Reader, _w io.Writer) {
	out := bufio.NewWriter(_w)
	defer out.Flush()
	var T, s, n int
	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &s, &n)
		x := int(math.Pow10(len(strconv.Itoa(s)) - 1))
		for i := 1; i < n; i++ {
			for s-x < n-i {
				x /= 10
			}
			Fprint(out, x, " ")
			s -= x
		}
		Fprintln(out, s)
	}
}

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

package main

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

/*type IntArray []int

func (p IntArray) Len() int           { return len(p) }
func (p IntArray) Less(i, j int) bool { return p[i] < p[j] }
func (p IntArray) Swap(i, j int)      { p[i], p[j] = p[j], p[i] }*/

const SIZE = 111

var res [SIZE]int

func main() {
	var t int
	r := bufio.NewReader(os.Stdin)
	Fscan(r, &t)
	for te := 0; te < t; te++ {
		var s, n int
		Fscan(r, &s)
		Fscan(r, &n)
		for i := 0; i < n; i++ {
			res[i] = 1
		}
		s -= n
		for i := 0; i < n; i++ {
			for j := 9; s > j; j *= 10 {
				res[i] += j
				s -= j
			}
		}
		for i := 0; i < n; i++ {
			Printf("%d ", res[i]+s)
			s = 0
		}
		Println()
	}
}