You are given two integers $$$a$$$ and $$$b$$$. In one turn, you can do one of the following operations:   Take an integer $$$c$$$ ($$$c > 1$$$ and $$$a$$$ should be divisible by $$$c$$$) and replace $$$a$$$ with $$$\frac{a}{c}$$$;  Take an integer $$$c$$$ ($$$c > 1$$$ and $$$b$$$ should be divisible by $$$c$$$) and replace $$$b$$$ with $$$\frac{b}{c}$$$. Your goal is to make $$$a$$$ equal to $$$b$$$ using exactly $$$k$$$ turns.For example, the numbers $$$a=36$$$ and $$$b=48$$$ can be made equal in $$$4$$$ moves:   $$$c=6$$$, divide $$$b$$$ by $$$c$$$ $$$\Rightarrow$$$ $$$a=36$$$, $$$b=8$$$;  $$$c=2$$$, divide $$$a$$$ by $$$c$$$ $$$\Rightarrow$$$ $$$a=18$$$, $$$b=8$$$;  $$$c=9$$$, divide $$$a$$$ by $$$c$$$ $$$\Rightarrow$$$ $$$a=2$$$, $$$b=8$$$;  $$$c=4$$$, divide $$$b$$$ by $$$c$$$ $$$\Rightarrow$$$ $$$a=2$$$, $$$b=2$$$. For the given numbers $$$a$$$ and $$$b$$$, determine whether it is possible to make them equal using exactly $$$k$$$ turns.

The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$). Then $$$t$$$ test cases follow. Each test case is contains three integers $$$a$$$, $$$b$$$ and $$$k$$$ ($$$1 \le a, b, k \le 10^9$$$).

For each test case output:    "Yes", if it is possible to make the numbers $$$a$$$ and $$$b$$$ equal in exactly $$$k$$$ turns;  "No" otherwise.  The strings "Yes" and "No" can be output in any case.

package main

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

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
const N = 1e5 + 7
var prime = []int{}
var v = [N]bool{}
func shai(){
	for i := 2; i < N; i ++ {
		if !v[i] {
			prime = append(prime, i)
			for j := i * 2; j < N; j += i {
				v[j] = true
			}
		}

	}
}
func cal(g int)int {
	res := 0
	for _, i := range prime {
		if g % i == 0 {
			for {
				if g % i != 0 {
					break
				}
				g /= i
				res ++
			}
		}
	}
	if g > 1 {
		res ++
	}
	return res
}
func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	shai()
	t := 0
	fmt.Scan(&t)
	for i := 0; i < t; i ++ {
		solve := func() {
			var a, b, k int
			fmt.Fscan(in, &a, &b, &k)
			if k == 1 {
				if a != b && (a % b == 0 || b % a == 0) {
					fmt.Fprintln(out,"YES")
				} else {
					fmt.Fprintln(out, "NO")
				}
				return
			}
			res := 0
			res += cal(a) + cal(b)
			if k <= res {
				fmt.Fprintln(out,"YES")
			} else {
				fmt.Fprintln(out,"NO")
			}
		}
		solve()
	}
}

package main

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

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

	ola()

	var t, minn, maxx, a, b, k int
	Fscan(reader, &t)
	for ;t > 0;t -- {
		Fscan(reader, &a, &b, &k)

		if a == b && k == 1 {
			Fprintln(writer, "NO");
			continue
		}

		if a == b {
			minn = 0
		}else if lcm(a, b) == a || lcm(a, b) == b {
			minn = 1
		}else {
			minn = 2
		}

		maxx = 0

		for _, i := range primes {
			if i * i > a {
				break
			}
			for ;a % i == 0;a /= i {
				maxx ++
			}
		}
		for _, i := range primes {
			if i * i > b {
				break
			}
			for ;b % i == 0;b /= i {
				maxx ++
			}
		}

		if a > 1 {
			maxx ++
		}
		if b > 1 {
			maxx ++
		}

		if k <= maxx && k >= minn {
			Fprintln(writer, "YES");
		}else {
			Fprintln(writer, "NO");
		}

	}
}

const Limit = 4e4 + 10
var primes, isPrime, phi = []int{}, [Limit]bool{}, [Limit]int{}

func ola() {
	n := int(Limit - 5)
	phi[1] = 1
	for i := 2;i <= n;i ++ {
		if !isPrime[i] {
			primes = append(primes, i)
			phi[i] = i - 1
		}
		for _, p := range primes {
			if i * p > n {
				break
			}
			isPrime[i * p] = true
			if i % p == 0 {
				phi[i * p] = phi[i] * p
				break
			}
			phi[i * p] = phi[i] * (p - 1)
		}
	}
}

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 gcd(a, b int) int {
	if b > 0 {
		return gcd(b, a%b)
	}
	return a
}
func lcm(a, b int) int { return a / gcd(a, b) * b }

package main

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

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

	getPrimes()

	var t, minn, maxx, a, b, k int
	Fscan(reader, &t)
	for ;t > 0;t -- {
		Fscan(reader, &a, &b, &k)

		if a == b && k == 1 {
			Fprintln(writer, "NO");
			continue
		}

		if a == b {
			minn = 0
		}else if lcm(a, b) == a || lcm(a, b) == b {
			minn = 1
		}else {
			minn = 2
		}

		maxx = 0

		for _, i := range primes {
			if i * i > a {
				break
			}
			for ;a % i == 0;a /= i {
				maxx ++
			}
		}
		for _, i := range primes {
			if i * i > b {
				break
			}
			for ;b % i == 0;b /= i {
				maxx ++
			}
		}

		if a > 1 {
			maxx ++
		}
		if b > 1 {
			maxx ++
		}

		if k <= maxx && k >= minn {
			Fprintln(writer, "YES");
		}else {
			Fprintln(writer, "NO");
		}

	}
}

const Limit = 4e4

var primes = []int{}

func getPrimes() {
	isPrime := [Limit]bool{}
	isPrime[0] = false
	isPrime[1] = false
	for i := 2; i < Limit; i++ {
		isPrime[i] = true
	}
	for i := 2; i < Limit; i++ {
		if !isPrime[i] {
			continue
		}
		primes = append(primes, i)
		for j := i * i; j < Limit; j += i {
			isPrime[j] = false
		}
	}
}

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 gcd(a, b int) int {
	if b > 0 {
		return gcd(b, a%b)
	}
	return a
}
func lcm(a, b int) int { return a / gcd(a, b) * b }

package main

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

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

	getPrimes()

	var t, minn, maxx int
	Fscan(reader, &t)
	for ;t > 0;t -- {
		var a, b, k int
		Fscan(reader, &a, &b, &k)

		if a == b && k == 1 {
			Fprintln(writer, "NO");
			continue
		}

		if a == b {
			minn = 0
		}else if lcm(a, b) == a || lcm(a, b) == b {
			minn = 1
		}else {
			minn = 2
		}

		maxx = 0

		for _, i := range primes {
			if i * i > a {
				break
			}
			for ;a % i == 0;a /= i {
				maxx ++
			}
		}
		for _, i := range primes {
			if i * i > b {
				break
			}
			for ;b % i == 0;b /= i {
				maxx ++
			}
		}

		if a > 1 {
			maxx ++
		}
		if b > 1 {
			maxx ++
		}

		if k <= maxx && k >= minn {
			Fprintln(writer, "YES");
		}else {
			Fprintln(writer, "NO");
		}

	}
}

const Limit = 1e5

var primes = []int{}

func getPrimes() {
	isPrime := [Limit]bool{}
	isPrime[0] = false
	isPrime[1] = false
	for i := 2; i < Limit; i++ {
		isPrime[i] = true
	}
	for i := 2; i < Limit; i++ {
		if !isPrime[i] {
			continue
		}
		primes = append(primes, i)
		for j := i * i; j < Limit; j += i {
			isPrime[j] = false
		}
	}
}

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 gcd(a, b int) int {
	if b > 0 {
		return gcd(b, a%b)
	}
	return a
}
func lcm(a, b int) int { return a / gcd(a, b) * b }

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := os.Stdout
	var t int
	fmt.Fscan(in,&t)
	primes := []int{}
	isp := [50005]bool{}
	for i:=0;i<50000;i++{
		isp[i]=true
	}
	for i:=2;i*i<50000;i++{
		for j := i*i; j<50000;j+=i{
			isp[j]=false
		}
	}
	for i:=2;i<50000;i++{
		if isp[i]{
			primes = append(primes,i)
		}
	}
	for u:=1;u<=t;u++{
		var a, b , k int
		fmt.Fscan(in,&a,&b,&k)
		ta := a
		tb := b
		acnt:=0
		for i:=0;i<len(primes);i++{
			if primes[i]*primes[i]>a{
				break
			}
			for a%primes[i]==0{
				a/=primes[i]
				acnt++
			}
		}
		if a!=1{
			acnt++
		}
		bcnt :=0
		for i:=0;i<len(primes);i++{
			if primes[i]*primes[i]>b{
				break
			}
			for b%primes[i]==0{
				b/=primes[i]
				bcnt++
			}
		}
		if b!=1{
			bcnt++
		}
		n := bcnt + acnt
		var m int
		a =ta
		b =tb
		if a==b{
			m = 0
		}else if a%b==0||b%a==0{
			m = 1
		}else{
			m = 2
		}
		if (m<=k && k<=n && k==1 && m==1)||(m<=k&&k<=n&&k!=1){
			fmt.Fprintln(out,"Yes")
		}else{
			fmt.Fprintln(out,"No")
		}
	}
}

package main

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

func main() {

	read := bufio.NewReader(os.Stdin)

	var t int

	fmt.Fscan(read, &t)

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

		var a, b, k int
		fmt.Fscan(read, &a, &b, &k)

		fmt.Println(solve(a, b , k))
	}
}

func solve (a, b, k int) string {
	pfsa := PrimeFactors(a)
	pfsb := PrimeFactors(b)

	if len(pfsa) == 0 && len(pfsb) == 0 {
		return "NO"
	}
	if a == b && k == 1 {
		return "NO"
	}

	if len(pfsa) == 0 {

		var  s int

		for _, v := range pfsb {
			s += v
		}

		if s >= k {
			return "YES"
		}else {
			return "NO"
		}
	}

	if len(pfsb) == 0 {

		var  s int

		for _, v := range pfsa {
			s += v
		}

		if s >= k {
			return "YES"
		}else {
			return "NO"
		}
	}

	g  := gcd(a, b)

	var min int
	if a/g != 1 {
		min++
	}
	if b/g != 1 {
		min++
	}

	if k < min {
		return "NO"
	}

	var s int

	for _ , v := range pfsa {
		s += v
	}

	for _ , v := range pfsb {
		s += v
	}

	if k > s {
		return "NO"
	}

	return "YES"

}

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

func PrimeFactors(n int) (pfs map[int]int) {
	pfs = make(map[int]int)

	// Get the number of 2s that divide n
	for n%2 == 0 {
		if _, ok := pfs[2]; ok {
			pfs[2] += 1
		} else {
			pfs[2] = 1
		}
		n = n / 2
	}

	// n must be odd at this point. so we can skip one element
	// (note i = i + 2)
	for i := 3; i*i <= n; i = i + 2 {
		// while i divides n, append i and divide n
		for n%i == 0 {
			if _, ok := pfs[i]; ok {
				pfs[i] += 1
			} else {
				pfs[i] = 1
			}
			n = n / i
		}
	}

	// This condition is to handle the case when n is a prime number
	// greater than 2
	if n > 2 {
		pfs[n] = 1
	}

	return
}

package main

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

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

	var t int
	fmt.Fscan(reader, &t)

	var a, b, k int
	for ; t > 0; t-- {
		fmt.Fscan(reader, &a, &b, &k)

		if a < b {
			a, b = b, a
		}

		if k == 1 && a/b > 1 && a%b == 0 || k > 1 && cntFactor(a)+cntFactor(b) >= k {
			fmt.Fprintln(writer, "YES")
		} else {
			fmt.Fprintln(writer, "NO")
		}
	}
}

func init() {
	getPrimes()
}

const Limit = 4 * 1e4

var primes = []int{}

func getPrimes() {
	isPrime := [Limit]bool{}
	isPrime[0] = false
	isPrime[1] = false
	for i := 2; i < Limit; i++ {
		isPrime[i] = true
	}
	for i := 2; i < Limit; i++ {
		if !isPrime[i] {
			continue
		}
		primes = append(primes, i)
		for j := i * i; j < Limit; j += i {
			isPrime[j] = false
		}
	}
}

func cntFactor(n int) int {
	out := 0
	for _, i := range primes {
		if i*i > n {
			break
		}
		for ; n%i == 0; n /= i {
			out++
		}
	}
	if n != 1 {
		out++
	}
	return out
}

package main

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

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

	var t int
	fmt.Fscan(reader, &t)

	var a, b, k int
	for ; t > 0; t-- {
		fmt.Fscan(reader, &a, &b, &k)

		if a < b {
			a, b = b, a
		}

		if k == 1 && a/b > 1 && a%b == 0 || k > 1 && cntPrime(a)+cntPrime(b) >= k {
			fmt.Fprintln(writer, "YES")
		} else {
			fmt.Fprintln(writer, "NO")
		}
	}
}

func cntPrime(n int) int {
	out := 0
	for i := 2; i*i <= n; i++ {
		for ; n%i == 0; n /= i {
			out++
		}
	}
	if n != 1 {
		out++
	}
	return out
}

package main

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

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

	var t int
	fmt.Fscan(reader, &t)

	var a, b, k int
	for ; t > 0; t-- {
		fmt.Fscan(reader, &a, &b, &k)

		if a < b {
			a, b = b, a
		}

		if k == 1 && a/b > 1 && a%b == 0 || k > 1 && cntPrime(a)+cntPrime(b) >= k {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

func cntPrime(n int) int {
	out := 0
	for i := 2; i*i <= n; i++ {
		for ; n%i == 0; n /= i {
			out++
		}
	}
	if n != 1 {
		out++
	}
	return out
}

package main

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

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

	var T, a, b, k int
	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &a, &b, &k)
		if k == 1 && a == b {
			Fprintln(out, "NO")
			continue
		}
		g := gcd(a, b)
		mi := 0
		if g < a {
			mi++
		}
		if g < b {
			mi++
		}
		if mi <= k && k <= f(a)+f(b) {
			Fprintln(out, "YES")
		} else {
			Fprintln(out, "NO")
		}
	}
}

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

func f(x int) (c int) {
	for i := 2; i*i <= x; i++ {
		for ; x%i == 0; x /= i {
			c++
		}
	}
	if x > 1 {
		c++
	}
	return
}

func gcd(a, b int) int {
	for a != 0 {
		a, b = b%a, a
	}
	return b
}

package main

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

// github.com/EndlessCheng/codeforces-go
func run(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()
	f := func(x int) (c int) {
		for i := 2; i*i <= x; i++ {
			for ; x%i == 0; x /= i {
				c++
			}
		}
		if x > 1 {
			c++
		}
		return
	}
	solve := func(Case int) {
		var a, b, k int
		Fscan(in, &a, &b, &k)
		if a==b && k == 1 {
			Fprintln(out, "NO")
			return
		}
		g := gcd(a, b)
		mi := 0
		if g != a {
			mi++
		}
		if g != b {
			mi++
		}
		mx := f(a) + f(b)
		if mi <= k && k <= mx {
			Fprintln(out, "YES")
		} else {
			Fprintln(out, "NO")
		}
	}

	T := 1
	Fscan(in, &T) //
	for Case := 1; Case <= T; Case++ {
		solve(Case)
	}

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

func main() { run(os.Stdin, os.Stdout) }
func gcd(a, b int) int {
	for a != 0 {
		a, b = b%a, a
	}
	return b
}

package main

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

func run(r io.Reader, w io.Writer) {
	in := bufio.NewReader(r)
	out := bufio.NewWriter(w)
	defer out.Flush()

	type pair struct {
		x, y int
	}
	var t int
	for Fscan(in, &t); t > 0; t-- {
		var a, b, k int
		Fscan(in, &a, &b, &k)

		fac1 := decomposition(a)
		fac2 := decomposition(b)
		if len(fac2) + len(fac1) < k {
			Fprintln(out, "NO")

		} else if k == 1 && ((b % a != 0 && a % b != 0) || a == b) {
			Fprintln(out, "NO")

		} else {
			Fprintln(out, "YES")
		}
	}
}

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

func decomposition(a int) []int {
	if a == 1 {
		return nil
	}
	var res []int
	for p := 2; a >= p * p; {
		if a % p == 0 {
			a /= p
			res = append(res, p)
		} else {
			p++
		}
	}
	res = append(res, a)
	return res
}

package main

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

func Readln(r *bufio.Reader) (string, error) {
	var (
		isPrefix bool  = true
		err      error = nil
		line, ln []byte
	)
	for isPrefix && err == nil {
		line, isPrefix, err = r.ReadLine()
		ln = append(ln, line...)
	}
	return string(ln), err
}

func getpfactors(n int64) [] int64 {

	pfactors := make([] int64,0)
	inc:= [] int64 {4,2,4,2,4,6,2,6}
	for n%2==0 {
		pfactors = append(pfactors,2)
		n = n / 2
	}
	for n%3==0 {
		pfactors = append(pfactors,3)
		n = n / 3
	}
	for n%5==0 {
		pfactors = append(pfactors,5)
		n = n / 5
	}
	k := int64(7); i := 0

	for k * k <= n {
		if n%k==0{
			pfactors = append(pfactors, k)
			n = n / k
		} else
		{
			k = k + inc[i]
			if i < 7 {i = i + 1} else {i = 0}
		}
	}

	return append(pfactors,n)

}

func main() {
	reader := bufio.NewReader(os.Stdin)
	pk, _ := Readln(reader)
	k, _ := strconv.Atoi(pk)
	for oi := 0; oi < k; oi++ {
		// this problem is equivalent to reducing both numbers to 1 in k moves
		// unless k = 1, then we check whether one number divides the other
		pln,_ := Readln(reader)
		ln := strings.Split(pln, " ")
		a, _ := strconv.ParseInt(ln[0], 10, 64)
		b, _ := strconv.ParseInt(ln[1], 10, 64)
		k, _ := strconv.ParseInt(ln[2], 10, 64)

		if k == 1 {
			if a == 1 && b == 1 {
				fmt.Println("NO")
				continue
			}
			if a != b && (a % b ==0 || b % a  == 0) {
				fmt.Println("YES")
				continue
			}
			fmt.Println("NO")
			continue
		}

		factorsa := getpfactors(a)
		factorsb := getpfactors(b)

		tot := int64(0)
		for _, v:= range factorsa {
			if v!=1 {
				tot++
			}
		}
		for _, v:= range factorsb {
			if v!=1 {
				tot++
			}
		}

		if tot - k < 0  {
			fmt.Println("NO")
			continue
		}

		fmt.Println("YES")

	}

}

package main

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

const MAX int = 40000

var prime []int

func init() {
	runSieve()
}

func runSieve() {
	sieve := [MAX]bool{}
	sieve[0] = false
	sieve[1] = false
	for i := 2; i < MAX; i++ {
		sieve[i] = true
	}
	for i := 2; i < MAX; i++ {
		if sieve[i] {
			prime = append(prime, i)
			for j := i * i; j < MAX; j += i {
				sieve[j] = false
			}
		}
	}
}

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	calculate := func(n int) int {
		ans := 0
		for _, i := range prime {
			if i*i > n {
				break
			}
			if n%i != 0 {
				continue
			}
			for n%i == 0 {
				ans++
				n /= i
			}
		}
		if n > 1 {
			ans++
		}
		return ans
	}

	solve := func(Case int) {
		var a, b, k int
		fmt.Fscan(in, &a, &b, &k)
		g := gcd(a, b)
		if k == 1 {
			if a == b || (g != a && g != b) {
				fmt.Fprintln(out, "NO")
				return
			}
			fmt.Fprintln(out, "YES")
			return
		}

		if calculate(a/g)+calculate(b/g)+2*calculate(g) >= k {
			fmt.Fprintln(out, "YES")
		} else {
			fmt.Fprintln(out, "NO")
		}
	}

	T := 1
	fmt.Fscan(in, &T) //
	for Case := 1; Case <= T; Case++ {
		solve(Case)
	}
}

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

func min(a []int) int {
	mn := int(1e9)
	for i := range a {
		if a[i] < mn {
			mn = a[i]
		}
	}
	return mn
}
func gcd(x, y int) int {
	for y != 0 {
		x, y = y, x%y
	}
	return x
}

func reverse(s []byte) []byte {
	a := []byte(s)
	for i, j := 0, len(a)-1; i < j; i, j = i+1, j-1 {
		a[i], a[j] = a[j], a[i]
	}
	return a
}

package main

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

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	t := 0
	fmt.Scan(&t)
	for i := 0; i < t; i ++ {
		solve := func() {
			var a, b, k int
			fmt.Fscan(in, &a, &b, &k)
			if k >= 1000 {
				fmt.Println("NO")
				return
			}
			if k == 1 {
				if a != b && (a % b == 0 || b % a == 0) {
					fmt.Println("YES")
				} else {
					fmt.Println("NO")
				}
				return
			}
			res := 0
			cal := func(g int)int {
				res := 0
				for i := 2; i <= g / i; i += 2 {
					if g % i == 0 {
						for {
							if g % i != 0 {
								break
							}
							g /= i
							res ++
						}
					}
				}
				if g > 1 {
					res ++
				}
				return res
			}
			res += cal(a) + cal(b)
			if k <= res {
				fmt.Println("YES")
			} else {
				fmt.Println("NO")
			}
		}
		solve()
	}
}

package main

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

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	t := 0
	fmt.Scan(&t)
	for i := 0; i < t; i ++ {
		solve := func() {
			var a, b, k int
			fmt.Fscan(in, &a, &b, &k)
			if k >= 1000 {
				fmt.Println("NO")
				return
			}
			if k == 1 {
				if a % b == 0 || b % a == 0 {
					fmt.Println("YES")
				} else {
					fmt.Println("NO")
				}
				return
			}
			res := 0
			cal := func(g int)int {
				res := 0
				for i := 2; i <= g / i; i += 2 {
					if g % i == 0 {
						for {
							if g % i != 0 {
								break
							}
							g /= i
							res ++
						}
					}
				}
				if g > 1 {
					res ++
				}
				return res
			}
			res += cal(a) + cal(b)
			if k <= res {
				fmt.Println("YES")
			} else {
				fmt.Println("NO")
			}
		}
		solve()
	}
}

package main

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

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	t := 0
	fmt.Scan(&t)
	for i := 0; i < t; i ++ {
		solve := func() {
			var a, b, k int
			fmt.Fscan(in, &a, &b, &k)
			if k >= 1000 {
				fmt.Println("NO")
				return
			}
			if a == b {
				fmt.Println("NO")
				return
			}
			if k == 1 {
				if a % b == 0 || b % a == 0 {
					fmt.Println("YES")
				} else {
					fmt.Println("NO")
				}
				return
			}
			res := 0
			cal := func(g int)int {
				res := 0
				for i := 2; i <= g / i; i ++ {
					if g % i == 0 {
						for {
							if g % i != 0 {
								break
							}
							g /= i
							res ++
						}
					}
				}
				if g > 1 {
					res ++
				}
				return res
			}
			res += cal(a) + cal(b)
			if k <= res {
				fmt.Println("YES")
			} else {
				fmt.Println("NO")
			}
		}
		solve()
	}
}

package main

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

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
/*const N = 200010
var a [N]int
func lowbit(x int) int {
	return x & -x
}
func add(x, y int) {
	for {
		if x >= N {
			break
		}
		a[x] += y
		x += lowbit(x)
	}
}
func get(x int) int {
	ans := 0
	for {
		if x <= 0 {
			break
		}
		ans += a[x]
		x -= lowbit(x)
	}
	return ans
}*/
func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a % b)
}
func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	t := 0
	fmt.Scan(&t)
	for i := 0; i < t; i ++ {
		solve := func() {
			var a, b, k int
			fmt.Fscan(in, &a, &b, &k)
			if k >= 100 || a == b {
				fmt.Println("NO")
				return
			} else {
				if k == 1 {
					if a % b == 0 || b % a == 0 {
						fmt.Println("YES")
					} else {
						fmt.Println("NO")
					}
					return
				}
				res := 0
				cal := func(g int)int {
					res := 0
					for i := 2; i <= g / i; i ++ {
						if g % i == 0 {
							for {
								if g % i != 0 {
									break
								}
								g /= i
								res ++
							}
						}
					}
					if g > 1 {
						res ++
					}
					return res
				}
				res += cal(a) + cal(b)
				if k <= res {
					fmt.Println("YES")
				} else {
					fmt.Println("NO")
				}
 			}
		}
		solve()
	}
}

package main

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

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
/*const N = 200010
var a [N]int
func lowbit(x int) int {
	return x & -x
}
func add(x, y int) {
	for {
		if x >= N {
			break
		}
		a[x] += y
		x += lowbit(x)
	}
}
func get(x int) int {
	ans := 0
	for {
		if x <= 0 {
			break
		}
		ans += a[x]
		x -= lowbit(x)
	}
	return ans
}*/
func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a % b)
}
func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	t := 0
	fmt.Scan(&t)
	for i := 0; i < t; i ++ {
		solve := func() {
			var a, b, k int
			fmt.Fscan(in, &a, &b, &k)
			if k >= 64 || a == b {
				fmt.Println("NO")
				return
			} else {
				if k == 1 {
					if a % b == 0 || b % a == 0 {
						fmt.Println("YES")
					} else {
						fmt.Println("NO")
					}
					return
				}
				res := 0
				cal := func(g int)int {
					res := 0
					for i := 2; i <= g / i; i ++ {
						if g % i == 0 {
							for {
								if g % i != 0 {
									break
								}
								g /= i
								res ++
							}
						}
					}
					if g > 1 {
						res ++
					}
					return res
				}
				res += cal(a) + cal(b)
				if k <= res {
					fmt.Println("YES")
				} else {
					fmt.Println("NO")
				}
 			}
		}
		solve()
	}
}

package main

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

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
/*const N = 200010
var a [N]int
func lowbit(x int) int {
	return x & -x
}
func add(x, y int) {
	for {
		if x >= N {
			break
		}
		a[x] += y
		x += lowbit(x)
	}
}
func get(x int) int {
	ans := 0
	for {
		if x <= 0 {
			break
		}
		ans += a[x]
		x -= lowbit(x)
	}
	return ans
}*/
func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a % b)
}
func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	t := 0
	fmt.Scan(&t)
	for i := 0; i < t; i ++ {
		solve := func() {
			var a, b, k int
			fmt.Fscan(in, &a, &b, &k)
			if k >= 64 || a == b {
				fmt.Println("NO")
				return
			} else {
				g := gcd(a, b)
				if a == g {
					k --
				} else if b == g {
					k --
				}
				res := 0
				for i := 2; i <= g / i; i ++ {
					if g % i == 0 {
						for {
							if g % i != 0 {
								break
							}
							g /= i
							res ++
						}
					}
				}
				if g > 1 {
					res ++
				}
				//fmt.Println(res)
				if k <= res * 2 {
					fmt.Println("YES")
				} else {
					fmt.Println("NO")
				}
 			}
		}
		solve()
	}
}

package main

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

func _Anoxia(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	var t int
	Fscan(in, &t)
	for t > 0 {
		t --
		var a, b, k int
		Fscan(in, &a, &b, &k)

		if a == b && k == 1 {
			Fprintln(out, "NO");
			continue
		}

		var minn, maxx int
		if a == b {
			minn = 0
		}else if lcm(a, b) == a || lcm(a, b) == b {
			minn = 1
		}else {
			minn = 2
		}

		maxx = 0
		for i := 2;i * i <= a;i ++ {
			if a % i == 0 {
				for a % i == 0 {
					a /= i
					maxx ++
				}
			}
		}
		if a > 1 {
			maxx ++
		}

		for i := 2;i * i <= b;i ++ {
			if b % i == 0 {
				for b % i == 0 {
					b /= i
					maxx ++
				}
			}
		}
		if b > 1 {
			maxx ++
		}

		if k <= maxx && k >= minn {
			Fprintln(out, "YES");
		}else {
			Fprintln(out, "NO");
		}

	}

}

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

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 gcd(a, b int) int {
	if b > 0 {
		return gcd(b, a%b)
	}
	return a
}
func lcm(a, b int) int { return a / gcd(a, b) * b }

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := os.Stdout
	var t int
	fmt.Fscan(in,&t)
	primes := []int{}
	isp := [50005]bool{}
	for i:=0;i<50000;i++{
		isp[i]=true
	}
	for i:=2;i*i<50000;i++{
		for j := i*i; j<50000;j+=i{
			isp[j]=false
		}
	}
	for i:=2;i<50000;i++{
		if isp[i]{
			primes = append(primes,i)
		}
	}
	for u:=1;u<=t;u++{
		var a, b , k int
		fmt.Fscan(in,&a,&b,&k)
		ta := a
		tb := b
		acnt:=0
		for i:=0;i<len(primes);i++{
			if a==1{
				break
			}
			for a%primes[i]==0{
				a/=primes[i]
				acnt++
			}
		}
		bcnt :=0
		for i:=0;i<len(primes);i++{
			if b==1{
				break
			}
			for b%primes[i]==0{
				b/=primes[i]
				bcnt++
			}
		}
		n := bcnt + acnt
		var m int
		a =ta
		b =tb
		if a==b{
			m = 0
		}else if a%b==0||b%a==0{
			m = 1
		}else{
			m = 2
		}
		if (m<=k && k<=n && k==1 && m==1)||(m<=k&&k<=n&&k!=1){
			fmt.Fprintln(out,"Yes")
		}else{
			fmt.Fprintln(out,"No")
		}
	}
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := os.Stdout
	var t int
	fmt.Fscan(in,&t)
	for u:=1;u<=t;u++{
		var a, b , k int
		fmt.Fscan(in,&a,&b,&k)
		ta := a
		tb := b
		acnt:=0
		for a>1{
			flag := false
			if a%2==0{
				flag = true
				a/=2
			}else if a%3==0{
				flag = true
				a/=3
			}else{
				flag = true
				a = 1
			}
			if flag{
				acnt++
			}else{
				break
			}
		}
		bcnt :=0
		for b>1{
			flag := false
			if b%2==0{
				flag = true
				b/=2
			}else if b%3==0{
				flag = true
				b/=3
			}else{
				flag = true
				b = 1
			}
			if flag{
				bcnt++
			}else{
				break
			}
		}
		n := bcnt + acnt
		var m int
		a =ta
		b =tb
		if a==b{
			m = 0
		}else if a%b==0||b%a==0{
			m = 1
		}else{
			m = 2
		}
		if (m<=k && k<=n && k==1 && m==1)||(m<=k&&k<=n&&k!=1){
			fmt.Fprintln(out,"Yes")
		}else{
			fmt.Fprintln(out,"No")
		}
	}
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := os.Stdout
	var t int
	fmt.Fscan(in,&t)
	for u:=1;u<=t;u++{
		var a, b , k int
		fmt.Fscan(in,&a,&b,&k)
		acnt:=0
		for a>1{
			flag := false
			if a%2==0{
				flag = true
				a/=2
			}else if a%3==0{
				flag = true
				a/=3
			}else{
				flag = true
				a = 1
			}
			if flag{
				acnt++
			}else{
				break
			}
		}
		bcnt :=0
		for b>1{
			flag := false
			if b%2==0{
				flag = true
				b/=2
			}else if b%3==0{
				flag = true
				b/=3
			}else{
				flag = true
				b = 1
			}
			if flag{
				bcnt++
			}else{
				break
			}
		}
		n := bcnt + acnt
		var m int
		if a==b{
			m = 0
		}else if a%b==0||b%a==0{
			m = 1
		}else{
			m = 2
		}
		if (m<=k && k<=n && k==1 && m==1)||(m<=k&&k<=n&&k!=1){
			fmt.Fprintln(out,"Yes")
		}else{
			fmt.Fprintln(out,"No")
		}
	}
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := os.Stdout
	var t int
	fmt.Fscan(in,&t)
	for u:=1;u<=t;u++{
		var a, b , k int
		fmt.Fscan(in,&a,&b,&k)
		if k==1{
			if a!=b&&(a%b==0||b%a==0){
				fmt.Fprintln(out,"Yes")
			}else{
				fmt.Fprintln(out,"No")
			}
			continue
		}
		acnt:=0
		for a>1{
			flag := false
			if a%2==0{
				flag = true
				a/=2
			}else if a%3==0{
				flag = true
				a/=3
			}
			if flag{
				acnt++
			}else{
				break
			}
		}
		bcnt :=0
		for b>1{
			flag := false
			if b%2==0{
				flag = true
				b/=2
			}else if b%3==0{
				flag = true
				b/=3
			}
			if flag{
				bcnt++
			}else{
				break
			}
		}

		if bcnt + acnt>=k{
			fmt.Fprintln(out,"Yes")
		}else{
			fmt.Fprintln(out,"No")
		}
	}
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := os.Stdout
	var t int
	fmt.Fscan(in,&t)
	for u:=1;u<=t;u++{
		var a, b , k int
		fmt.Fscan(in,&a,&b,&k)
		ta := a
		tb := b
		if k==1{
			if a!=b&&(a%b==0||b%a==0){
				fmt.Fprintln(out,"Yes")
			}else{
				fmt.Fprintln(out,"No")
			}
			continue
		}
		acnt:=0
		for a>1{
			flag := false
			if a%2==0{
				if a/2==1{
					break
				}
				flag = true
				a/=2
			}else if a%3==0{
				if a/3==1{
					break
				}
				flag = true
				a/=3
			}
			if flag{
				acnt++
			}else{
				break
			}
		}
		bcnt :=0
		for b>1{
			flag := false
			if b%2==0{
				if b/2==1{
					break
				}
				flag = true
				b/=2
			}else if b%3==0{
				if b/3==1{
					break
				}
				flag = true
				b/=3
			}
			if flag{
				bcnt++
			}else{
				break
			}
		}
		o := 0
		if ta!=1{
			o++
		}
		if tb!=1{
			o++
		}

		if bcnt + acnt>=k-o{
			fmt.Fprintln(out,"Yes")
		}else{
			fmt.Fprintln(out,"No")
		}
	}
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := os.Stdout
	var t int
	fmt.Fscan(in,&t)
	for u:=1;u<=t;u++{
		var a, b , k int
		fmt.Fscan(in,&a,&b,&k)
		ta := a
		tb := b
		if k==1{
			if a!=b&&(a%b==0||b%a==0){
				fmt.Fprintln(out,"Yes")
			}else{
				fmt.Fprintln(out,"No")
			}
			continue
		}
		acnt:=0
		for a>1{
			flag := false
			if a%2==0{
				flag = true
				a/=2
			}else if a%3==0{
				flag = true
				a/=3
			}
			if flag{
				acnt++
			}else{
				break
			}
		}
		bcnt :=0
		for b>1{
			flag := false
			if b%2==0{
				flag = true
				b/=2
			}else if b%3==0{
				flag = true
				b/=3
			}
			if flag{
				bcnt++
			}else{
				break
			}
		}
		o := 0
		if ta!=1{
			o++
		}
		if tb!=1{
			o++
		}
		if bcnt + acnt>=k-o{
			fmt.Fprintln(out,"Yes")
		}else{
			fmt.Fprintln(out,"No")
		}
	}
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := os.Stdout
	var t int
	fmt.Fscan(in,&t)
	for u:=1;u<=t;u++{
		var a, b , k int
		fmt.Fscan(in,&a,&b,&k)
		if k==1{
			if a!=b&&(a%b==0||b%a==0){
				fmt.Fprintln(out,"Yes")
			}else{
				fmt.Fprintln(out,"No")
			}
			continue
		}
		acnt:=0
		for a>1{
			flag := false
			if a%2==0{
				flag = true
				a/=2
			}else if a%3==0{
				flag = true
				a/=3
			}
			if flag{
				acnt++
			}else{
				break
			}
		}
		bcnt :=0
		for b>1{
			flag := false
			if b%2==0{
				flag = true
				b/=2
			}else if b%3==0{
				flag = true
				b/=3
			}
			if flag{
				bcnt++
			}else{
				break
			}
		}
		if bcnt + acnt>=k-2{
			fmt.Fprintln(out,"Yes")
		}else{
			fmt.Fprintln(out,"No")
		}
	}
}

package main

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

func main() {

	read := bufio.NewReader(os.Stdin)

	var t int

	fmt.Fscan(read, &t)

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

		var a, b, k int
		fmt.Fscan(read, &a, &b, &k)

		fmt.Println(solve(a, b , k))
	}
}

func solve (a, b, k int) string {
	pfsa := PrimeFactors(a)
	pfsb := PrimeFactors(b)

	if len(pfsa) == 0 && len(pfsb) == 0 {
		return "NO"
	}
	if a == b && k % 2 != 0 {
		return "NO"
	}

	if len(pfsa) == 0 {

		var  s int

		for _, v := range pfsb {
			s += v
		}

		if s >= k {
			return "YES"
		}else {
			return "NO"
		}
	}

	if len(pfsb) == 0 {

		var  s int

		for _, v := range pfsa {
			s += v
		}

		if s >= k {
			return "YES"
		}else {
			return "NO"
		}
	}

	g  := gcd(a, b)

	var min int
	if a/g != 1 {
		min++
	}
	if b/g != 1 {
		min++
	}

	if k < min {
		return "NO"
	}

	var s int

	for _ , v := range pfsa {
		s += v
	}

	for _ , v := range pfsb {
		s += v
	}

	if k > s {
		return "NO"
	}

	return "YES"

}

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

func PrimeFactors(n int) (pfs map[int]int) {
	pfs = make(map[int]int)

	// Get the number of 2s that divide n
	for n%2 == 0 {
		if _, ok := pfs[2]; ok {
			pfs[2] += 1
		} else {
			pfs[2] = 1
		}
		n = n / 2
	}

	// n must be odd at this point. so we can skip one element
	// (note i = i + 2)
	for i := 3; i*i <= n; i = i + 2 {
		// while i divides n, append i and divide n
		for n%i == 0 {
			if _, ok := pfs[i]; ok {
				pfs[i] += 1
			} else {
				pfs[i] = 1
			}
			n = n / i
		}
	}

	// This condition is to handle the case when n is a prime number
	// greater than 2
	if n > 2 {
		pfs[n] = 1
	}

	return
}

package main

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

func main() {

	read := bufio.NewReader(os.Stdin)

	var t int

	fmt.Fscan(read, &t)

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

		var a, b, k int
		fmt.Fscan(read, &a, &b, &k)

		fmt.Println(solve(a, b , k))
	}
}

func solve (a, b, k int) string {
	pfsa := PrimeFactors(a)
	pfsb := PrimeFactors(b)

	if len(pfsa) == 0 && len(pfsb) == 0 {
		return "NO"
	}
	if a == b && k % 2 != 0 {
		return "NO"
	}

	if len(pfsa) == 0 {

		var  s int

		for _, v := range pfsb {
			s += v
		}

		if s >= k {
			return "YES"
		}else {
			return "NO"
		}
	}

	if len(pfsb) == 0 {

		var  s int

		for _, v := range pfsa {
			s += v
		}

		if s >= k {
			return "YES"
		}else {
			return "NO"
		}
	}

	g  := gcd(a, b)

	var min int
	if a/g != 1 {
		min++
	}
	if b/g != 1 {
		min++
	}

	if k < min {
		return "NO"
	}
	if k > len(pfsa) + len(pfsb) {
		return "NO"
	}

	return "YES"

}

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

func PrimeFactors(n int) (pfs map[int]int) {
	pfs = make(map[int]int)

	// Get the number of 2s that divide n
	for n%2 == 0 {
		if _, ok := pfs[2]; ok {
			pfs[2] += 1
		} else {
			pfs[2] = 1
		}
		n = n / 2
	}

	// n must be odd at this point. so we can skip one element
	// (note i = i + 2)
	for i := 3; i*i <= n; i = i + 2 {
		// while i divides n, append i and divide n
		for n%i == 0 {
			if _, ok := pfs[i]; ok {
				pfs[i] += 1
			} else {
				pfs[i] = 1
			}
			n = n / i
		}
	}

	// This condition is to handle the case when n is a prime number
	// greater than 2
	if n > 2 {
		pfs[n] = 1
	}

	return
}

package main

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

func main() {

	read := bufio.NewReader(os.Stdin)

	var t int

	fmt.Fscan(read, &t)

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

		var a, b, k int
		fmt.Fscan(read, &a, &b, &k)

		fmt.Println(solve(a, b , k))
	}
}

func solve (a, b, k int) string {
	pfsa := PrimeFactors(a)
	pfsb := PrimeFactors(b)

	var s int
	var cnt int

	if len(pfsa) == 0 && len(pfsb) == 0 {
		return "NO"
	}
	if len(pfsa) == 0 {

		var  s int

		for _, v := range pfsb {
			s += v
		}

		if s >= k {
			return "YES"
		}else {
			return "NO"
		}
	}

	if len(pfsb) == 0 {

		var  s int

		for _, v := range pfsa {
			s += v
		}

		if s >= k {
			return "YES"
		}else {
			return "NO"
		}
	}

	for k, v1 := range pfsa {
		var v2 int
		var ok bool
		if v2, ok = pfsb[k]; !ok {
			return "NO"
		}

		s += v1
		s += v2

		if v1 != v2 {
			cnt++
		}
	}

	if k < cnt {
		return "NO"
	}
	if k > s {
		return "NO"
	}

	if cnt == 0 && k % 2 != 0 {
		return "NO"
	}

	return "YES"

}

func PrimeFactors(n int) (pfs map[int]int) {
	pfs = make(map[int]int)

	// Get the number of 2s that divide n
	for n%2 == 0 {
		if _, ok := pfs[2]; ok {
			pfs[2] += 1
		} else {
			pfs[2] = 1
		}
		n = n / 2
	}

	// n must be odd at this point. so we can skip one element
	// (note i = i + 2)
	for i := 3; i*i <= n; i = i + 2 {
		// while i divides n, append i and divide n
		for n%i == 0 {
			if _, ok := pfs[i]; ok {
				pfs[i] += 1
			} else {
				pfs[i] = 1
			}
			n = n / i
		}
	}

	// This condition is to handle the case when n is a prime number
	// greater than 2
	if n > 2 {
		pfs[n] = 1
	}

	return
}

package main

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

func main() {

	read := bufio.NewReader(os.Stdin)

	var t int

	fmt.Fscan(read, &t)

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

		var a, b, k int
		fmt.Fscan(read, &a, &b, &k)

		fmt.Println(solve(a, b , k))
	}
}

func solve (a, b, k int) string {
	pfsa := PrimeFactors(a)
	pfsb := PrimeFactors(b)

	var s int
	var cnt int

	if len(pfsa) == 0 && len(pfsb) == 0 {
		return "NO"
	}
	if len(pfsa) == 0 {

		var  s int

		for _, v := range pfsb {
			s += v
		}

		if s >= k {
			return "YES"
		}else {
			return "NO"
		}
	}

	if len(pfsb) == 0 {

		var  s int

		for _, v := range pfsa {
			s += v
		}

		if s >= k {
			return "YES"
		}else {
			return "NO"
		}
	}

	for k, v1 := range pfsa {
		var v2 int
		var ok bool
		if v2, ok = pfsb[k]; !ok {
			return "NO"
		}

		s += v1
		s += v2

		if v1 != v2 {
			cnt++
		}
	}

	if k < cnt {
		return "NO"
	}
	if k > s {
		return "NO"
	}

	if cnt == 0 {
		return "NO"
	}

	return "YES"

}

func PrimeFactors(n int) (pfs map[int]int) {
	pfs = make(map[int]int)

	// Get the number of 2s that divide n
	for n%2 == 0 {
		if _, ok := pfs[2]; ok {
			pfs[2] += 1
		} else {
			pfs[2] = 1
		}
		n = n / 2
	}

	// n must be odd at this point. so we can skip one element
	// (note i = i + 2)
	for i := 3; i*i <= n; i = i + 2 {
		// while i divides n, append i and divide n
		for n%i == 0 {
			if _, ok := pfs[i]; ok {
				pfs[i] += 1
			} else {
				pfs[i] = 1
			}
			n = n / i
		}
	}

	// This condition is to handle the case when n is a prime number
	// greater than 2
	if n > 2 {
		pfs[n] = 1
	}

	return
}

package main

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

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

	var t int
	fmt.Fscan(reader, &t)

	var a, b, k int
	for ; t > 0; t-- {
		fmt.Fscan(reader, &a, &b, &k)

		if a < b {
			a, b = b, a
		}

		g := Gcd(a, b)
		pa, pb, pg := cntPrime(a/g), cntPrime(b/g), cntPrime(g)

		if k == 1 && a/b > 1 && a%b == 0 ||
			k > 1 && pa+pb+pg*2 >= k && ((pa+pb)&1 == 1 || k&1 == 0) {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

func Gcd(a, b int) int {
	for b > 0 {
		a, b = b, a%b
	}
	return a
}

func cntPrime(n int) int {
	out := 0
	for i := 2; i*i <= n; i++ {
		for ; n%i == 0; n /= i {
			out++
		}
	}
	if n != 1 {
		out++
	}
	return out
}

package main

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

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

	var T, a, b, k int
	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &a, &b, &k)
		if k == 1 && a == b {
			Fprintln(out, "NO")
			return
		}
		mi := 0
		g := gcd(a, b)
		if g < a {
			mi++
		}
		if g < b {
			mi++
		}
		if mi <= k && k <= f(a)+f(b) {
			Fprintln(out, "YES")
		} else {
			Fprintln(out, "NO")
		}
	}
}

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

func f(x int) (c int) {
	for i := 2; i*i <= x; i++ {
		for ; x%i == 0; x /= i {
			c++
		}
	}
	if x > 1 {
		c++
	}
	return
}

func gcd(a, b int) int {
	for a != 0 {
		a, b = b%a, a
	}
	return b
}

package main

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

func run(r io.Reader, w io.Writer) {
	in := bufio.NewReader(r)
	out := bufio.NewWriter(w)
	defer out.Flush()

	type pair struct {
		x, y int
	}
	var t int
	for Fscan(in, &t); t > 0; t-- {
		var a, b, k int
		Fscan(in, &a, &b, &k)

		fac1 := decomposition(a)
		fac2 := decomposition(b)
		if len(fac2) + len(fac1) < k {
			Fprintln(out, "NO")

		} else if k == 1 && ((b % a != 0 && a % b != 0) || a == b) {
			Fprintln(out, "NO")

		} else {
			Fprintln(out, "YES")
		}
	}
}

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

func decomposition(a int) []int {
	var res []int
	for p := 2; a >= p * p; {
		if a % p == 0 {
			a /= p
			res = append(res, p)
		} else {
			p++
		}
	}
	res = append(res, a)
	return res
}


The statement of this problem is the same as the statement of problem C2. The only difference is that, in problem C1, $$$n$$$ is always even, and in C2, $$$n$$$ is always odd.You are given a regular polygon with $$$2 \cdot n$$$ vertices (it's convex and has equal sides and equal angles) and all its sides have length $$$1$$$. Let's name it as $$$2n$$$-gon.Your task is to find the square of the minimum size such that you can embed $$$2n$$$-gon in the square. Embedding $$$2n$$$-gon in the square means that you need to place $$$2n$$$-gon in the square in such way that each point which lies inside or on a border of $$$2n$$$-gon should also lie inside or on a border of the square.You can rotate $$$2n$$$-gon and/or the square.

The first line contains a single integer $$$T$$$ ($$$1 \le T \le 200$$$) — the number of test cases. Next $$$T$$$ lines contain descriptions of test cases — one per line. Each line contains single even integer $$$n$$$ ($$$2 \le n \le 200$$$). Don't forget you need to embed $$$2n$$$-gon, not an $$$n$$$-gon.

Print $$$T$$$ real numbers — one per test case. For each test case, print the minimum length of a side of the square $$$2n$$$-gon can be embedded in. Your answer will be considered correct if its absolute or relative error doesn't exceed $$$10^{-6}$$$.

package main

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

const (
	mod = int64(1e9 + 7)
)

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	t := 1
	fmt.Fscanf(in, "%d\n", &t)
	for tt := 0; tt < t; tt++ {
		n := 0
		fmt.Fscanf(in, "%d\n", &n)
		if n == 2 {
			fmt.Fprintf(out, "%.10f\n", 1.0)
			continue
		}
		a := 360 / float64(2*n) / 2
		b := 90 - a
		//fmt.Println(a, b)
		x := math.Sin(b/180*math.Pi) / math.Sin(a/180*math.Pi)
		fmt.Fprintf(out, "%.10f\n", x)
	}
	return
}

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

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

// https://codeforces.com/contest/1355/problem/C
package main

import (
	"fmt"
	"math"
)

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

func main() {
	var T, n int
	//f, _ := os.Open("input.txt")
	//input := bufio.NewReader(f)
	fmt.Scan(&T)
	m := math.Pi/180

	for i := 0; i < T; i++ {
		fmt.Scan(&n)
		n *= 2
		u := float64(180 * (n - 2)) / float64(n)
		alpha := u/2
		beta := (90 - alpha)
		r := 0.5*math.Sin(alpha*m) / math.Sin(beta*m)
		fmt.Printf("%.6f\n", 2*r)
	}
}

/*
URL:
https://codeforces.com/problemset/problem/1354/C1
*/

package main

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

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

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

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

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

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

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

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

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

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

var (
	t int
	n int
)

func main() {
	t = ReadInt()
	for i := 0; i < t; i++ {
		n = ReadInt()

		solve()
	}
}

func solve() {
	nf := float64(2 * n)
	ans := 1.0 / math.Tan(math.Pi/nf)
	fmt.Println(ans)
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

	return res
}

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

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

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

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

	return string(res)
}

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

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

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

	return string(res)
}

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

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

package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
)
var n int
var nt int
func main()  {
	var reader = bufio.NewReader(os.Stdin)
	var writer = bufio.NewWriter(os.Stdout)
	defer writer.Flush()
	fmt.Fscanf(reader, "%d\n", &nt)
	for kk := 0; kk < nt; kk++ {
		fmt.Fscanf(reader, "%d\n", &n)
		var all = 2 * math.Pi

		var angle = 0.5 * all / float64(2 * n)

		//fmt.Println(angle * 180.0 / math.Pi)

		var side = 0.5 / math.Tan(angle)

		fmt.Println(side * 2)

		//fmt.Println(2 * side)
	}
}

package main

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

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

type writerImpl struct {
	*bufio.Writer
}

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

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

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

type WordScanner interface {
	NextInt64() int64
	NextUInt64() uint64
	NextString() string
}

type wordScannerImpl struct {
	*bufio.Scanner
}

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

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

func (impl *wordScannerImpl) NextUInt64() uint64 {
	impl.Scan()
	bb := impl.Bytes()
	i := uint64(0)
	for _, b := range bb {
		i *= 10
		i += uint64(b - '0')
	}
	return i
}

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

func gcd(a, b int64) int64 {
	for b != 0 {
		a, b = b, a%b
	}
	return a
}

func lcm(a, b int64) int64 {
	return a * b / gcd(a, b)
}

func abs(a int64) int64 {
	if a < 0 {
		return a * -1
	}
	return a
}

func min(a int64, rest ...int64) int64 {
	for _, r := range rest {
		if r < a {
			a = r
		}
	}
	return a
}

func max(a int64, rest ...int64) int64 {
	for _, r := range rest {
		if r > a {
			a = r
		}
	}
	return a
}

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

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

func main() {
	defer writer.Flush()
	t := reader.NextInt64()
	for ; t > 0; t-- {
		writer.Printf("%.7f\n", sol(reader.NextInt64()))
	}
}

func sol(n int64) float64 {
	sides := float64(2 * n)
	radout := math.Pi * 2 / sides
	radin := math.Pi - radout
	return math.Tan(radin / 2)
}


You are given a binary string $$$s$$$ consisting of $$$n$$$ zeros and ones.Your task is to divide the given string into the minimum number of subsequences in such a way that each character of the string belongs to exactly one subsequence and each subsequence looks like "010101 ..." or "101010 ..." (i.e. the subsequence should not contain two adjacent zeros or ones).Recall that a subsequence is a sequence that can be derived from the given sequence by deleting zero or more elements without changing the order of the remaining elements. For example, subsequences of "1011101" are "0", "1", "11111", "0111", "101", "1001", but not "000", "101010" and "11100".You have to answer $$$t$$$ independent test cases.

The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of $$$s$$$. The second line of the test case contains $$$n$$$ characters '0' and '1' — the string $$$s$$$. It is guaranteed that the sum of $$$n$$$ does not exceed $$$2 \cdot 10^5$$$ ($$$\sum n \le 2 \cdot 10^5$$$).

For each test case, print the answer: in the first line print one integer $$$k$$$ ($$$1 \le k \le n$$$) — the minimum number of subsequences you can divide the string $$$s$$$ to. In the second line print $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le k$$$), where $$$a_i$$$ is the number of subsequence the $$$i$$$-th character of $$$s$$$ belongs to. If there are several answers, you can print any.

package main

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

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

	T:= 0
	for Fscan(in, &T); T > 0; T-- {
		var n int
		var s string
		Fscan(in, &n)
		Fscan(in, &s)

		ans:=make([]int,n)
		zr,on:=make([]int,n),make([]int,n)
		i,j:=0,0
		for idx,x := range(s){
			// Fprintln(out,x,i,j,zr,on)
			if x=='1'{
				if i==0{
					ans[idx]=j+1
					on[j]=j+1
					j++
				} else {
					i--
					on[j]=zr[i]
					ans[idx]=on[j]
					j++
				}
			} else {
				if j==0{
					ans[idx]=i+1
					zr[i]=i+1
					i++
				} else {
					j--
					zr[i]=on[j]
					ans[idx]=zr[i]
					i++
				}
			}

		}

		Fprintln(out,i+j)
		// Fprintln(out,ans)
		for _,x := range(ans){
			Fprint(out,x," ")
		}
		Fprintln(out,"")
	}
}

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

package main

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

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

	tc := readNum(reader)
	var buf bytes.Buffer
	for tc > 0 {
		tc--
		n := readNum(reader)
		s, _ := reader.ReadString('\n')
		cnt, arr := solve(n, s)
		buf.WriteString(fmt.Sprintf("%d\n", cnt))
		for i := 0; i < n; i++ {
			buf.WriteString(fmt.Sprintf("%d ", arr[i]))
		}
		buf.WriteByte('\n')
	}
	fmt.Print(buf.String())
}

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

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

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

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

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

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

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

	return i
}

func solve(n int, s string) (int, []int) {
	set := make([]int, n)
	pos := make([][]int, 2)
	for i := 0; i < 2; i++ {
		pos[i] = make([]int, 0, n)
	}

	put := func(p int, i int, j int) int {
		ans := len(pos[i]) + len(pos[j])

		if len(pos[i]) == 0 {
			pos[j] = append(pos[j], ans)
		} else {
			n := len(pos[i])
			ans = pos[i][n-1]
			pos[i] = pos[i][:n-1]
			pos[j] = append(pos[j], ans)
		}

		return ans
	}

	for i := 0; i < n; i++ {
		if s[i] == '0' {
			set[i] = put(i, 1, 0) + 1
		} else {
			set[i] = put(i, 0, 1) + 1
		}
	}

	res := len(pos[0]) + len(pos[1])

	return res, set
}

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

package main

import (
    "fmt"
)

func main() {
    var t int
    fmt.Scan(&t)
    for t > 0 {
        var n int
        fmt.Scan(&n)
        var s string
        fmt.Scan(&s)

        total := 0
        color := make([]int, n)
        zero := make([]int, 0)
        one := make([]int, 0)
        for i := 0; i < n; i++ {
            if s[i] == '0' {
                if len(one) > 0 {
                    color[i] = one[len(one) - 1]

                    zero = append(zero, one[len(one) - 1])
                    one = one[:len(one) - 1]
                } else {
                    total++
                    color[i] = total

                    zero = append(zero, total)
                }
            } else {
                if len(zero) > 0 {
                    color[i] = zero[len(zero) - 1]

                    one = append(one, zero[len(zero) - 1])
                    zero = zero[:len(zero) - 1]
                } else {
                    total++
                    color[i] = total

                    one = append(one, total)
                }
            }
        }

        fmt.Println(total)
        for i := 0; i < n; i++ {
            fmt.Printf("%d ", color[i])
        }
        fmt.Println()

        t--
    }
}

package main

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

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

	for t := io.NextInt(); t > 0; t-- {
		n := io.NextInt()
		s := io.Next()

		ans := make([]int, n)
		pend := make([][]int, 2)
		cur := 0
		for i, cc := range s {
			c := cc - '0'
			if len(pend[1-c]) == 0 {
				cur++
				ans[i] = cur
				pend[c] = append(pend[c], cur)
			} else {
				x := pend[1-c][0]
				pend[1-c] = pend[1-c][1:]
				ans[i] = x
				pend[c] = append(pend[c], x)
			}
		}
		io.Println(cur)
		io.PrintlnInts(ans...)
	}
}

type FastIO struct {
	*bufio.Reader
	*bufio.Writer
	c [1]byte
}

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

func (f *FastIO) readC() byte {
	f.Read(f.c[:])
	return f.c[0]
}

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) Next() string {
	c := f.readC()
	for ; c <= ' '; c = f.readC() {
	}
	var s []byte
	for ; c > ' '; c = f.readC() {
		s = append(s, f.c[0])
	}
	return string(s)
}

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

func (f *FastIO) Print(a ...interface{}) {
	fmt.Fprint(f.Writer, a...)
}

func (f *FastIO) PrintInts(a ...int) {
	if len(a) > 0 {
		f.Print(a[0])
		for _, x := range a[1:] {
			f.Print(" ", x)
		}
	}
}

func (f *FastIO) PrintlnInts(a ...int) {
	f.PrintInts(a...)
	f.Println()
}

package main

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

func main() {
	sc := bufio.NewScanner(os.Stdin)
	bf := make([]byte, 1024*1024)
	sc.Buffer(bf, 10*1024*1024)
	sc.Split(bufio.ScanWords)

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

	ins := func () string {
		sc.Scan()
		return sc.Text()
	}

	for t := ini(); t > 0; t-- {
		n := ini()
		s := ins()

		a := make([][]int, 2)

		for i := range a {
			a[i] = make([]int,0, n)
		}

		b := make([]int, n)

		cnt := 1

		for i := range s {
			if s[i] == '0' {
				if len(a[1]) == 0 {
					a[0] = append(a[0], cnt)
					cnt++
				} else {
					m := len(a[1])
					a[0] = append(a[0], a[1][m-1])
					a[1] = a[1][0:m-1]
				}
				b[i] = a[0][len(a[0])-1]
			} else {
				if len(a[0]) == 0 {
					a[1] = append(a[1], cnt)
					cnt++
				} else {
					m := len(a[0])
					a[1] = append(a[1], a[0][m-1])
					a[0] = a[0][0:m-1]
				}
				b[i] = a[1][len(a[1])-1]
			}
		}

		fmt.Println(cnt-1)

		for i := range b {
			fmt.Print(b[i], " ")
		}

		fmt.Println()
	}

}

package main

import (
	"fmt"
)

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

	for ; t > 0; t-- {
		var n int
		fmt.Scan(&n)

		var s string
		fmt.Scan(&s)

		flag := make([]int, n)

		zero := 0
		one := 0
		zero_flag := make([]int, 0)
		one_flag := make([]int, 0)
		cur_flag := 0

		for i := 0; i < n; i++ {
			switch s[i] {
			case '0':
				if one > 0 {
					one--
					zero++
					flag[i] = one_flag[0]
					one_flag = one_flag[1:]
					zero_flag = append(zero_flag, flag[i])
				} else {
					zero++
					cur_flag++
					flag[i] = cur_flag
					zero_flag = append(zero_flag, flag[i])
				}
			case '1':
				if zero > 0 {
					zero--
					one++
					flag[i] = zero_flag[0]
					zero_flag = zero_flag[1:]
					one_flag = append(one_flag, flag[i])
				} else {
					one++
					cur_flag++
					flag[i] = cur_flag
					one_flag = append(one_flag, flag[i])
				}
			}
		}

		fmt.Println(cur_flag)
		for i := 0; i < n; i++ {
			fmt.Printf("%d ", flag[i])
		}
		fmt.Println()
	}
}

package main

import "fmt"

func main() {
    var t, n int
    var s []byte
    var q0, q1, ans []int
    q0 = make([]int, 200005)
    q1 = make([]int, 200005)
    ans = make([]int, 200005)
    fmt.Scan(&t)
    for ; t > 0; t-- {
        fmt.Scan(&n)
        fmt.Scan(&s)
        q0front := 0
        q0back := 0
        q1front := 0
        q1back := 0
        count := 0
        for i := 0; i < n; i++ {
            if s[i] == '0' && q0front == q0back {
                count++
                q1[q1back] = count
                q1back++
                ans[i] = count
            } else if s[i] == '0' && q0front < q0back {
                ans[i] = q0[q0front]
                q1[q1back] = q0[q0front]
                q0front++
                q1back++
            } else if s[i] == '1' && q1front == q1back {
                count++
                q0[q0back] = count
                q0back++
                ans[i] = count
            } else if s[i] == '1' && q1front < q1back {
                ans[i] = q1[q1front]
                q0[q0back] = q1[q1front]
                q1front++
                q0back++
            }
        }
        fmt.Println(count)
        for i := 0; i < n; i++ {
            fmt.Printf("%v ", ans[i])
        }
        fmt.Println("")
    }
}

package main

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

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

	var T, n int
	var s []byte
	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &n, &s)
		ans := make([]interface{}, n)
		end := [2][]int{}
		for i, b := range s {
			b &= 1
			k := len(end[0]) + len(end[1]) + 1
			if len(end[b^1]) > 0 {
				k = end[b^1][0]
				end[b^1] = end[b^1][1:]
			}
			end[b] = append(end[b], k)
			ans[i] = k
		}
		Fprintln(out, len(end[0])+len(end[1]))
		Fprintln(out, ans...)
	}
}

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

package main

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

const (
	SCANNER_BUF_SIZE = 2 << 20

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

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

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

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

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

func suint64() uint64 {
	scanner.Scan()
	bb := scanner.Bytes()
	i := uint64(0)
	for _, b := range bb {
		i *= 10
		i += uint64(b - '0')
	}
	return i
}

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

func gcd(a, b int64) int64 {
	for b != 0 {
		a, b = b, a%b
	}
	return a
}

func lcm(a, b int64) int64 {
	return a * b / gcd(a, b)
}

func abs(a int64) int64 {
	if a < 0 {
		return a * -1
	}
	return a
}

func min(a int64, rest ...int64) int64 {
	for _, r := range rest {
		if r < a {
			a = r
		}
	}
	return a
}

func max(a int64, rest ...int64) int64 {
	for _, r := range rest {
		if r > a {
			a = r
		}
	}
	return a
}

func main() {
	defer writer.Flush()
	t := sint64()
	for ; t > 0; t-- {
		n := sint64()
		s := sstring()
		k, a := sol(n, s)
		printf("%d\n", k)
		for _, i := range a {
			printf("%d ", i)
		}
		printf("\n")
	}
}

func sol(n int64, s string) (int64, []int64) {
	m := map[int64][][]int64{
		0: {},
		1: {},
	}
	for i, r := range s {
		if r == '0' {
			if len(m[1]) == 0 {
				m[0] = append(m[0], []int64{int64(i)})
			} else {
				last := m[1][len(m[1])-1]
				m[1] = m[1][:len(m[1])-1]
				last = append(last, int64(i))
				m[0] = append(m[0], last)
			}
		} else { // r == '1'
			if len(m[0]) == 0 {
				m[1] = append(m[1], []int64{int64(i)})
			} else {
				last := m[0][len(m[0])-1]
				m[0] = m[0][:len(m[0])-1]
				last = append(last, int64(i))
				m[1] = append(m[1], last)
			}
		}
	}
	a := make([]int64, n)
	id := int64(1)
	for i := range m {
		for j := range m[i] {
			for k := range m[i][j] {
				a[m[i][j][k]] = id
			}
			id++
		}
	}
	return int64(len(m[0]) + len(m[1])), a
}

package main

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

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

	tc := readNum(reader)
	var buf bytes.Buffer
	for tc > 0 {
		tc--
		n := readNum(reader)
		s, _ := reader.ReadString('\n')
		cnt, arr := solve(n, s)
		buf.WriteString(fmt.Sprintf("%d\n", cnt))
		for i := 0; i < n; i++ {
			buf.WriteString(fmt.Sprintf("%d ", arr[i]))
		}
		buf.WriteByte('\n')
	}
	fmt.Print(buf.String())
}

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

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

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

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

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

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

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

	return i
}

func solve(n int, s string) (int, []int) {
	set := make([]int, n)
	pos := make([][]int, 2)
	for i := 0; i < 2; i++ {
		pos[i] = make([]int, 0, n)
	}

	put := func(p int, i int, j int) {
		if len(pos[i]) > 0 {
			l := len(pos[i])
			set[p] = set[pos[i][l-1]]
			pos[i] = pos[i][:l-1]
		} else if len(pos[j]) > 0 {
			l := len(pos[j])
			set[p] = set[pos[j][l-1]] + 1
		} else {
			set[p] = 1
		}
		pos[j] = append(pos[j], p)
	}

	for i := 0; i < n; i++ {
		if s[i] == '0' {
			put(i, 1, 0)
		} else {
			put(i, 0, 1)
		}
	}

	var res int

	for i := 0; i < n; i++ {
		res = max(res, set[i])
	}

	return res, set
}

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

package main

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

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

	tc := readNum(reader)
	var buf bytes.Buffer
	for tc > 0 {
		tc--
		n := readNum(reader)
		s, _ := reader.ReadString('\n')
		cnt, arr := solve(n, s)
		buf.WriteString(fmt.Sprintf("%d\n", cnt))
		for i := 0; i < n; i++ {
			buf.WriteString(fmt.Sprintf("%d ", arr[i]))
		}
		buf.WriteByte('\n')
	}
	fmt.Print(buf.String())
}

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

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

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

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

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

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

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

	return i
}

func solve(n int, s string) (int, []int) {
	set := make([]int, n)
	pos := make([][]int, 2)
	for i := 0; i < 2; i++ {
		pos[i] = make([]int, 0, n)
	}

	put := func(p int, i int, j int) int {
		ans := len(pos[i]) + len(pos[j])

		if len(pos[i]) == 0 {
			pos[j] = append(pos[j], ans)
		} else {
			n := len(pos[i])
			ans = pos[i][n-1]
			pos[i] = pos[i][:n-1]
			pos[j] = append(pos[j], ans)
		}

		return ans
	}

	for i := 0; i < n; i++ {
		if s[i] == '0' {
			set[i] = put(i, 1, 0)
		} else {
			set[i] = put(i, 0, 1)
		}
	}

	var res int

	for i := 0; i < n; i++ {
		res = max(res, set[i])
	}

	return res, set
}

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

package main

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

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

	tc := readNum(reader)
	var buf bytes.Buffer
	for tc > 0 {
		tc--
		n := readNum(reader)
		s, _ := reader.ReadString('\n')
		cnt, arr := solve(n, s)
		buf.WriteString(fmt.Sprintf("%d\n", cnt))
		for i := 0; i < n; i++ {
			buf.WriteString(fmt.Sprintf("%d ", arr[i]))
		}
		buf.WriteByte('\n')
	}
	fmt.Print(buf.String())
}

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

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

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

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

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

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

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

	return i
}

func solve(n int, s string) (int, []int) {
	var res int
	set := make([]int, n)
	for i := 0; i < n; {
		j := i
		for i < n && s[i] == s[j] {
			i++
			set[i-1] = i - j
		}
		if i-j > res {
			res = i - j
		}
	}
	return res, set
}

package main

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

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

	tc := readNum(reader)
	var buf bytes.Buffer
	for tc > 0 {
		tc--
		n := readNum(reader)
		s, _ := reader.ReadString('\n')
		cnt, arr := solve(n, s)
		buf.WriteString(fmt.Sprintf("%d\n", cnt))
		for i := 0; i < n; i++ {
			buf.WriteString(fmt.Sprintf("%d ", arr[i]))
		}
		buf.WriteByte('\n')
	}
	fmt.Print(buf.String())
}

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

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

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

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

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

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

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

	return i
}

func solve(n int, s string) (int, []int) {
	set := make([]int, n)
	var a int
	var i int
	for i < n && s[i] == s[0] {
		a++
		set[i] = a
		i++
	}

	var b int
	for i < n && s[i] != s[0] {
		b++
		set[i] = b
		i++
	}

	for i < n {
		j := i
		var c, d int
		for i < n && s[i] == s[j] {
			c++
			if a <= b {
				set[i] = c
			} else if c <= b {
				set[i] = c
				d = c
			} else {
				set[i] = a + c - d
			}
			i++
		}
		a, b = b, c
	}

	var res int

	for i := 0; i < n; i++ {
		res = max(res, set[i])
	}

	return res, set
}

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

package main

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

func sch(i int, a []int) int {
	s := 0
	e := len(a) - 1

	for s <= e {
		m := (s+e)/2

		if a[m] > i {
			e = m-1
		} else {
			s = m+1
		}
	}

	if s == len(a) {
		return -1
	}

	tmp := a[s]

	if s == 0 {
		a[s] = -1
	} else {
		a[s] = a[s-1]
	}

	return tmp
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	bf := make([]byte, 1024*1024)
	sc.Buffer(bf, 10*1024*1024)
	sc.Split(bufio.ScanWords)

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

	ins := func () string {
		sc.Scan()
		return sc.Text()
	}

	for t := ini(); t > 0; t-- {
		n := ini()
		s := ins()

		a := make([][]int, 2)

		for i := range a {
			a[i] = make([]int, 0)
			for j := range s {
				if s[j] == byte(i + '0') {
					a[i] = append(a[i], j)
				}
			}
		}

		cnt := 0
		b := make([]int, n)

		for i := range b {
			b[i] = -1
		}

		for i := range s {
			if b[i] != -1 {
				continue
			}

			cnt++
			ni := i
			for ni != -1 {
				b[ni] = cnt

				if s[ni] == '0' {
					ni = sch(ni, a[1])
					//fmt.Println("--->",a[1])
				} else {
					ni = sch(ni, a[0])
					//fmt.Println(";;;>",a[0])
				}
				//fmt.Println(b, ni)
			}
			//fmt.Println("-----------")
		}

		fmt.Println(cnt)

		for i := range b {
			fmt.Print(b[i], " ")
		}

		fmt.Println()
		//fmt.Println(s)
	}

}

package main

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

func sch(i int, a *[]int) int {
	s := 0
	e := len(*a) - 1

	for s <= e {
		m := (s+e)/2

		if (*a)[m] > i {
			e = m-1
		} else {
			s = m+1
		}
	}

	if s == len(*a) {
		return -1
	}

	tmp := (*a)[s]

	if s == len(*a) {
		return -1
	}

	(*a) = (*a)[s+1:]

	return tmp
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	bf := make([]byte, 1024*1024)
	sc.Buffer(bf, 10*1024*1024)
	sc.Split(bufio.ScanWords)

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

	ins := func () string {
		sc.Scan()
		return sc.Text()
	}

	for t := ini(); t > 0; t-- {
		n := ini()
		s := ins()

		a := make([][]int, 2)

		for i := range a {
			a[i] = make([]int, 0)
			for j := range s {
				if s[j] == byte(i + '0') {
					a[i] = append(a[i], j)
				}
			}
		}

		cnt := 0
		b := make([]int, n)

		for i := range b {
			b[i] = -1
		}

		for i := range s {
			if b[i] != -1 {
				continue
			}

			cnt++
			ni := i
			for ni != -1 {
				b[ni] = cnt

				if s[ni] == '0' {
					ni = sch(ni, &a[1])
					//fmt.Println("--->",a[1])
				} else {
					ni = sch(ni, &a[0])
					//fmt.Println(";;;>",a[0])
				}
				//fmt.Println(b, ni)
			}
			//fmt.Println("-----------")
		}

		fmt.Println(cnt)

		for i := range b {
			fmt.Print(b[i], " ")
		}

		fmt.Println()
		//fmt.Println(s)
	}

}

package main

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

func sch(i int, a *[]int) int {
	s := 0
	e := len(*a) - 1

	for s <= e {
		m := (s+e)/2

		if (*a)[m] > i {
			e = m-1
		} else {
			s = m+1
		}
	}

	if s == len(*a) {
		return -1
	}

	tmp := (*a)[s]

	if s == 0 {
		*a = (*a)[1:]
	} else {
		(*a)[s] = (*a)[s-1]
	}

	return tmp
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	bf := make([]byte, 1024*1024)
	sc.Buffer(bf, 10*1024*1024)
	sc.Split(bufio.ScanWords)

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

	ins := func () string {
		sc.Scan()
		return sc.Text()
	}

	for t := ini(); t > 0; t-- {
		n := ini()
		s := ins()

		a := make([][]int, 2)

		for i := range a {
			a[i] = make([]int, 0)
			for j := range s {
				if s[j] == byte(i + '0') {
					a[i] = append(a[i], j)
				}
			}
		}

		cnt := 0
		b := make([]int, n)

		for i := range b {
			b[i] = -1
		}

		for i := range s {
			if b[i] != -1 {
				continue
			}

			cnt++
			ni := i
			for ni != -1 {
				b[ni] = cnt

				if s[ni] == '0' {
					ni = sch(ni, &a[1])
					//fmt.Println("--->",a[1])
				} else {
					ni = sch(ni, &a[0])
					//fmt.Println(";;;>",a[0])
				}
				//fmt.Println(b, ni)
			}
			//fmt.Println("-----------")
		}

		fmt.Println(cnt)

		for i := range b {
			fmt.Print(b[i], " ")
		}

		fmt.Println()
		//fmt.Println(s)
	}

}

package main

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

func main() {
	sc := bufio.NewScanner(os.Stdin)
	bf := make([]byte, 1024*1024)
	sc.Buffer(bf, 10*1024*1024)
	sc.Split(bufio.ScanWords)

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

	ins := func () string {
		sc.Scan()
		return sc.Text()
	}

	for t := ini(); t > 0; t-- {
		n := ini()
		s := ins()

		a := make([][]int, 2)

		for i := range a {
			a[i] = make([]int,0, n)
		}

		b := make([]int, n)

		cnt := 1

		for i := range s {
			if s[i] == '0' {
				if len(a[1]) == 0 {
					a[0] = append(a[0], cnt)
					cnt++
				} else {
					m := len(a[1])
					a[0] = append(a[0], a[1][m-1])
					a[1] = a[1][0:m-1]
				}
				b[i] = a[0][len(a[0])-1]
			} else {
				if len(a[0]) == 0 {
					a[1] = append(a[1], cnt)
					cnt++
				} else {
					m := len(a[0])
					a[1] = append(a[1], a[0][m-1])
					a[0] = a[0][0:m-1]
				}
				b[i] = a[1][len(a[1])-1]
			}
		}

		fmt.Println(cnt)

		for i := range b {
			fmt.Print(b[i], " ")
		}

		fmt.Println()
	}

}

package main

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

func sch(i int, a *[]int) int {
	s := 0
	e := len(*a) - 1

	for s <= e {
		m := (s+e)/2

		if (*a)[m] > i {
			e = m-1
		} else {
			s = m+1
		}
	}

	if s == len(*a) {
		return -1
	}

	tmp := (*a)[s]

	if s == 0 {
		*a = (*a)[1:]
	}

	return tmp
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	bf := make([]byte, 1024*1024)
	sc.Buffer(bf, 10*1024*1024)
	sc.Split(bufio.ScanWords)

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

	ins := func () string {
		sc.Scan()
		return sc.Text()
	}

	for t := ini(); t > 0; t-- {
		n := ini()
		s := ins()

		a := make([][]int, 2)

		for i := range a {
			a[i] = make([]int, 0)
			for j := range s {
				if s[j] == byte(i + '0') {
					a[i] = append(a[i], j)
				}
			}
		}

		cnt := 0
		b := make([]int, n)

		for i := range b {
			b[i] = -1
		}

		for i := range s {
			if b[i] != -1 {
				continue
			}

			cnt++
			ni := i
			for ni != -1 {
				b[ni] = cnt

				if s[ni] == '0' {
					ni = sch(ni, &a[1])
					//fmt.Println("--->",a[1])
				} else {
					ni = sch(ni, &a[0])
					//fmt.Println(";;;>",a[0])
				}
				//fmt.Println(b, ni)
			}
		}

		fmt.Println(cnt)

		for i := range b {
			fmt.Print(b[i], " ")
		}

		fmt.Println()
		// fmt.Println(a)
	}

}

package main

import "fmt"

func main() {
    var t, n int
    var s []byte
    var q0, q1, ans []int
    q0 = make([]int, 200005)
    q1 = make([]int, 200005)
    ans = make([]int, 200005)
    fmt.Scan(&t)
    for ; t > 0; t-- {
        fmt.Scan(&n)
        fmt.Scan(&s)
        q0front := 0
        q0back := 0
        q1front := 0
        q1back := 0
        count := 0
        for i := 0; i < n; i++ {
            if s[i] == '0' && q0front == q0back {
                count++
                q1[q1back] = count
                q1back++
                ans[i] = count
            } else if s[i] == '0' && q0front < q0back {
                ans[i] = q0[q0front]
                q1[q1back] = q0[q0front]
                q0front++
                q1back++
            } else if s[i] == '1' && q1front == q1back {
                count++
                q0[q0back] = count
                q0back++
                ans[i] = count
            } else if s[i] == '1' && q1front < q1back {
                ans[i] = q1[q1front]
                q0[q0back] = q1[q1front]
                q1front++
                q0back++
            }
        }
        for i := 0; i < n; i++ {
            fmt.Printf("%v ", ans[i])
        }
        fmt.Println("")
    }
}


There are $$$n$$$ pieces of tangerine peel, the $$$i$$$-th of them has size $$$a_i$$$. In one step it is possible to divide one piece of size $$$x$$$ into two pieces of positive integer sizes $$$y$$$ and $$$z$$$ so that $$$y + z = x$$$.You want that for each pair of pieces, their sizes differ strictly less than twice. In other words, there should not be two pieces of size $$$x$$$ and $$$y$$$, such that $$$2x \le y$$$. What is the minimum possible number of steps needed to satisfy the condition?

The first line of the input contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The description of test cases follows. The first line of each test case contains the integer $$$n$$$ ($$$1 \le n \le 100$$$). Then one line follows, containing $$$n$$$ integers $$$a_1 \le a_2 \le \ldots \le a_n$$$ ($$$1 \le a_i \le 10^7$$$).

For each test case, output a single line containing the minimum number of steps.

NoteIn the first test case, we initially have a piece of size $$$1$$$, so all final pieces must have size $$$1$$$. The total number of steps is: $$$0 + 1 + 2 + 3 + 4 = 10$$$.In the second test case, we have just one piece, so we don't need to do anything, and the answer is $$$0$$$ steps.In the third test case, one of the possible cut options is: $$$600,\ 900,\ (600 | 700),\ (1000 | 1000),\ (1000 | 1000 | 550)$$$. You can see this option in the picture below. The maximum piece has size $$$1000$$$, and it is less than $$$2$$$ times bigger than the minimum piece of size $$$550$$$. $$$4$$$ steps are done. We can show that it is the minimum possible number of steps.

package main

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

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

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

		aa := make([]int, n)
		for i := 0; i < n; i++ {
			fmt.Fscan(in, &aa[i])
		}
		sort.Ints(aa)

		var tot int
		for i := 1; i < n; i++ {
			tot += aa[i] / (aa[0]*2 - 1)
			if aa[i]%(aa[0]*2-1) == 0 {
				tot--
			}
		}

		fmt.Fprintln(out, tot)
	}
}

package main

import "fmt"

func main() {
	round := 0
	fmt.Scanf("%d\n", &round)
	for i := 0; i < round; i++ {
		number := 0
		fmt.Scanf("%d\n", &number)
		series := [110]int{}
		for j := 0; j < number; j++ {
			fmt.Scanf("%d", &series[j])
		}
		fmt.Scanln()
		minn := series[0]
		cuts := 0
		for j := 1; j < number; j++ {
			tmp := series[j] / (minn*2 - 1)
			if tmp*(minn*2-1) < series[j] {
				tmp++
			}
			tmp--
			cuts += tmp
			if tmp != 0 && series[j]/tmp < minn {
				minn = series[j] / tmp
			}
		}
		fmt.Println(cuts)
	}
	return
}

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

package main

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

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

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

func solve() {
	var n int
	scan(&n)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		scan(&a[i])
	}
	mx := 2*a[0] - 1
	r := 0
	for i := 1; i < n; i++ {
		t := int(a[i] / mx)
		if a[i]%mx == 0 {
			t--
		}
		r += t
	}
	printf("%d\n", r)
}
func main() {
	defer out.Flush()
	n := 0
	scan(&n)
	for i := 0; i < n; i++ {
		solve()
	}
}

package main

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

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

func init() {
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 4096), 1e9)
}

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

func _int() int {
	s := _string()
	i := 0
	if s[0] == '-' {
		for _, r := range s[1:] {
			i *= 10
			i -= int(r - '0')
		}
		return i
	}
	for _, r := range s {
		i *= 10
		i += int(r - '0')
	}
	return i
}

func _int64() int64 {
	s := _string()
	i := int64(0)
	if s[0] == '-' {
		for _, r := range s[1:] {
			i *= 10
			i -= int64(r - '0')
		}
		return i
	}
	for _, r := range s {
		i *= 10
		i += int64(r - '0')
	}
	return i
}

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

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

func sol(n int, a []int) int {
	low := a[0]
	for i := range a {
		if a[i] < low {
			low = a[i]
		}
	}
	ret := 0
	for i := range a {
		ret += ceilDiv(a[i], low*2-1) - 1
	}
	return ret
}

func ceilDiv(n, k int) int {
	return (n + k - 1) / k
}

package main

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

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

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

		min := 10000001
		for j := 0; j < n; j++ {
			fmt.Fscan(r, &a[j])
			if min > a[j] {
				min = a[j]
			}
		}

		p := 2*min - 1
		s := 0

		// fmt.Fprintln(w, "%%%% min p a ", min, p, a)
		for _, v := range a {
			s += v/p - 1
			if v%p != 0 {
				s++
			}
		}

		fmt.Fprintln(w, s)
	}
}

/*
	A template for Go on codeforces.com
	Author: Yakov, frvr.ru
*/

package main

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

func main() {
	// START WRITING YOUR SOLUTION HERE:
	// writeLine(typeOf(readInt()))

	nc := readInt()
	for i := 0; i < nc; i++ {
		readInt()
		a := readInts()
		// fmt.Println(a)
		// min := a[0]
		maxpart := 2*a[0] - 1
		tot := 0
		for i := range a {
			if a[i] >= maxpart {
				dt := (a[i]+maxpart-1)/maxpart - 1
				// fmt.Println(a[i], dt)
				tot += dt
			}
		}
		fmt.Println(tot)
	}
}

/* ~~~~~~~~~~ */
/* ~~~~~~~~~~ */
/* ~~~~~~~~~~ */

var in = bufio.NewReader(os.Stdin)

type float = float32
type double = float64
type long = int64
type ulong = uint64

func typeOf(arg interface{}) string {
	switch reflect.TypeOf(arg).Kind() {
	case reflect.Int:
		return "int"
	case reflect.Int8:
		return "int8"
	case reflect.Int16:
		return "int16"
	case reflect.Int32:
		return "int32"
	case reflect.Int64:
		return "int64"
	case reflect.Uint:
		return "uint"
	case reflect.Uint8:
		return "uint8"
	case reflect.Uint16:
		return "uint16"
	case reflect.Uint32:
		return "uint32"
	case reflect.Uint64:
		return "uint64"
	case reflect.Float32:
		return "float32"
	case reflect.Float64:
		return "float64"
	case reflect.Complex64:
		return "complex64"
	case reflect.Complex128:
		return "complex128"
	case reflect.Bool:
		return "bool"
	case reflect.String:
		return "string"
	case reflect.Chan:
		return "chan"
	case reflect.Ptr:
		return "ptr"
	case reflect.Uintptr:
		return "uintptr"
	case reflect.UnsafePointer:
		return "unsafeptr"
	case reflect.Interface:
		return "interface"
	case reflect.Array:
		return "array"
	case reflect.Slice:
		return "slice"
	case reflect.Map:
		return "map"
	case reflect.Struct:
		return "struct"
	case reflect.Func:
		return "func"
	case reflect.Invalid:
		return "invalid"
	default:
		return "nil"
	}
}

/* ~~~~~~~~~~ */

func _scln() string {
	ln, _ := in.ReadString('\n')
	return strings.Trim(ln, " \r\n")
}
func _sc(s []string) string {
	if len(s) == 0 {
		return _scln()
	}
	return s[0]
}

func readLine() string              { return _scln() }
func readString() string            { return _scln() }
func readStrings() []string         { return strings.Split(_scln(), " ") }
func readBool(s ...string) bool     { t, _ := strconv.ParseBool(_sc(s)); return t }
func readByte(s ...string) byte     { t, _ := strconv.ParseUint(_sc(s), 10, 8); return byte(t) }
func readDouble(s ...string) double { t, _ := strconv.ParseFloat(_sc(s), 64); return t }
func readFloat(s ...string) float   { t, _ := strconv.ParseFloat(_sc(s), 32); return float32(t) }
func readInt(s ...string) int       { t, _ := strconv.Atoi(_sc(s)); return t }
func readLong(s ...string) long     { t, _ := strconv.ParseInt(_sc(s), 10, 64); return t }
func readULong(s ...string) ulong   { t, _ := strconv.ParseUint(_sc(s), 10, 64); return t }

/* ~~~~~~~~~~ */

// Too much overhead with universal method using interface{}, wait for the generics,
// but for now — just don't look at the redundancy of the code after that commentary :)

func readBools() []bool {
	strs := readStrings()
	arr := make([]bool, len(strs))
	for i, s := range strs {
		arr[i] = readBool(s)
	}
	return arr
}
func readBytes() []byte {
	strs := readStrings()
	arr := make([]byte, len(strs))
	for i, s := range strs {
		arr[i] = readByte(s)
	}
	return arr
}
func readDoubles() []double {
	strs := readStrings()
	arr := make([]double, len(strs))
	for i, s := range strs {
		arr[i] = readDouble(s)
	}
	return arr
}
func readFloats() []float {
	strs := readStrings()
	arr := make([]float, len(strs))
	for i, s := range strs {
		arr[i] = readFloat(s)
	}
	return arr
}
func readInts() []int {
	strs := readStrings()
	arr := make([]int, len(strs))
	for i, s := range strs {
		arr[i] = readInt(s)
	}
	return arr
}
func readLongs() []long {
	strs := readStrings()
	arr := make([]long, len(strs))
	for i, s := range strs {
		arr[i] = readLong(s)
	}
	return arr
}
func readULongs() []ulong {
	strs := readStrings()
	arr := make([]ulong, len(strs))
	for i, s := range strs {
		arr[i] = readULong(s)
	}
	return arr
}

/* ~~~~~~~~~~ */

func write(arg ...interface{})                 { fmt.Print(arg...) }
func writeLine(arg ...interface{})             { fmt.Println(arg...) }
func writeFormat(f string, arg ...interface{}) { fmt.Printf(f, arg...) }

package main

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

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

func main() {
	defer out.Flush()

	var tc, n, a0, a int
	for fmt.Fscan(in, &tc); tc > 0; tc-- {
		fmt.Fscan(in, &n, &a0)
		ans := 0
		cutsize := a0*2 - 1
		for i := 1; i < n; i++ {
			fmt.Fscan(in, &a)
			ans += (a - 1) / cutsize
		}
		fmt.Fprintln(out, ans)
	}
}

package main

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

const cf = true

func solve() {
	var n int
	fmt.Fscan(in, &n)
	arr := make([]int, n)
	var mn int = 1e11
	for i := range arr {
		fmt.Fscan(in, &arr[i])
		mn = min(mn, arr[i])
	}
	target := mn*2 - 1
	used := false
	ans := 0
	for i := range arr {
		if !used && arr[i] == mn {
			used = true
			continue
		}
		ans += arr[i] / target
		if arr[i]%target == 0 {
			ans--
		}
	}
	fmt.Fprintln(out, ans)
}

func main() {
	defer out.Flush()
	t := 1
	fmt.Fscan(in, &t)
	for ; t > 0; t-- {
		solve()
	}
}

func ConvertInt(val string, base, toBase int) (string, error) {
	i, err := strconv.ParseInt(val, base, 64)
	if err != nil {
		return "", err
	}
	return strconv.FormatInt(i, toBase), nil
}

type set[T Ordered] struct {
	itms map[T]struct{}
}

func (s *set[T]) init() {
	if s.itms == nil {
		s.itms = make(map[T]struct{})
	}
}

func (s *set[T]) add(item T) *set[T] {
	s.init()
	s.itms[item] = exists
	return s
}

func (s *set[T]) remove(item T) *set[T] {
	s.init()
	delete(s.itms, item)
	return s
}

func (s *set[T]) has(item T) bool {
	s.init()
	_, c := s.itms[item]
	return c
}

func (s *set[T]) sortedItems() []T {
	s.init()
	items := make([]T, 0, s.size())
	for item := range s.itms {
		items = append(items, item)
	}
	sort.Slice(items, func(i, j int) bool {
		return items[i] < items[j]
	})
	return items
}

func (s *set[T]) items() []T {
	s.init()
	items := make([]T, 0, s.size())
	for item := range s.itms {
		items = append(items, item)
	}
	return items
}

func (s *set[T]) size() int {
	s.init()
	return len(s.itms)
}

var exists = struct{}{}

const MaxUint = ^uint(0)
const MinUint = 0
const MaxInt = int(MaxUint >> 1)
const MinInt = -MaxInt - 1

func reverseStr(s string) string {
	r := []rune(s)
	for i, j := 0, len(r)-1; i < len(r)/2; i, j = i+1, j-1 {
		r[i], r[j] = r[j], r[i]
	}
	return string(r)
}

type Float interface {
	~float32 | ~float64
}

type Integer interface {
	Signed | Unsigned
}

type Signed interface {
	~int | ~int8 | ~int16 | ~int32 | ~int64
}

type Unsigned interface {
	~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr
}

type Ordered interface {
	Integer | Float | ~string
}

func abs[T Signed](x T) T {
	if x < 0 {
		return -x
	}
	return x
}

func min[T Ordered](x, y T) T {
	if x < y {
		return x
	}
	return y
}

func max[T Ordered](x, y T) T {
	if x > y {
		return x
	}
	return y
}

var (
	in  = getReader()
	out = getWriter()
)

func getReader() *bufio.Reader {
	if cf {
		return bufio.NewReader(os.Stdin)
	} else {
		in, _ := os.Open("input.txt")
		return bufio.NewReader(in)
	}
}

func getWriter() *bufio.Writer {
	if cf {
		return bufio.NewWriter(os.Stdout)
	} else {
		out, _ := os.Create("output.txt")
		return bufio.NewWriter(out)
	}
}


Heidi's friend Jenny is asking Heidi to deliver an important letter to one of their common friends. Since Jenny is Irish, Heidi thinks that this might be a prank. More precisely, she suspects that the message she is asked to deliver states: "Send the fool further!", and upon reading it the recipient will ask Heidi to deliver the same message to yet another friend (that the recipient has in common with Heidi), and so on.Heidi believes that her friends want to avoid awkward situations, so she will not be made to visit the same person (including Jenny) twice. She also knows how much it costs to travel between any two of her friends who know each other. She wants to know: what is the maximal amount of money she will waste on travel if it really is a prank?Heidi's n friends are labeled 0 through n - 1, and their network of connections forms a tree. In other words, every two of her friends a, b know each other, possibly indirectly (there is a sequence of friends starting from a and ending on b and such that each two consecutive friends in the sequence know each other directly), and there are exactly n - 1 pairs of friends who know each other directly.Jenny is given the number 0.

The first line of the input contains the number of friends n (3 ≤ n ≤ 100). The next n - 1 lines each contain three space-separated integers u, v and c (0 ≤ u, v ≤ n - 1, 1 ≤ c ≤ 104), meaning that u and v are friends (know each other directly) and the cost for travelling between u and v is c. It is guaranteed that the social network of the input forms a tree.

Output a single integer – the maximum sum of costs.

NoteIn the second example, the worst-case scenario goes like this: Jenny sends Heidi to the friend labeled by number 2 (incurring a cost of 100), then friend 2 sends her to friend 1 (costing Heidi 3), and finally friend 1 relays her to friend 4 (incurring an additional cost of 2).

package main

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

func solve() {
	n := readInt()
	g := make([][][]int, n)
	for i := 0; i < n; i++ {
		g[i] = make([][]int, 0)
	}
	for i := 0; i < n - 1; i++ {
		u := readInt()
		v := readInt()
		c := readInt()
		g[u] = append(g[u], []int{v, c})
		g[v] = append(g[v], []int{u, c})
	}
	vis := make([]bool,  n)
	fmt.Println(dfs(g, vis,0))
}

func dfs(g [][][]int, vis []bool, u int) int {
	vis[u] = true
	best := 0
	for _, vc := range g[u] {
		v := vc[0]
		c := vc[1]
		if !vis[v] {
			best = max(best, c + dfs(g, vis, v))
		}
	}

	return best
}

var scanner *bufio.Scanner

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

// IO

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

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

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

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

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

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

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