package main

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

var s string

var dp [2005][2005]int

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in, &t)
	for cs := 0; cs < t; cs++ {
		fmt.Fscan(in, &s)
		n := len(s)
		for i := 1; i < n; i++ {
			if s[i] == s[i-1] {
				dp[i-1][i] = 0
			} else {
				dp[i-1][i] = 1
			}
		}
		for d := 2; d < n; d++ {
			for l := 0; l+d < n; l++ {
				r := l + d
				if d%2 == 0 {
					dp[l][r] = 0
					if dp[l+1][r] == -1 || dp[l][r-1] == -1 {
						dp[l][r] = 0x3f3f3f3f
					}
					if dp[l+1][r] == 0 && dp[l][r] < int('z')+1-int(s[l]) {
						dp[l][r] = int('z') + 1 - int(s[l])
					}
					if dp[l][r-1] == 0 && dp[l][r] < int('z')+1-int(s[r]) {
						dp[l][r] = int('z') + 1 - int(s[r])
					}
				} else {
					dp[l][r] = -1
					tmp := int('z') + 1 - int(s[l])
					if tmp > dp[l+1][r] {
						dp[l][r] = 1
					}
					if tmp == dp[l+1][r] {
						dp[l][r] = 0
					}
					tmp = int('z') + 1 - int(s[r])
					if tmp > dp[l][r-1] {
						dp[l][r] = 1
					}
					if tmp == dp[l][r-1] && dp[l][r] == -1 {
						dp[l][r] = 0
					}
				}
			}
		}
		if dp[0][n-1] == -1 {
			fmt.Fprintln(out, "Bob")
		} else if dp[0][n-1] == 0 {
			fmt.Fprintln(out, "Draw")
		} else if dp[0][n-1] == 1 {
			fmt.Fprintln(out, "Alice")
		}
	}
}

package main

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

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

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

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

func (in *R) NextInt64() int64 {
	in.load()
	val, _ := strconv.ParseInt(strings.TrimSpace(in.split[in.index]), 10, 64)
	in.index++
	return val
}
func NewR(r *bufio.Reader) *R {
	return &R{
		sc:        r,
		split:     []string{},
		index:     0,
		separator: " ",
	}
}
func (in *R) NextString() string {
	in.load()
	val := strings.TrimSpace(in.split[in.index])
	in.index++
	return val
}

func main() {
	CF1728D()
}
func CF1728D() {
	r := NewR(bufio.NewReader(os.Stdin))
	t := r.NextInt()
	for t > 0 {
		t--
		s := r.NextString()
		i, j := 0, len(s)-1
		res := "Draw"
		for i < j {
			if s[i] != s[j] {
				res = "Alice"
				break
			}
			i++
			j--
		}
		if res == "Alice" {
			for ; i < j; i += 2 {
				if s[i] != s[i+1] {
					break
				}
			}
			if i > j {
				res = "Draw"
			}
		}
		fmt.Println(res)
	}
}
func CF1728C() {
	r := NewR(bufio.NewReader(os.Stdin))
	f := func(x int) int {
		if x > 99999999 {
			return 9
		} else if x > 9999999 {
			return 8
		} else if x > 999999 {
			return 7
		} else if x > 99999 {
			return 6
		} else if x > 9999 {
			return 5
		} else if x > 999 {
			return 4
		} else if x > 99 {
			return 3
		} else if x > 9 {
			return 2
		} else {
			return x
		}
	}
	t := r.NextInt()
	for t > 0 {
		t--
		n := r.NextInt()
		am := make(map[int]int, n)
		bm := make(map[int]int, n)
		for i := 0; i < n; i++ {
			tmp := r.NextInt()
			am[tmp]++
		}
		for i := 0; i < n; i++ {
			tmp := r.NextInt()
			if v, ok := am[tmp]; ok {
				if v > 0 {
					am[tmp]--
					if am[tmp] == 0 {
						delete(am, tmp)
					}
					continue
				}
			}
			bm[tmp]++
		}
		res := 0
		for k, v := range am {
			if k > 9 {
				delete(am, k)
				res += v
				k = f(k)
				am[k] += v
			}
			if vb, ok := bm[k]; ok {
				if v < vb {
					delete(am, k)
					bm[k] -= v
				} else if v > vb {
					delete(bm, k)
					am[k] -= vb
				} else {
					delete(am, k)
					delete(bm, k)
				}
			}
		}

		for k, v := range bm {
			if k > 9 {
				delete(bm, k)
				res += v
				k = f(k)
				bm[k] += v
			}
			if va, ok := am[k]; ok {
				if v < va {
					delete(bm, k)
					am[k] -= v
				} else if v > va {
					delete(am, k)
					bm[k] -= va
				} else {
					delete(am, k)
					delete(bm, k)
				}
			}
		}

		for k, v := range am {
			if k > 1 {
				res += v
			}
		}
		for k, v := range bm {
			if k > 1 {
				res += v
			}
		}
		fmt.Println(res)
	}
}
func CF1728B() {
	var t int
	fmt.Scan(&t)
	for i := 0; i < t; i++ {
		var n int
		fmt.Scan(&n)
		for j := 1; j <= n; j++ {
			if n&1 == 0 {
				if j < n-1 {
					if j&1 == 0 {
						fmt.Print(j - 1)
					} else {
						fmt.Print(j + 1)
					}
				} else {
					fmt.Print(j)
				}
			} else {
				if j == 1 || j >= n-1 {
					fmt.Print(j)
				} else {
					if j&1 == 0 {
						fmt.Print(j + 1)
					} else {
						fmt.Print(j - 1)
					}
				}
			}
			if j == n {
				fmt.Println("")
			} else {
				fmt.Print(" ")
			}
		}
	}
}
func CF1728A() {
	var t int
	fmt.Scan(&t)
	for t != 0 {
		t--
		var n int
		fmt.Scan(&n)
		var m int
		var mi int
		var i int = 1
		for n != 0 {
			n--
			var ai int
			fmt.Scan(&ai)
			if ai > m {
				m = ai
				mi = i
			}
			i++
		}
		fmt.Println(mi)
	}
}

package main

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

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

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

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

func (in *R) NextInt64() int64 {
	in.load()
	val, _ := strconv.ParseInt(strings.TrimSpace(in.split[in.index]), 10, 64)
	in.index++
	return val
}
func NewR(r *bufio.Reader) *R {
	return &R{
		sc:        r,
		split:     []string{},
		index:     0,
		separator: " ",
	}
}
func (in *R) NextString() string {
	in.load()
	val := strings.TrimSpace(in.split[in.index])
	in.index++
	return val
}

func main() {
	CF1728D()
}
func CF1728D() {
	r := NewR(bufio.NewReader(os.Stdin))
	t := r.NextInt()
	for t > 0 {
		t--
		s := r.NextString()
		i, j := 0, len(s)-1
		res := "Draw"
		for i < j {
			if s[i] != s[j] {
				res = "Alice"
				break
			}
			i++
			j--
		}
		if res == "Alice" {
			draw := true
			for i := 0; i < len(s); i += 2 {
				if s[i] != s[i+1] {
					res = "Alice"
					draw = false
					break
				}
			}
			if draw {
				res = "Draw"
			}
		}
		fmt.Println(res)
	}
}
func CF1728C() {
	r := NewR(bufio.NewReader(os.Stdin))
	f := func(x int) int {
		if x > 99999999 {
			return 9
		} else if x > 9999999 {
			return 8
		} else if x > 999999 {
			return 7
		} else if x > 99999 {
			return 6
		} else if x > 9999 {
			return 5
		} else if x > 999 {
			return 4
		} else if x > 99 {
			return 3
		} else if x > 9 {
			return 2
		} else {
			return x
		}
	}
	t := r.NextInt()
	for t > 0 {
		t--
		n := r.NextInt()
		am := make(map[int]int, n)
		bm := make(map[int]int, n)
		for i := 0; i < n; i++ {
			tmp := r.NextInt()
			am[tmp]++
		}
		for i := 0; i < n; i++ {
			tmp := r.NextInt()
			if v, ok := am[tmp]; ok {
				if v > 0 {
					am[tmp]--
					if am[tmp] == 0 {
						delete(am, tmp)
					}
					continue
				}
			}
			bm[tmp]++
		}
		res := 0
		for k, v := range am {
			if k > 9 {
				delete(am, k)
				res += v
				k = f(k)
				am[k] += v
			}
			if vb, ok := bm[k]; ok {
				if v < vb {
					delete(am, k)
					bm[k] -= v
				} else if v > vb {
					delete(bm, k)
					am[k] -= vb
				} else {
					delete(am, k)
					delete(bm, k)
				}
			}
		}

		for k, v := range bm {
			if k > 9 {
				delete(bm, k)
				res += v
				k = f(k)
				bm[k] += v
			}
			if va, ok := am[k]; ok {
				if v < va {
					delete(bm, k)
					am[k] -= v
				} else if v > va {
					delete(am, k)
					bm[k] -= va
				} else {
					delete(am, k)
					delete(bm, k)
				}
			}
		}

		for k, v := range am {
			if k > 1 {
				res += v
			}
		}
		for k, v := range bm {
			if k > 1 {
				res += v
			}
		}
		fmt.Println(res)
	}
}
func CF1728B() {
	var t int
	fmt.Scan(&t)
	for i := 0; i < t; i++ {
		var n int
		fmt.Scan(&n)
		for j := 1; j <= n; j++ {
			if n&1 == 0 {
				if j < n-1 {
					if j&1 == 0 {
						fmt.Print(j - 1)
					} else {
						fmt.Print(j + 1)
					}
				} else {
					fmt.Print(j)
				}
			} else {
				if j == 1 || j >= n-1 {
					fmt.Print(j)
				} else {
					if j&1 == 0 {
						fmt.Print(j + 1)
					} else {
						fmt.Print(j - 1)
					}
				}
			}
			if j == n {
				fmt.Println("")
			} else {
				fmt.Print(" ")
			}
		}
	}
}
func CF1728A() {
	var t int
	fmt.Scan(&t)
	for t != 0 {
		t--
		var n int
		fmt.Scan(&n)
		var m int
		var mi int
		var i int = 1
		for n != 0 {
			n--
			var ai int
			fmt.Scan(&ai)
			if ai > m {
				m = ai
				mi = i
			}
			i++
		}
		fmt.Println(mi)
	}
}

package main

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

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

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

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

func (in *R) NextInt64() int64 {
	in.load()
	val, _ := strconv.ParseInt(strings.TrimSpace(in.split[in.index]), 10, 64)
	in.index++
	return val
}
func NewR(r *bufio.Reader) *R {
	return &R{
		sc:        r,
		split:     []string{},
		index:     0,
		separator: " ",
	}
}
func (in *R) NextString() string {
	in.load()
	val := strings.TrimSpace(in.split[in.index])
	in.index++
	return val
}

func main() {
	CF1728D()
}
func CF1728D() {
	r := NewR(bufio.NewReader(os.Stdin))
	t := r.NextInt()
	for t > 0 {
		t--
		s := r.NextString()
		i, j := 0, len(s)-1
		res := "Draw"
		for i < j {
			if s[i] != s[j] {
				res = "Alice"
				break
			}
			i++
			j--
		}
		fmt.Println(res)
	}
}
func CF1728C() {
	r := NewR(bufio.NewReader(os.Stdin))
	f := func(x int) int {
		if x > 99999999 {
			return 9
		} else if x > 9999999 {
			return 8
		} else if x > 999999 {
			return 7
		} else if x > 99999 {
			return 6
		} else if x > 9999 {
			return 5
		} else if x > 999 {
			return 4
		} else if x > 99 {
			return 3
		} else if x > 9 {
			return 2
		} else {
			return x
		}
	}
	t := r.NextInt()
	for t > 0 {
		t--
		n := r.NextInt()
		am := make(map[int]int, n)
		bm := make(map[int]int, n)
		for i := 0; i < n; i++ {
			tmp := r.NextInt()
			am[tmp]++
		}
		for i := 0; i < n; i++ {
			tmp := r.NextInt()
			if v, ok := am[tmp]; ok {
				if v > 0 {
					am[tmp]--
					if am[tmp] == 0 {
						delete(am, tmp)
					}
					continue
				}
			}
			bm[tmp]++
		}
		res := 0
		for k, v := range am {
			if k > 9 {
				delete(am, k)
				res += v
				k = f(k)
				am[k] += v
			}
			if vb, ok := bm[k]; ok {
				if v < vb {
					delete(am, k)
					bm[k] -= v
				} else if v > vb {
					delete(bm, k)
					am[k] -= vb
				} else {
					delete(am, k)
					delete(bm, k)
				}
			}
		}

		for k, v := range bm {
			if k > 9 {
				delete(bm, k)
				res += v
				k = f(k)
				bm[k] += v
			}
			if va, ok := am[k]; ok {
				if v < va {
					delete(bm, k)
					am[k] -= v
				} else if v > va {
					delete(am, k)
					bm[k] -= va
				} else {
					delete(am, k)
					delete(bm, k)
				}
			}
		}

		for k, v := range am {
			if k > 1 {
				res += v
			}
		}
		for k, v := range bm {
			if k > 1 {
				res += v
			}
		}
		fmt.Println(res)
	}
}
func CF1728B() {
	var t int
	fmt.Scan(&t)
	for i := 0; i < t; i++ {
		var n int
		fmt.Scan(&n)
		for j := 1; j <= n; j++ {
			if n&1 == 0 {
				if j < n-1 {
					if j&1 == 0 {
						fmt.Print(j - 1)
					} else {
						fmt.Print(j + 1)
					}
				} else {
					fmt.Print(j)
				}
			} else {
				if j == 1 || j >= n-1 {
					fmt.Print(j)
				} else {
					if j&1 == 0 {
						fmt.Print(j + 1)
					} else {
						fmt.Print(j - 1)
					}
				}
			}
			if j == n {
				fmt.Println("")
			} else {
				fmt.Print(" ")
			}
		}
	}
}
func CF1728A() {
	var t int
	fmt.Scan(&t)
	for t != 0 {
		t--
		var n int
		fmt.Scan(&n)
		var m int
		var mi int
		var i int = 1
		for n != 0 {
			n--
			var ai int
			fmt.Scan(&ai)
			if ai > m {
				m = ai
				mi = i
			}
			i++
		}
		fmt.Println(mi)
	}
}

package main

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

var s string

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in, &t)
	for cs := 0; cs < t; cs++ {
		fmt.Fscan(in, &s)
		l := len(s)
		for {
			flag := false
			for i := 1; i < l; i++ {
				if s[i] == s[i-1] {
					s = s[:i-1] + s[i+1:]
					flag = true
					l -= 2
					break
				}
			}
			if !flag {
				break
			}
		}
		if l > 0 {
			fmt.Fprintln(out, "Alice")
		} else {
			fmt.Fprintln(out, "Draw")
		}
	}
}


// 300B
package main

import (
	"fmt"
)

func main() {
	var fa, o [50]int
	var n,m,a,b,tt int
	fmt.Scan(&n,&m)
	for i:=0;i<m;i++ {
		fmt.Scan(&a,&b)
		if o[a] != 0{
			o[b]=o[a]
		}
		if o[b] != 0 {
			o[a]=o[b]
		} else {
			tt++
			o[a]=tt
			o[b]=tt
		}
	}
	if tt>n/3 {
		fmt.Println(-1)
		return
	}
	for i:=1;i<=n;i++ {
		fa[o[i]]++
	}
	for i:=1;i<=n/3;i++ {
		if fa[i]>3 {
			fmt.Println(-1)
			return
		}
	}
	for i:=1;i<=n;i++ {
		if o[i]==0	{
			for j:=1;j<=n/3;j++	{
				if fa[j]<3 {
					o[i]=j
					fa[j]++
					break
				}
			}
		}
	}

	if m==0	{
		for i:=1;i<=n;i+=3 {
			fmt.Printf("%d %d %d\n",i,i+1,i+2)
		return
		}
	}
    for i:=1;i<=n/3;i++	{
		for j:=1;j<=n;j++ {
			if o[j]==i{
				fmt.Printf("%d ",j)
			}
		}
		fmt.Println()
	}
	return
}

package main
import "fmt"

func main() {
	var nn, mm, aa, bb, x, notice int
	var tim[16][4]int
	var y[49]int

	fmt.Scan(&nn, &mm)
	x=-1
	for i:=0; i<49; i++ {
		y[i]=-1
	}

	for i:=0; i<mm; i++ {
		fmt.Scan(&aa, &bb)
		if y[aa]==-1 && y[bb]==-1 {
			x++
			tim[x][0]=2
			tim[x][1]=aa
			tim[x][2]=bb
			y[aa]=x
			y[bb]=x
		} else if y[aa]!=-1 {
			if tim[y[aa]][0]==2 {
					if tim[y[aa]][1]!=bb && tim[y[aa]][2]!=bb {
						tim[y[aa]][0]=3
						tim[y[aa]][3]=bb
						y[bb]=y[aa]
					}
			} else if tim[y[aa]][0]==3 {
					if tim[y[aa]][1]!=bb && tim[y[aa]][2]!=bb && tim[y[aa]][3]!=bb {
						fmt.Println("-1")
						return
					}
			}
		} else if y[bb]!=-1 {
				if tim[y[bb]][0]==2 {
					if tim[y[bb]][1]!=aa && tim[y[bb]][2]!=aa {
						tim[y[bb]][0]=3
						tim[y[bb]][3]=bb
						y[aa]=y[bb]
					}
				} else if tim[y[bb]][0]==3 {
						if tim[y[bb]][1]!=aa && tim[y[bb]][2]!=aa && tim[y[bb]][3]!=aa {
							fmt.Println("-1")
							return
						}
				}
		}
		if x+1 > int(nn/3) {
				fmt.Println("-1")
				return
		}
	}

	x=0
	for i:=1; i<nn+1; i++ {
		if y[i]==-1 {
			notice=0
			for notice==0 {
				if tim[x][0]<3 {
					tim[x][0]+=1
					tim[x][tim[x][0]]=i
					notice=1
				} else {
					x+=1
				}
			}
		}
	}

	for i:=0; i<int(nn/3); i++ {
		fmt.Println(tim[i][1], tim[i][2], tim[i][3])
	}
}


package main

import (
	"fmt"
)

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

	if n < 3 {
		fmt.Println(1)
		for i := 2; i <= n+1; i++ {
			fmt.Printf("1 ")
		}
		fmt.Println()
		return
	}

	sieve := make([]int, n+2)

	for i := int64(2); i <= int64(n+1); i++ {
		for j := i; j <= int64(n+1); j++ {
			if i*j <= int64(n+1) {
				sieve[int(i*j)] = 1
			} else {
				break
			}
		}
	}

	fmt.Println(2)
	for i := 2; i <= n+1; i++ {
		if sieve[i] == 0 { // Prime
			fmt.Printf("1 ")
		} else { // Composite
			fmt.Printf("2 ")
		}
	}
	fmt.Println()
}

package main

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

func seive(n int64) (int64, []int64) {
	var isPrime []bool = []bool{}
	var i int64
	var j int64
	var num = make([]int64, n+1)
	for i = 0; i <= n; i++ {
		isPrime = append(isPrime, true)
		num[i] = 1
	}
	var color int64 = 1
	for i = 2; i <= (n); i++ {
		if isPrime[i] == true {
			for j = 2; j*i <= n; j++ {
				isPrime[j*i] = false
				num[j*i] = num[i] + 1
				if num[j*i] > color {
					color = num[j*i]
				}
			}
		}
	}

	return color, num
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	n, _ := strconv.ParseInt(scanner.Text(), 10, 64)
	var no int64
	var res []int64
	no, res = seive(n + 1)
	fmt.Println(no)
	for i := 2; i < len(res); i++ {
		fmt.Printf("%d ", res[i])
	}
}

package main

import (
	"fmt"
	"math"
)

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

	if n <= 2 {
		fmt.Println("1")
		for i := 0; i<n; i++ {
			fmt.Print("1 ")
		}
		fmt.Println()
		return
	}

	sqr := int(math.Ceil(math.Sqrt(float64(1+n))))

	not_primes := make([]bool, n+3)

	for p := 2; p <= sqr; p++ {
		if not_primes[p] {
			continue
		}
		max_i := (1+n)/p + 1
		for i := 2; i < max_i; i++ {
			not_primes[p*i] = true
		}
	}

	fmt.Println(2);
	for i := 0; i < n; i++ {
		if not_primes[i+2] {
			fmt.Print("2 ")
		} else {
			fmt.Print("1 ")
		}
	}
	fmt.Println()
}

func main() {
	cacl_colors()
}

package main

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

const N int = 1e5 + 5

var isPrime [N]bool

func sievePrime(n int) {
	for i := 0; i <= n; i++ {
		isPrime[i] = true
	}
	isPrime[0] = false
	isPrime[1] = false
	for i := 4; i <= n; i += 2 {
		isPrime[i] = false
	}
	for i := 3; i*i <= n; i += 2 {
		if isPrime[i] {
			for j := i * i; j <= n; j += 2 * i {
				isPrime[j] = false
			}
		}
	}
}

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

	sievePrime(100000)

	var n int
	fmt.Fscanf(in, "%d", &n)
	if n <= 2 {
		fmt.Printf("1\n")
	} else {
		fmt.Printf("2\n")
	}

	for val := 2; val <= n+1; val++ {
		if isPrime[val] {
			fmt.Printf("1 ")
		} else {
			fmt.Printf("2 ")
		}
	}
}

package main

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

func solve() {
	n := readInt()
	if n == 1 || n == 2 {
		fmt.Println(1)
	} else {
		fmt.Println(2)
	}
	a := make([]int, n+2)
	for i := 2; i <= n+1; i++ {
		if a[i] == 0 {
			a[i] = 1
			for j := i + i; j <= n+1; j += i {
				a[j] = 2
			}
		}
	}
	var buffer bytes.Buffer
	for i := 2; i <= n+1; i++ {
		if i > 2 {
			buffer.WriteString(" ")
		}
		if a[i] == 2 {
			buffer.WriteString("2")
		} else {
			buffer.WriteString("1")
		}
	}
	fmt.Println(buffer.String())
}

var scanner *bufio.Scanner

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

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

// IO

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

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

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

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

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

package main

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

func is_prime(n int) bool {
	for i := 2; i * i <= n; i++ {
		if n % i == 0 {
			return false
		}
	}
	return n > 1
}

func solve(n int) {
	if n < 3 {
		fmt.Println("1")
		for i := 1; i <= n; i++ {
			fmt.Printf(" 1")
		}
		fmt.Println("")
	} else {
		fmt.Println("2")
		for i := 2; i <= n + 1; i++ {
			if is_prime(i) {
				fmt.Printf(" 1")
			} else {
				fmt.Printf(" 2")
			}
		}
	}
}

func main() {
	cin := NewParser(bufio.NewReaderSize(os.Stdin, 1<<16))
	n := cin.nextInt()
	solve(n)
}

// some io

type ParserReader struct {
	r   io.ByteReader
	err error
	c   byte
}

func NewParser(r io.ByteReader) *ParserReader {
	return &ParserReader{r, nil, 0}
}

func (p *ParserReader) next() error {
	p.c, p.err = p.r.ReadByte()
	return p.err
}

func isDigit(c byte) bool {
	return '0' <= c && c <= '9'
}

func (p *ParserReader) nextUInt64() uint64 {
	for !isDigit(p.c) && p.err == nil {
		p.next()
	}
	var r uint64
	for isDigit(p.c) && p.err == nil {
		r = r*10 + uint64(p.c-'0')
		p.next()
	}
	return r
}

func (p *ParserReader) nextUInt() uint {
	for !isDigit(p.c) && p.err == nil {
		p.next()
	}
	var r uint
	for isDigit(p.c) && p.err == nil {
		r = r*10 + uint(p.c-'0')
		p.next()
	}
	return r
}

func (p *ParserReader) nextInt64() int64 {
	for p.c != '-' && !isDigit(p.c) && p.err == nil {
		p.next()
	}
	var sign bool
	if p.c == '-' {
		sign = true
	}
	r := int64(p.nextUInt64())
	if sign {
		return -r
	}
	return r
}

func (p *ParserReader) nextInt() int {
	for p.c != '-' && !isDigit(p.c) && p.err == nil {
		p.next()
	}
	var sign bool
	if p.c == '-' {
		sign = true
	}
	r := int(p.nextUInt())
	if sign {
		return -r
	}
	return r
}

func isSpace(c byte) bool {
	return c < 32 || c == ' ' || c == '\n' || c == '\t'
}

func (p *ParserReader) nextString() string {
	for isSpace(p.c) && p.err == nil {
		p.next()
	}
	r := make([]byte, 0, 1)
	for !isSpace(p.c) && p.err == nil {
		r = append(r, p.c)
		p.next()
	}
	return string(r)
}

package main

import (
    "fmt"
    "math"
)

func main() {
    var n int
    fmt.Scanf("%d", &n)
    if n == 1 {
        fmt.Printf("1\n1")
        return
    }
    if n == 2 {
        fmt.Printf("1\n1 1")
        return
    }
    fmt.Println(2)
    l := make([]int, n)
    for i:=0;i<n;i++ {
        if i+2!=2 && (i+2)%2 == 0 {
            l[i] = 2
        } else {
            l[i] = 1 // prime
        }
    }
    upper := int(math.Sqrt(float64(n))) + 1
    for i := 3; i <= upper ;i ++ {
        for j:=0;j<n;j++ {
            if j+2 != i && (j+2)%i == 0 {
                l[j] = 2
            }
        }
    }
    for _, x := range l{
        fmt.Printf("%d ", x)
    }
}

package main

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

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

	ans := make([]int, N+2)
	mx := 0
	for i := 2; i <= N+1; i++ {
		checked := make([]bool, i+2)
		for j := 2; j*j <= i; j++ {
			if i%j != 0 {
				continue
			}
			checked[ans[i]] = true
		}
		k := 0
		for ; k <= i; k++ {
			if !checked[k] {
				break
			}
		}
		ans[i] = k

	}
	for i := 2; i < len(ans); i++ {
		ans[i]++
		if mx < ans[i] {
			mx = ans[i]
		}
	}
	fmt.Println(mx)
	PrintI(ans[2:]...)

}
func PrintI(args ...int) {
	fmt.Println(strings.Join(mapToString(args), " "))
}
func mapToString(arr []int) []string {
	ret := make([]string, len(arr))
	for i := 0; i < len(arr); i++ {
		ret[i] = strconv.Itoa(arr[i])
	}
	return ret
}

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 (
	"bufio"
	"errors"
	"fmt"
	"log"
	"os"
	"strconv"
	"strings"
)

const (
	BIG = 1024 * 1024 * 10
)

func readLine(r *bufio.Reader) string {
	bytes, _, err := r.ReadLine()
	if err != nil {
		log.Fatalln("Failed to read line")
	}

	return string(bytes)
}

func readInts(r *bufio.Reader) []int {
	elems := strings.Fields(readLine(r))

	ret := make([]int, len(elems))
	for i, el := range elems {
		tmp, err := strconv.ParseInt(el, 10, 64)
		if err != nil {
			log.Fatalf("Failed to parse number %v", el)
		}
		ret[i] = int(tmp)
	}

	return ret
}

type Sieve struct {
	n             int
	first, primes []int
}

type Factor struct {
	Base, Exp int
}

func NewSieve(n int) *Sieve {
	first := make([]int, n+1)
	primes := make([]int, 0)

	for i := 2; i <= n; i++ {
		if first[i] == 0 {
			first[i] = i
			primes = append(primes, i)
		}

		for j := 0; j < len(primes) && primes[j] <= first[i] && i*primes[j] <= n; j++ {
			first[i*primes[j]] = primes[j]
		}
	}

	ret := Sieve{n, first, primes}

	return &ret
}

func (s *Sieve) IsPrime(x int) (bool, error) {
	if s.n < x {
		return false, errors.New(fmt.Sprintf("The largest supported number by this sieve is %v", s.n))
	}
	if x < s.primes[0] || x > s.primes[len(s.primes)-1] {
		return false, nil
	} else if x == s.primes[0] {
		return true, nil
	}
	low, high := 0, len(s.primes)-1
	for high-low > 1 {
		mid := (low + high) / 2
		if s.primes[mid] < x {
			low = mid
		} else {
			high = mid
		}
	}
	return s.primes[high] == x, nil
}

func (s *Sieve) Factors(x int) ([]Factor, error) {
	factors := make([]Factor, 0)

	if s.n < x {
		return factors, errors.New(fmt.Sprintf("The largest supported number by this sieve is %v", s.n))
	}

	for x > 1 {
		pi := s.first[x]
		exp := 0
		for x > 1 && s.first[x] == pi {
			exp += 1
			x /= pi
		}
		factors = append(factors, Factor{pi, exp})
	}

	return factors, nil
}

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

func main() {
	r := bufio.NewReaderSize(os.Stdin, BIG)

	n := readInts(r)[0]
	s := NewSieve(n + 1)
	colors := make([]string, 0)
	cc := 1

	for i := 2; i <= n+1; i++ {
		if isPrime, _ := s.IsPrime(i); isPrime {
			colors = append(colors, "1")
		} else {
			colors = append(colors, "2")
			cc = 2
		}
	}
	fmt.Println(cc)
	fmt.Println(strings.Join(colors, " "))
}

package main

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

func seive(n int64) (int64, []int64) {
	var isPrime []bool = []bool{}
	var i int64
	var j int64
	var num = make([]int64, n+1)
	for i = 0; i <= n; i++ {
		isPrime = append(isPrime, true)
		num[i] = 1
	}
	var color int64 = 1
	for i = 2; i <= (n); i++ {
		for j = 2; j*i <= n; j++ {
			isPrime[j*i] = false
			num[j*i] = num[i] + 1
			if num[j*i] > color {
				color = num[j*i]
			}
		}

	}

	return color, num
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	n, _ := strconv.ParseInt(scanner.Text(), 10, 64)
	var no int64
	var res []int64
	no, res = seive(n + 1)
	fmt.Println(no)
	for i := 2; i < len(res); i++ {
		fmt.Printf("%d ", res[i])
	}
}

package main

import (
	"fmt"
)

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

	sieve := make([]int, n+2)

	for i := 2; i <= n+1; i++ {
		for j := i; j <= n+1; j++ {
			if i*j <= n+1 {
				sieve[i*j] = 1
			} else {
				break
			}
		}
	}

	fmt.Println(2)
	for i := 2; i <= n+1; i++ {
		if sieve[i] == 0 { // Prime
			fmt.Printf("1 ")
		} else { // Composite
			fmt.Printf("2 ")
		}
	}
	fmt.Println()
}

package main

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

func solve() {
	n := readInt()
	if n == 1 || n == 2 {
		fmt.Println(1)
	} else {
		fmt.Println(2)
	}
}

var scanner *bufio.Scanner

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

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

// IO

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

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

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

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

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

package main

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

func is_prime(n int) bool {
	for i := 2; i * i <= n; i++ {
		if n % i == 0 {
			return false
		}
	}
	return n > 1
}

func solve(n int) {
	if n < 3 {
		fmt.Println("1")
		for i := 1; i <= n; i++ {
			fmt.Printf(" 1")
		}
		fmt.Println("")
	} else {
		fmt.Println("2")
		for i := 2; i <= n + 1; i++ {
			if is_prime(i) {
				fmt.Printf(" 1")
			} else {
				fmt.Printf(" 2")
			}
		}
	}
}

func main() {
	f, _ := os.Open("b.in")
	cin := NewParser(bufio.NewReaderSize(f, 1<<16))
	// cin := NewParser(bufio.NewReaderSize(os.Stdin, 1<<16))
	n := cin.nextInt()
	solve(n)
}

// some io

type ParserReader struct {
	r   io.ByteReader
	err error
	c   byte
}

func NewParser(r io.ByteReader) *ParserReader {
	return &ParserReader{r, nil, 0}
}

func (p *ParserReader) next() error {
	p.c, p.err = p.r.ReadByte()
	return p.err
}

func isDigit(c byte) bool {
	return '0' <= c && c <= '9'
}

func (p *ParserReader) nextUInt64() uint64 {
	for !isDigit(p.c) && p.err == nil {
		p.next()
	}
	var r uint64
	for isDigit(p.c) && p.err == nil {
		r = r*10 + uint64(p.c-'0')
		p.next()
	}
	return r
}

func (p *ParserReader) nextUInt() uint {
	for !isDigit(p.c) && p.err == nil {
		p.next()
	}
	var r uint
	for isDigit(p.c) && p.err == nil {
		r = r*10 + uint(p.c-'0')
		p.next()
	}
	return r
}

func (p *ParserReader) nextInt64() int64 {
	for p.c != '-' && !isDigit(p.c) && p.err == nil {
		p.next()
	}
	var sign bool
	if p.c == '-' {
		sign = true
	}
	r := int64(p.nextUInt64())
	if sign {
		return -r
	}
	return r
}

func (p *ParserReader) nextInt() int {
	for p.c != '-' && !isDigit(p.c) && p.err == nil {
		p.next()
	}
	var sign bool
	if p.c == '-' {
		sign = true
	}
	r := int(p.nextUInt())
	if sign {
		return -r
	}
	return r
}

func isSpace(c byte) bool {
	return c < 32 || c == ' ' || c == '\n' || c == '\t'
}

func (p *ParserReader) nextString() string {
	for isSpace(p.c) && p.err == nil {
		p.next()
	}
	r := make([]byte, 0, 1)
	for !isSpace(p.c) && p.err == nil {
		r = append(r, p.c)
		p.next()
	}
	return string(r)
}

package main

import (
    "fmt"
    "math"
)

func main() {
    var n int
    fmt.Scanf("%d", &n)
    fmt.Println(2)
    l := make([]int, n)
    for i:=0;i<n;i++ {
        if i+2!=2 && (i+2)%2 == 0 {
            l[i] = 2
        } else {
            l[i] = 1 // prime
        }
    }
    upper := int(math.Sqrt(float64(n))) + 1
    for i := 3; i <= upper ;i ++ {
        for j:=0;j<n;j++ {
            if j+2 != i && (j+2)%i == 0 {
                l[j] = 2
            }
        }
    }
    for _, x := range l{
        fmt.Printf("%d ", x)
    }
}

package main

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

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

	d := make([]int, N+2)
	ans := make([]int, N+2)
	mx := 0
	for i := 2; i <= N+1; i++ {
		ans[i] = d[i] + 1
		for j := i; j <= N+1; j += i {
			d[j]++
			if mx < d[j] {
				mx = d[j]
			}
		}
	}
	fmt.Println(mx)
	PrintI(ans[2:]...)

}
func PrintI(args ...int) {
	fmt.Println(strings.Join(mapToString(args), " "))
}
func mapToString(arr []int) []string {
	ret := make([]string, len(arr))
	for i := 0; i < len(arr); i++ {
		ret[i] = strconv.Itoa(arr[i])
	}
	return ret
}

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 (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

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

	ans := make([]int, N+2)
	mx := 0
	for i := 2; i <= N+1; i++ {
		for j := 2 * i; j <= N+1; j += i {
			if ans[j] == ans[i] {
				ans[j]++
			}
		}
	}
	for i := 2; i < len(ans); i++ {
		ans[i]++
		if mx < ans[i] {
			mx = ans[i]
		}
	}
	fmt.Println(mx)
	PrintI(ans[2:]...)

}
func PrintI(args ...int) {
	fmt.Println(strings.Join(mapToString(args), " "))
}
func mapToString(arr []int) []string {
	ret := make([]string, len(arr))
	for i := 0; i < len(arr); i++ {
		ret[i] = strconv.Itoa(arr[i])
	}
	return ret
}

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 (
	"bufio"
	"errors"
	"fmt"
	"log"
	"os"
	"strconv"
	"strings"
)

const (
	BIG = 1024 * 1024 * 10
)

func readLine(r *bufio.Reader) string {
	bytes, _, err := r.ReadLine()
	if err != nil {
		log.Fatalln("Failed to read line")
	}

	return string(bytes)
}

func readInts(r *bufio.Reader) []int {
	elems := strings.Fields(readLine(r))

	ret := make([]int, len(elems))
	for i, el := range elems {
		tmp, err := strconv.ParseInt(el, 10, 64)
		if err != nil {
			log.Fatalf("Failed to parse number %v", el)
		}
		ret[i] = int(tmp)
	}

	return ret
}

type Sieve struct {
	n             int
	first, primes []int
}

type Factor struct {
	Base, Exp int
}

func NewSieve(n int) *Sieve {
	first := make([]int, n+1)
	primes := make([]int, 0)

	for i := 2; i <= n; i++ {
		if first[i] == 0 {
			first[i] = i
			primes = append(primes, i)
		}

		for j := 0; j < len(primes) && primes[j] <= first[i] && i*primes[j] <= n; j++ {
			first[i*primes[j]] = primes[j]
		}
	}

	ret := Sieve{n, first, primes}

	return &ret
}

func (s *Sieve) IsPrime(x int) (bool, error) {
	if s.n < x {
		return false, errors.New(fmt.Sprintf("The largest supported number by this sieve is %v", s.n))
	}
	if x < s.primes[0] || x > s.primes[len(s.primes)-1] {
		return false, nil
	} else if x == s.primes[0] {
		return true, nil
	}
	low, high := 0, len(s.primes)-1
	for high-low > 1 {
		mid := (low + high) / 2
		if s.primes[mid] < x {
			low = mid
		} else {
			high = mid
		}
	}
	return s.primes[high] == x, nil
}

func (s *Sieve) Factors(x int) ([]Factor, error) {
	factors := make([]Factor, 0)

	if s.n < x {
		return factors, errors.New(fmt.Sprintf("The largest supported number by this sieve is %v", s.n))
	}

	for x > 1 {
		pi := s.first[x]
		exp := 0
		for x > 1 && s.first[x] == pi {
			exp += 1
			x /= pi
		}
		factors = append(factors, Factor{pi, exp})
	}

	return factors, nil
}

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

func main() {
	r := bufio.NewReaderSize(os.Stdin, BIG)

	n := readInts(r)[0]
	s := NewSieve(n + 1)
	colors := make([]string, 0)
	cc := 1

	for i := 2; i <= n+1; i++ {
		factors, _ := s.Factors(i)
		color := 1
		for _, factor := range factors {
			color *= factor.Exp
		}
		cc = max(cc, color)
		colors = append(colors, fmt.Sprint(color))
	}
	fmt.Println(cc)
	fmt.Println(strings.Join(colors, " "))
}

package main

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

const (
	BIG = 1024 * 1024 * 10
)

func readLine(r *bufio.Reader) string {
	bytes, _, err := r.ReadLine()
	if err != nil {
		log.Fatalln("Failed to read line")
	}

	return string(bytes)
}

func readInts(r *bufio.Reader) []int {
	elems := strings.Fields(readLine(r))

	ret := make([]int, len(elems))
	for i, el := range elems {
		tmp, err := strconv.ParseInt(el, 10, 64)
		if err != nil {
			log.Fatalf("Failed to parse number %v", el)
		}
		ret[i] = int(tmp)
	}

	return ret
}

type Sieve struct {
	n             int
	first, primes []int
}

type Factor struct {
	Base, Exp int
}

func NewSieve(n int) *Sieve {
	first := make([]int, n+1)
	primes := make([]int, 0)

	for i := 2; i <= n; i++ {
		if first[i] == 0 {
			first[i] = i
			primes = append(primes, i)
		}

		for j := 0; j < len(primes) && primes[j] <= first[i] && i*primes[j] <= n; j++ {
			first[i*primes[j]] = primes[j]
		}
	}

	ret := Sieve{n, first, primes}

	return &ret
}

func (s *Sieve) IsPrime(x int) (bool, error) {
	if s.n < x {
		return false, errors.New(fmt.Sprintf("The largest supported number by this sieve is %v", s.n))
	}
	if x < s.primes[0] || x > s.primes[len(s.primes)-1] {
		return false, nil
	} else if x == s.primes[0] {
		return true, nil
	}
	low, high := 0, len(s.primes)-1
	for high-low > 1 {
		mid := (low + high) / 2
		if s.primes[mid] < x {
			low = mid
		} else {
			high = mid
		}
	}
	return s.primes[high] == x, nil
}

func (s *Sieve) Factors(x int) ([]Factor, error) {
	factors := make([]Factor, 0)

	if s.n < x {
		return factors, errors.New(fmt.Sprintf("The largest supported number by this sieve is %v", s.n))
	}

	for x > 1 {
		pi := s.first[x]
		exp := 0
		for x > 1 && s.first[x] == pi {
			exp += 1
			x /= pi
		}
		factors = append(factors, Factor{pi, exp})
	}

	return factors, nil
}

func main() {
	r := bufio.NewReaderSize(os.Stdin, BIG)

	n := readInts(r)[0]
	s := NewSieve(n + 1)
	colors := make([]string, 0)

	for i := 2; i <= n+1; i++ {
		factors, _ := s.Factors(i)
		color := 1
		for _, factor := range factors {
			color *= factor.Exp
		}
		colors = append(colors, fmt.Sprint(color))
	}
	fmt.Println(strings.Join(colors, " "))
}


package main

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

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

	var epochs int
	fmt.Fscan(r, &epochs)
	for ; epochs > 0; epochs-- {
		var n int
		fmt.Fscan(r, &n)

		nums := make([]int, n)
		// 1 -1 1 0 0 0 1 -1 1 1
		// ~~~~~~
		// ^ non-zero component

		// the position of non-zero component
		// e.g.: [1 3 7 10]
		pos := []int{}

		// the position of the start of segmentation
		// the first element is used to handle the condition
		// that the first component is zero
		// e.g.
		// 0 0 1 -1 0 1 -1
		// x x +  + x +  +
		// the res will become [3, 5]
		// but we need [1, 3, 5, 8]
		// print:
		// 3      <- len(res)-1
		// 1 2    <- res[0] res[1]-1
		// 3 4    <- res[1] res[2]-1
		// 5 7    <- res[3] res[3]-1
		res := []int{-1}

		// scan n numbers (in {-1, 0, 1})
		// from standard input
		for i := 0; i < n; i++ {
			fmt.Fscan(r, &nums[i])
		}

		// if non zero elements is odd -> can not be partitioned
		numOfNonZeroElements := 0

		// decide the non-zero component
		flag := 0 // used to parse zero component or non-zero component
		for i := range nums {
			if nums[i] != 0 {
				numOfNonZeroElements++
				if flag == 0 {
					pos = append(pos, i)
				}
				flag = 1
			} else {
				if flag == 1 {
					pos = append(pos, i-1)
				}
				flag = 0
			}
		}
		if flag == 1 {
			pos = append(pos, len(nums)-1)
		}

		if numOfNonZeroElements&1 == 1 {
			fmt.Fprintln(w, "-1")
			continue
		}

		// initialize 0
		// if the first odd component is 1 set 1, otherwise -1
		detectOddComponent := 0

		for i := 0; i < len(pos)-1; i += 2 {
			// non zero section
			j := pos[i]

			// when the non-zero component is odd
			// handle the first element specially
			// if x, y is in {1, -1}
			// x 1 -1 0 ... 0 0' y 1 -1
			// ^                 ^
			// if x == y
			//   x | 0' | y
			//   + | +  | -
			// else if x != y
			//   x | 0' | y
			//   + | +/-| +
			if (pos[i+1]-pos[i])&1 == 0 {
				if detectOddComponent == 0 {
					res = append(res, j+1)
					detectOddComponent = nums[j]
				} else {
					if detectOddComponent == nums[j] {
						res = append(res, j)
					} else {
						res = append(res, j+1)
					}
					detectOddComponent = 0
				}
				j++
			}

			for ; j <= pos[i+1]; j += 2 {
				if nums[j] == nums[j+1] {
					//  1 |  1
					//  + |  -
					// -1 | -1
					//  + |  -
					res = append(res, j+1)
				} else {
					//  1 | -1
					//  + |  +
					// -1 |  1
					//  + |  +
					res = append(res, j+1, j+2)
				}
			}
		}

		// fix the first element
		if len(res) < 2 || res[1] != 1 {
			res[0] = 1
		} else {
			res = res[1:]
		}
		// fix the last element
		if res[len(res)-1] != n+1 {
			res = append(res, n+1)
		}

		fmt.Fprintln(w, len(res)-1)
		for i := 0; i < len(res)-1; i++ {
			fmt.Fprintln(w, res[i], res[i+1]-1)
		}
	}
}

package main

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

type seg struct {
	l int
	r int
}

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

	var T int
	for fmt.Fscan(r, &T); T > 0; T-- {

		var n, rsum int
		fmt.Fscan(r, &n)
		a := make([]int, n)

		for i := range a {
			fmt.Fscan(r, &a[i])
			rsum += (2 + a[i]) % 2
		}

		if rsum % 2 == 1 {
			fmt.Fprintln(w, -1)
		} else {
			segc := 0
			segs := make([]seg, n)
			j := 0
			for j < n {
				i := j
				for j < n && a[j] == 0 { j++ }
				if j > i {
					segs[segc] = seg{i+1, j}
					segc++
				}

				k := j + 1
				for k < n && a[k] == 0 { k++ }
				if k < n {
					if ((k-j)%2 == 1 && a[j] == a[k]) || ((k-j)%2 == 0 && a[j] != a[k]) {
						segs[segc] = seg{j+1, k+1}
						segc++
					} else {
						segs[segc] = seg{j+1, j+1}
						segs[segc+1] = seg{j+2, k+1}
						segc += 2
					}
				}
				j = k+1
			}

			fmt.Fprintln(w, segc)
			for j := 0; j < segc; j++ {
				fmt.Fprintln(w, segs[j].l, segs[j].r)
			}
		}
	}
}

package main

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

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

	var epochs int
	fmt.Fscan(r, &epochs)
	for ; epochs > 0; epochs-- {
		var n int
		fmt.Fscan(r, &n)

		nums := make([]int, n)
		// the position of non-zero component
		pos := []int{}

		// the position of the start of segmentation
		// the first element is used to fix the condition
		// that the first component is zero
		res := []int{-1}
		for i := 0; i < n; i++ {
			fmt.Fscan(r, &nums[i])
		}
		numOfNonZeroElements := 0
		flag := 0 // used to parse zero component or non-zero component
		for i := range nums {
			if nums[i] != 0 {
				numOfNonZeroElements++
				if flag == 0 {
					pos = append(pos, i)
				}
				flag = 1
			} else {
				if flag == 1 {
					pos = append(pos, i-1)
				}
				flag = 0
			}
		}
		if flag == 1 {
			pos = append(pos, len(nums)-1)
		}

		if numOfNonZeroElements&1 == 1 {
			fmt.Fprintln(w, "-1")
			continue
		}

		// initialize 0
		// if the first odd component is 1 set 1, otherwise -1
		detectOddComponent := 0

		for i := 0; i < len(pos)-1; i += 2 {
			// non zero section
			j := pos[i]
			for ; j <= pos[i+1]-1; j += 2 {
				if nums[j] == nums[j+1] {
					// 1  1 or -1 -1 use + -
					res = append(res, j+1)
				} else {
					// 1 -1 or -1 1 use + +
					res = append(res, j+1, j+2)
				}
			}

			// if end - start + 1 is odd
			if (pos[i+1]-pos[i])&1 == 0 {
				if detectOddComponent == 0 {
					res = append(res, j+1)
					detectOddComponent = nums[j]
				} else {
					if detectOddComponent == nums[j] {
						res = append(res, j)
					} else {
						res = append(res, j+1)
					}
					detectOddComponent = 0
				}
			}
		}
		// fmt.Println(res)

		// fix the first element
		if len(res) < 2 || res[1] != 1 {
			res[0] = 1
		} else {
			res = res[1:]
		}
		// fix the last element
		if res[len(res)-1] != n+1 {
			res = append(res, n+1)
		}

		fmt.Fprintln(w, len(res)-1)
		for i := 0; i < len(res)-1; i++ {
			fmt.Fprintln(w, res[i], res[i+1]-1)
		}
	}
}


package main

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

/*

 */

//goland:noinspection GoUnhandledErrorResult
func solve() {
	scanf("\n")

	n := 8

	tb := make([]string, n)

	for i := range tb {
		scanf("%s\n", &tb[i])
	}

	for r := 1; r < n-1; r++ {
		for c := 1; c < n-1; c++ {
			if tb[r][c] == '#' && tb[r-1][c-1] == '#' && tb[r+1][c+1] == '#' && tb[r+1][c-1] == '#' && tb[r-1][c+1] == '#' {
				fmt.Fprintln(writer, r+1, c+1)
				return
			}
		}
	}
}

//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 solve() {
	board := make([]string, 8)
	for i := range board {
		fmt.Fscan(r, &board[i])
	}
	for i := 1; i < 7; i++ {
		for j := 1; j < 7; j++ {
			if board[i][j] == '#' && board[i-1][j-1] == '#' && board[i-1][j+1] == '#' && board[i+1][j-1] == '#' && board[i+1][j+1] == '#' {
				fmt.Fprintln(w, i+1, j+1)
			}
		}
	}

}
func main() {
	defer w.Flush()
	var t int
	fmt.Fscan(r, &t)
	for ; t > 0; t-- {
		solve()
	}
}

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++ {
		m := make([]string, 8)
		for i := 0; i < 8; i++ {
			fmt.Fscan(in, &m[i])
		}

		var x, y int
	Loop:
		for i := 1; i < 7; i++ {
			for j := 1; j < 7; j++ {
				if m[i][j] == '#' &&
					m[i-1][j-1] == '#' && m[i-1][j+1] == '#' &&
					m[i+1][j-1] == '#' && m[i+1][j+1] == '#' {
					x, y = i, j
					break Loop
				}
			}
		}
		fmt.Fprintln(out, x+1, y+1)
	}
}

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++ {
		m := make([]string, 8)
		for i := 0; i < 8; i++ {
			fmt.Fscan(in, &m[i])
		}

		g := make([]int, 8)
		for i, s := range m {
			for _, ch := range s {
				if ch == '#' {
					g[i]++
				}
			}
		}

		var r int
		for i := 1; i < 7; i++ {
			if g[i-1] == 2 && g[i] == 1 && g[i+1] == 2 {
				r = i
			}
		}

		var x, y int
		x = r + 1
		for i, ch := range m[r] {
			if ch == '#' {
				y = i + 1
				break
			}
		}
		fmt.Fprintln(out, x, y)
	}
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	var t int
	var chessborad [8]string
	fmt.Fscan(in, &t)
	for k := 1; k <= t; k++ {
		for i := 0; i < 8; i++ {
			fmt.Fscan(in, &chessborad[i])
		}
	Loop:
		for i := 1; i < 8; i++ {
			for j := 1; j < 8; j++ {
				if chessborad[i][j] == '#' &&
					chessborad[i-1][j-1] == '#' &&
					chessborad[i-1][j+1] == '#' &&
					chessborad[i+1][j-1] == '#' &&
					chessborad[i+1][j+1] == '#' {
					fmt.Println(i+1, j+1)
					break Loop
				}
			}
		}
	}
}

package main

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

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

func slove() {
	board := make([]string, 8)
	ans_i, ans_j := 0, 0
	flag, flag1 := false, false
	for i := range board {
		fmt.Fscan(r, &board[i])
		cnt := 0
		x, y := i, 0
		for j := range board {
			if board[i][j] == '#' {
				cnt++
				y = j
			}
		}
		if cnt == 1 && flag && !flag1 {
			ans_i, ans_j = x, y
			flag1 = true
		} else if cnt == 2{
			flag = true
		}
	}
	fmt.Fprintln(w, ans_i+1, ans_j+1)
}

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

package main
import(
    "fmt"
    "bufio"
    "os"
)
func main() {
	in:= bufio.NewReader(os.Stdin)
	out:= bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in,&t)

	for i:=0;i<t;i++{
		board:=make([]string,8)
		for j:=0;j<8;j++{
			fmt.Fscan(in,&board[j])
		}
		// search for #.# ie: board[2],board[4]
		// bishop between these 2 points ie line 3
		// search line 3 for # (x-coordinate)
		var y1,counter int
		for j:=0;j<8;j++{
			for k:=2;k<8;k++{
				if string(board[j][k]) == "#" && string(board[j][k-2]) == "#" {
					counter++
					if counter == 1 {
						y1= j
						goto out
					}
				}
			}
		}
		out:
		for j:=0;j<8;j++{
			if string(board[y1+1][j]) == "#" {
				fmt.Println(y1+2,j+1)
				break
			}
		}
	}
}

package main

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

type Cell struct {
	x int
	y int
}

var (
	reader = bufio.NewReader(os.Stdin)
	t      int
	b      []string
)

func sameDiagonal(v, w Cell) bool {
	return math.Abs(float64(v.x-w.x)) == math.Abs(float64(v.y-w.y))
}

func solve(b []string) string {
	var cells []Cell
	for i := range b {
		for j := range b[i] {
			if b[i][j] == '#' {
				cells = append(cells, Cell{i, j})
			}
		}
	}
	for i := range cells {
		var foundCell = true
		for _, x := range cells {
			if !sameDiagonal(x, cells[i]) {
				foundCell = false
				break
			}
		}
		if foundCell {
			return fmt.Sprintf("%d %d", cells[i].x+1, cells[i].y+1)
		}
	}
	return ""
}

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

package main

import (
	"fmt"
)

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

	for test := 0; test < t; test++ {
		lines := make([]string, 8)

		fmt.Scanln()
		for i := 0; i < 8; i++ {
			fmt.Scanln(&lines[i])
		}

	out:
		for i := 1; i < 7; i++ {
			for j := 1; j < 7; j++ {
				if lines[i][j] == '#' && lines[i-1][j-1] == '#' &&
					lines[i-1][j+1] == '#' && lines[i+1][j-1] == '#' && lines[i+1][j+1] == '#' {
					fmt.Printf("%d %d\n", i+1, j+1)
					break out
				}
			}
		}
	}
}

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)
	board := make([]string, 9)
	for i := 0; i < t; i++ {
		for r := 0; r < 8; r++ {
			fmt.Fscan(cin, &board[r])
		}
		var x, y int
		for r := 1; r < 7; r++ {
			for c := 1; c < 7; c++ {
				if board[r][c] == '#' {
					if board[r-1][c-1] == '#' && board[r-1][c+1] == '#' && board[r+1][c-1] == '#' && board[r+1][c+1] == '#' {
						x = r + 1
						y = c + 1
					}
				}
			}
		}
		fmt.Printf("%d %d\n", x, y)
	}
}

package main

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

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

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

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

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

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

/**
Run solve the problem CF1692C
Date: 16/06/22
User: pepradere
URL: https://codeforces.com/problemset/problem/1692/C
Problem: CF1692C
**/
func (in *CF1692C) Run() {
	for t := in.NextInt(); t > 0; t-- {
		in.NextString()
		arr := make([]string, 8)
		for i := 0; i < len(arr); i++ {
			arr[i] = in.NextString()
		}

		for i := 2; i < 8; i++ {
			for j := 2; j < 8; j++ {
				if arr[i-2][j-2] == '#' && arr[i-1][j-1] == '#' && arr[i][j] == '#' && arr[i-2][j] == '#' && arr[i][j-2] == '#' {
					fmt.Println(i, j)
					break
				}
			}
		}

	}
}

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

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

package main

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

func slove() {
	a := make([]string,8)
	for i := 0; i < 8; i++ {
		fmt.Fscan(r, &a[i])
	}

	for i := 1; i + 1< 8; i++ {
		for j := 1; j + 1 < 8; j++ {
			if a[i][j] == '#' && a[i-1][j-1] == '#' && a[i-1][j+1] == '#' && a[i+1][j-1] == '#' && a[i+1][j+1] == '#' {
				fmt.Fprintln(w,i+1,j+1)
				return
			}
		}
	}

}

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

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	var n int
	var s string

	fmt.Fscan(in, &n)

	// bitsがn個の要素の各パターンを表す
	for i := 0;i < n;i++ {
		list := make([][]int,8)
		for j := 0;j < 8;j++ {
			fmt.Fscan(in, &s)
			arr1 := strings.Split(s, "")
			for p := 0;p < len(arr1);p++ {
				//fmt.Println(arr1[p])
				if arr1[p] == "#"{
					list[j] = append(list[j],p,j)
					if j != 0 && p != 0 {
						if len(list[j-1]) == 4{
							if p-1 == list[j-1][0] && p+1 == list[j-1][2]{
								fmt.Println(j+1,p+1)
							}
						}
					}
				}
			}
		}
	}
}

package main

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

var _, _, _ = main, rw, do

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

func rw(r io.Reader, w io.Writer) {
	var t int
	fmt.Fscan(r, &t)
	for ti := 0; ti < t; ti++ {
		var a = make([]string, 8)
		for i := 0; i < 8; i++ {
			fmt.Fscan(r, &a[i])
		}
		w1, w2 := do(a)
		fmt.Fprintln(w, w1, w2)
	}
}

var dx = []int{1, 1, -1, -1}
var dy = []int{-1, 1, 1, -1}

func do(a []string) (int, int) {
	for i := 1; i < 7; i++ {
		for j := 1; j < 7; j++ {
			if a[i][j] == '#' {
				ok := true
				for k := 0; k < 4; k++ {
					x := i + dx[k]
					y := j + dy[k]
					if a[x][y] != '#' {
						ok = false
						break
					}
				}
				if ok {
					return i + 1, j + 1
				}
			}
		}
	}
	return 0, 0
}

package main

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

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

	var testCases int
	Fscan(in, &testCases)

	for t := 0; t < testCases; t++ {
		var board [8][8]rune

		for i := 0; i < 8; i++ {
			var s string
			Fscan(in, &s)
			ss := []rune(s)
			for j := 0; j < 8; j++ {
				board[i][j] = ss[j]
			}
		}

		c := rune('#')
		var x, y int
		for i := 1; i < 7; i++ {
			for j := 1; j < 7; j++ {
				if board[i][j] == c &&
					board[i-1][j-1] == c &&
					board[i-1][j+1] == c &&
					board[i+1][j-1] == c &&
					board[i+1][j+1] == c {
					x = i + 1
					y = j + 1
					break

				}
			}
		}
		Fprintln(out, x, y)
	}

}

package main

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

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

func solve() string {
	var board [8]string
	for i := 0; i < 8; i++ {
		fmt.Fscan(in, &board[i])
	}

	var x, y int

	for i := 1; i < 7; i++ {
		for j := 1; j < 7; j++ {
			if board[i][j] == '#' &&
				board[i-1][j-1] == '#' &&
				board[i+1][j-1] == '#' &&
				board[i-1][j+1] == '#' &&
				board[i+1][j+1] == '#' {
				x, y = i, j
			}
		}
	}

	return fmt.Sprintf("%d %d", x+1, y+1)
}

func main() {
	defer out.Flush()
	var t int
	for fmt.Fscanln(in, &t); t > 0; t-- {
		fmt.Fprintln(out, solve())
	}
}

// util functions
func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

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

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

func makeMatrix(n, m int) [][]int {
	x := make([][]int, n)
	for i := range x {
		x[i] = make([]int, m)
	}
	return x
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"runtime/debug"
)

/* begin of MyIO */
const eof = 0

type any = interface{}

type MyIO struct {
	in  *os.File
	out *bufio.Writer
	_i  int
	_n  int
	buf []byte
}

func NewIO(in *os.File, out *os.File) *MyIO {
	return &MyIO{
		in,
		bufio.NewWriter(out),
		0, 0, make([]byte, 1<<12),
	}
}

func (myio *MyIO) rc() byte {
	if myio._i == myio._n {
		myio._n, _ = myio.in.Read(myio.buf)
		if myio._n == 0 { // EOF
			return eof
		}
		myio._i = 0
	}
	b := myio.buf[myio._i]
	myio._i++
	return b
}

func (myio *MyIO) ReadInt() (x int) {
	rc := myio.rc
	b := rc()
	neg := false
	for ; '0' > b || b > '9'; b = rc() {
		if b == eof {
			return
		}
		if b == '-' {
			neg = true
		}
	}
	for ; '0' <= b && b <= '9'; b = rc() {
		x = x*10 + int(b&15)
	}
	if neg {
		return -x
	}
	return
}

func (myio *MyIO) ReadInt64() (x int64) {
	rc := myio.rc
	b := rc()
	neg := false

	for ; '0' > b || b > '9'; b = rc() {
		if b == eof {
			return
		}
		if b == '-' {
			neg = true
		}
	}
	for ; '0' <= b && b <= '9'; b = rc() {
		x = x*10 + int64(b&15)
	}
	if neg {
		return -x
	}
	return x
}

func (myio *MyIO) ReadBytes() (s []byte) {
	rc := myio.rc
	b := rc()
	for ; b <= ' '; b = rc() {
	}
	for ; b > ' '; b = rc() {
		s = append(s, b)
	}
	return
}

func (myio *MyIO) ReadStr() (s string) {
	return string(myio.ReadBytes())
}

func (myio *MyIO) Flush() {
	myio.out.Flush()
}

func (myio *MyIO) Printf(format string, a ...any) (n int, err error) {
	return fmt.Fprintf(myio.out, format, a...)
}

func (myio *MyIO) Println(a ...any) (n int, err error) {
	return fmt.Fprintln(myio.out, a...)
}

func (myio *MyIO) Print(a ...any) (n int, err error) {
	return fmt.Fprint(myio.out, a...)
}

var myio *MyIO

func ri() int {
	return myio.ReadInt()
}

func ri64() int64 {
	return myio.ReadInt64()
}

func ria(_n int) []int {
	a := make([]int, _n)
	for i := range a {
		a[i] = ri()
	}
	return a
}

/* End of MyIO */

func sol() {
	b := make([][]byte, 8)
	for i := 0; i < 8; i++ {
		b[i] = myio.ReadBytes()
	}
	for i := 1; i < 8; i++ {
		for j := 1; j < 8; j++ {
			if b[i][j] == '#' && b[i-1][j-1] == '#' && b[i-1][j+1] == '#' && b[i+1][j-1] == '#' && b[i+1][j+1] == '#' {
				fmt.Println(i+1, j+1)
				return
			}
		}
	}
}

func main() {
	debug.SetGCPercent(-1)
	in, out := os.Stdin, os.Stdout
	myio = NewIO(in, out)
	defer myio.Flush()

	var t = 1
	t = ri()
	for ; t > 0; t-- {
		sol()
	}
}

package main

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

// https://space.bilibili.com/206214/dynamic
func run(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()
	dir4 := []struct{ x, y int }{{-1, -1}, {1, 1}, {1, -1}, {-1, 1}}
	solve := func(curCase int) {
		a := make([]string, 8)
		for i := range a {
			Fscan(in, &a[i])
		}
		for i := 1; i < 7; i++ {
			o:for j := 1; j < 7; j++ {

				for _, d := range dir4 {
					x ,y := i,j
					for x >=0&&x<8 && y>=0&&y<8 {
						if a[x][y] == '.' {
							continue o
						}
						x+=d.x
						y+=d.y
					}
				}
				Fprintln(out, i+1,j+1)
				return
			}
		}
	}

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

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

}

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

package main

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

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

func slove() {
	board := make([]string, 8)
	ans_i, ans_j := 0, 0
	flag, flag1 := false, false
	for i := range board {
		fmt.Fscan(r, &board[i])
		cnt := 0
		x, y := i, 0
		for j := range board {
			if board[i][j] == '#' {
				cnt++
				y = j
			}
		}
		if cnt == 1 && flag && !flag1 {
			ans_i, ans_j = x, y
			flag1 = true
		} else {
			flag = true
		}
	}
	fmt.Fprintln(w, ans_i+1, ans_j+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"
)

// github.com/EndlessCheng/codeforces-go
type seg []struct {
	l, r int
	val  int64
}

func (t seg) build(o, l, r int) {
	t[o].l, t[o].r = l, r
	if l == r {
		return
	}
	m := (l + r) >> 1
	t.build(o<<1, l, m)
	t.build(o<<1|1, m+1, r)
}

func (t seg) update(o, i int, val int64) {
	if t[o].l == t[o].r {
		t[o].val = val
		return
	}
	m := (t[o].l + t[o].r) >> 1
	if i <= m {
		t.update(o<<1, i, val)
	} else {
		t.update(o<<1|1, i, val)
	}
	t[o].val = max(t[o<<1].val, t[o<<1|1].val)
}

func (t seg) query(o, l, r int) (res int64) {
	if l <= t[o].l && t[o].r <= r {
		return t[o].val
	}
	m := (t[o].l + t[o].r) >> 1
	if r <= m {
		return t.query(o<<1, l, r)
	}
	if m < l {
		return t.query(o<<1|1, l, r)
	}
	return max(t.query(o<<1, l, r), t.query(o<<1|1, l, r))
}

func CF1483C(_r io.Reader, out io.Writer) {
	in := bufio.NewReader(_r)
	var n, v int
	Fscan(in, &n)
	posL := make([]int, n)
	type pair struct{ v, i int }
	s := []pair{{0, -1}}
	for i := range posL {
		Fscan(in, &v)
		for s[len(s)-1].v > v {
			s = s[:len(s)-1]
		}
		posL[i] = s[len(s)-1].i
		s = append(s, pair{v, i})
	}

	dp := make([]int64, n)
	t := make(seg, 4*n)
	t.build(1, 1, n)
	for i, l := range posL {
		if Fscan(in, &v); i == 0 {
			dp[i] = int64(v)
		} else if l < 0 {
			dp[i] = max(0, t.query(1, 1, i)) + int64(v)
		} else {
			dp[i] = max(dp[l], t.query(1, l+1, i)+int64(v))
		}
		t.update(1, i+1, dp[i])
	}
	Fprint(out, dp[n-1])
}

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

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

package main

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

// github.com/EndlessCheng/codeforces-go
type seg []struct {
	l, r int
	val  int64
}

func (t seg) build(o, l, r int) {
	t[o].l, t[o].r = l, r
	if l == r {
		return
	}
	m := (l + r) >> 1
	t.build(o<<1, l, m)
	t.build(o<<1|1, m+1, r)
}

func (t seg) update(o, i int, val int64) {
	if t[o].l == t[o].r {
		t[o].val = val
		return
	}
	m := (t[o].l + t[o].r) >> 1
	if i <= m {
		t.update(o<<1, i, val)
	} else {
		t.update(o<<1|1, i, val)
	}
	t[o].val = max(t[o<<1].val, t[o<<1|1].val)
}

func (t seg) query(o, l, r int) (res int64) {
	if l <= t[o].l && t[o].r <= r {
		return t[o].val
	}
	m := (t[o].l + t[o].r) >> 1
	if r <= m {
		return t.query(o<<1, l, r)
	}
	if m < l {
		return t.query(o<<1|1, l, r)
	}
	return max(t.query(o<<1, l, r), t.query(o<<1|1, l, r))
}

func CF1483C(_r io.Reader, out io.Writer) {
	in := bufio.NewReader(_r)
	var n, v int
	Fscan(in, &n)
	posL := make([]int, n)
	type pair struct{ v, i int }
	s := []pair{{0, -1}}
	for i := range posL {
		Fscan(in, &v)
		for s[len(s)-1].v > v {
			s = s[:len(s)-1]
		}
		posL[i] = s[len(s)-1].i
		s = append(s, pair{v, i})
	}

	dp := make([]int64, n)
	t := make(seg, 4*n)
	t.build(1, 1, n)
	Fscan(in, &v)
	dp[0] = int64(v)
	t.update(1, 1, int64(v))
	for i := 1; i < n; i++ {
		Fscan(in, &v)
		if l := posL[i]; l < 0 {
			dp[i] = max(0, t.query(1, 1, i)) + int64(v)
		} else {
			dp[i] = max(dp[l], t.query(1, l+1, i)+int64(v))
		}
		t.update(1, i+1, dp[i])
	}
	Fprint(out, dp[n-1])
}

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

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

package main

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

// github.com/EndlessCheng/codeforces-go
type seg []struct {
	l, r int
	val  int64
}

func (t seg) build(o, l, r int) {
	t[o].l, t[o].r, t[o].val = l, r, -1e18
	if l == r {
		return
	}
	m := (l + r) >> 1
	t.build(o<<1, l, m)
	t.build(o<<1|1, m+1, r)
}

func (t seg) update(o, i int, val int64) {
	if t[o].l == t[o].r {
		t[o].val = val
		return
	}
	m := (t[o].l + t[o].r) >> 1
	if i <= m {
		t.update(o<<1, i, val)
	} else {
		t.update(o<<1|1, i, val)
	}
	t[o].val = max(t[o<<1].val, t[o<<1|1].val)
}

func (t seg) query(o, l, r int) (res int64) {
	if l <= t[o].l && t[o].r <= r {
		return t[o].val
	}
	m := (t[o].l + t[o].r) >> 1
	if r <= m {
		return t.query(o<<1, l, r)
	}
	if m < l {
		return t.query(o<<1|1, l, r)
	}
	return max(t.query(o<<1, l, r), t.query(o<<1|1, l, r))
}

func CF1483C(_r io.Reader, out io.Writer) {
	in := bufio.NewReader(_r)
	var n int
	Fscan(in, &n)
	posL := make([]int, n)
	type pair struct{ v, i int }
	s := []pair{{0, -1}}
	h := make([]int, n)
	for i := range h {
		Fscan(in, &h[i])
		for {
			if top := s[len(s)-1]; top.v < h[i] {
				posL[i] = top.i
				break
			}
			s = s[:len(s)-1]
		}
		s = append(s, pair{h[i], i})
	}

	t := make(seg, 4*n)
	t.build(1, 1, n)
	var v int64
	dp := make([]int64, n)
	Fscan(in, &v)
	dp[0] = v
	t.update(1, 1, v)
	for i := 1; i < n; i++ {
		l := posL[i]
		var v int64
		Fscan(in, &v)
		if l < 0 {
			dp[i] = max(0, t.query(1, 1, i)) + v
		} else {
			dp[i] = max(dp[l], t.query(1, l+1, i)+v)
		}
		t.update(1, i+1, dp[i])
	}
	Fprint(out, dp[n-1])
}

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

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

package main

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

// github.com/EndlessCheng/codeforces-go
type seg []struct {
	l, r int
	val  int64
}

func (t seg) build(o, l, r int) {
	t[o].l, t[o].r, t[o].val = l, r, -1e18
	if l == r {
		return
	}
	m := (l + r) >> 1
	t.build(o<<1, l, m)
	t.build(o<<1|1, m+1, r)
}

func (t seg) update(o, i int, val int64) {
	if t[o].l == t[o].r {
		t[o].val = val
		return
	}
	m := (t[o].l + t[o].r) >> 1
	if i <= m {
		t.update(o<<1, i, val)
	} else {
		t.update(o<<1|1, i, val)
	}
	t[o].val = max(t[o<<1].val, t[o<<1|1].val)
}

func (t seg) query(o, l, r int) (res int64) {
	if l <= t[o].l && t[o].r <= r {
		return t[o].val
	}
	m := (t[o].l + t[o].r) >> 1
	if r <= m {
		return t.query(o<<1, l, r)
	}
	if m < l {
		return t.query(o<<1|1, l, r)
	}
	return max(t.query(o<<1, l, r), t.query(o<<1|1, l, r))
}

func CF1483C(_r io.Reader, out io.Writer) {
	in := bufio.NewReader(_r)
	var n, miI int
	Fscan(in, &n)
	posL := make([]int, n)
	type pair struct{ v, i int }
	s := []pair{{0, -1}}
	h := make([]int, n)
	for i := range h {
		Fscan(in, &h[i])
		if h[i] < h[miI] {
			miI = i
		}
		for {
			if top := s[len(s)-1]; top.v < h[i] {
				posL[i] = top.i
				break
			}
			s = s[:len(s)-1]
		}
		s = append(s, pair{h[i], i})
	}

	t := make(seg, 4*n)
	t.build(1, 1, n)
	var v int64
	dp := make([]int64, n)
	Fscan(in, &v)
	dp[0] = v
	t.update(1, 1, v)
	for i := 1; i < n; i++ {
		l := posL[i]
		var v int64
		Fscan(in, &v)
		if l < 0 {
			mx := t.query(1, 1, i)
			if mx > 0 {
				v += mx
			}
			dp[i] = v
		} else {
			mx := t.query(1, l+1, i)
			if v > 0 {
				mx += v
			}
			dp[i] = mx
		}
		t.update(1, i+1, dp[i])
	}
	Fprint(out, dp[n-1])
}

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

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


package main

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

func main() {
	const lim = 1_000_000
	in := bufio.NewReader(os.Stdin)

	var n, m int
	fmt.Fscan(in, &n, &m)
	a, b := make([][3]int, n), make([][3]int, m)
	for i := 0; i < n; i++ {
		var x, y, z int
		fmt.Fscan(in, &x, &y, &z)
		a[i] = [3]int{x, y, z}
	}
	for i := 0; i < m; i++ {
		var x, y, z int
		fmt.Fscan(in, &x, &y, &z)
		b[i] = [3]int{x, y, z}
	}

	ans := int64(1)
	add, rem, vseg := make([][]int, lim+1), make([][]int, lim+1), make([][2]int, lim+1)
	for _, h := range a {
		y, x1, x2 := h[0], h[1], h[2]
		if x1 == 0 && x2 == lim {
			ans++
		}
		add[x1] = append(add[x1], y)
		rem[x2] = append(rem[x2], y)
	}
	for _, v := range b {
		x, y1, y2 := v[0], v[1], v[2]
		if y1 == 0 && y2 == lim {
			ans++
		}
		vseg[x] = [2]int{y1, y2}
	}
	upd, qry := Fenwick(lim + 1)
	for i := 0; i < lim; i++ {
		for _, y := range add[i] {
			upd(y, +1)
		}
		if vseg[i][1] != 0 {
			ans += int64(qry(vseg[i][1]) - qry(vseg[i][0]-1))
		}
		for _, y := range rem[i] {
			upd(y, -1)
		}
	}

	fmt.Println(ans)
}

func Fenwick(n int) (upd func(int, int), qry func(int) int) {
	a := make([]int, n+1)
	return func(i, v int) {
			for i++; i < n; i += i & -i {
				a[i] += v
			}
		},
		func(i int) (s int) {
			for i++; i > 0; i -= i & -i {
				s += a[i]
			}
			return
		}
}

package main

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

func main() {
	io := NewFastIO(os.Stdin, os.Stdout)
	defer io.Flush()
	const lim = 1_000_000

	n, m := io.NextInt(), io.NextInt()
	a, b := make([][]int, n), make([][]int, m)
	for i := 0; i < n; i++ {
		a[i] = io.NextInts(3)
	}
	for i := 0; i < m; i++ {
		b[i] = io.NextInts(3)
	}

	ans := int64(1)
	add, rem, vseg := make([][]int, lim+1), make([][]int, lim+1), make([][2]int, lim+1)
	for _, h := range a {
		y, x1, x2 := h[0], h[1], h[2]
		if x1 == 0 && x2 == lim {
			ans++
		}
		add[x1] = append(add[x1], y)
		rem[x2] = append(rem[x2], y)
	}
	for _, v := range b {
		x, y1, y2 := v[0], v[1], v[2]
		if y1 == 0 && y2 == lim {
			ans++
		}
		vseg[x] = [2]int{y1, y2}
	}
	upd, qry := Fenwick(lim + 1)
	for i := 0; i < lim; i++ {
		for _, y := range add[i] {
			upd(y, +1)
		}
		if vseg[i][1] != 0 {
			ans += int64(qry(vseg[i][1]) - qry(vseg[i][0]-1))
		}
		for _, y := range rem[i] {
			upd(y, -1)
		}
	}

	fmt.Println(ans)
}

func Fenwick(n int) (upd func(int, int), qry func(int) int) {
	a := make([]int, n+1)
	return func(i, v int) {
			for i++; i < n; i += i & -i {
				a[i] += v
			}
		},
		func(i int) (s int) {
			for i++; i > 0; i -= i & -i {
				s += a[i]
			}
			return
		}
}

type FastIO struct {
	*bufio.Writer
	r    io.Reader
	buf  [8192]byte
	i, n int
}

func NewFastIO(r io.Reader, w io.Writer) *FastIO {
	return &FastIO{r: r, Writer: bufio.NewWriter(w)}
}

func (f *FastIO) readC() byte {
	if f.i == f.n {
		f.n, _ = f.r.Read(f.buf[:])
		if f.n == 0 {
			panic("EOF")
		}
		f.i = 0
	}
	f.i++
	return f.buf[f.i-1]
}

func (f *FastIO) NextInt() int {
	c := f.readC()
	for ; c <= ' '; c = f.readC() {
	}
	neg := false
	if c == '-' {
		neg = true
		c = f.readC()
	}
	n := 0
	for ; '0' <= c && c <= '9'; c = f.readC() {
		n = n*10 + int(c) - '0'
	}
	if neg {
		return -n
	}
	return n
}

func (f *FastIO) NextInts(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = f.NextInt()
	}
	return a
}

func (f *FastIO) Println(a ...interface{}) {
	fmt.Fprintln(f, a...)
}