The 2050 volunteers are organizing the "Run! Chase the Rising Sun" activity. Starting on Apr 25 at 7:30 am, runners will complete the 6km trail around the Yunqi town.There are $$$n+1$$$ checkpoints on the trail. They are numbered by $$$0$$$, $$$1$$$, ..., $$$n$$$. A runner must start at checkpoint $$$0$$$ and finish at checkpoint $$$n$$$. No checkpoint is skippable — he must run from checkpoint $$$0$$$ to checkpoint $$$1$$$, then from checkpoint $$$1$$$ to checkpoint $$$2$$$ and so on. Look at the picture in notes section for clarification.Between any two adjacent checkpoints, there are $$$m$$$ different paths to choose. For any $$$1\le i\le n$$$, to run from checkpoint $$$i-1$$$ to checkpoint $$$i$$$, a runner can choose exactly one from the $$$m$$$ possible paths. The length of the $$$j$$$-th path between checkpoint $$$i-1$$$ and $$$i$$$ is $$$b_{i,j}$$$ for any $$$1\le j\le m$$$ and $$$1\le i\le n$$$.To test the trail, we have $$$m$$$ runners. Each runner must run from the checkpoint $$$0$$$ to the checkpoint $$$n$$$ once, visiting all the checkpoints. Every path between every pair of adjacent checkpoints needs to be ran by exactly one runner. If a runner chooses the path of length $$$l_i$$$ between checkpoint $$$i-1$$$ and $$$i$$$ ($$$1\le i\le n$$$), his tiredness is $$$$$$\min_{i=1}^n l_i,$$$$$$ i. e. the minimum length of the paths he takes.Please arrange the paths of the $$$m$$$ runners to minimize the sum of tiredness of them.

Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10\,000$$$). Description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n,m \leq 100$$$). The $$$i$$$-th of the next $$$n$$$ lines contains $$$m$$$ integers $$$b_{i,1}$$$, $$$b_{i,2}$$$, ..., $$$b_{i,m}$$$ ($$$1 \le b_{i,j} \le 10^9$$$). It is guaranteed that the sum of $$$n\cdot m$$$ over all test cases does not exceed $$$10^4$$$.

For each test case, output $$$n$$$ lines. The $$$j$$$-th number in the $$$i$$$-th line should contain the length of the path that runner $$$j$$$ chooses to run from checkpoint $$$i-1$$$ to checkpoint $$$i$$$. There should be exactly $$$m$$$ integers in the $$$i$$$-th line and these integers should form a permuatation of $$$b_{i, 1}$$$, ..., $$$b_{i, m}$$$ for all $$$1\le i\le n$$$. If there are multiple answers, print any.

NoteIn the first case, the sum of tiredness is $$$\min(2,5) + \min(3,3) + \min(4,1) = 6$$$.  In the second case, the sum of tiredness is $$$\min(2,4,3) + \min(3,1,5) = 3$$$.

package main

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

	//"math"
	"os"
)

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

	var t int
	for Fscan(in, &t); t > 0; t-- {
		var n, m int
		Fscan(in, &n, &m)

		paths := make([][2]int, n * m)

		for i, _ := range paths {
			Fscan(in, &paths[i][0])
			paths[i][1] = i
		}

		sort.Slice(paths, func(i, j int) bool {
			return paths[i][0] < paths[j][0]
		})

		ans := make([][]int, n)
		for i, _ := range ans {
			ans[i] = make([]int, m)
		}

		for i := 0; i < m; i++ {
			ans[paths[i][1] / m][i] = paths[i][0]
		}

		for i := m; i < len(paths); i++ {
			for j, _ := range ans[paths[i][1] / m] {
				if ans[paths[i][1] / m][j] == 0 {
					ans[paths[i][1] / m][j] = paths[i][0]
					break
				}
			}
		}

		for _, row := range ans {
			for _, cell := range row {
				Fprint(out, cell, " ")
			}
			Fprintln(out)
		}
	}
}

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

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

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

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

package main

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

	//"math"
	"os"
)

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

	var t int
	for Fscan(in, &t); t > 0; t-- {
		var n, m int
		Fscan(in, &n, &m)

		paths := make([][2]int, n * m)

		for i, _ := range paths {
			Fscan(in, &paths[i][0])
			paths[i][1] = i
		}

		sort.Slice(paths, func(i, j int) bool {
			return paths[i][0] < paths[j][0]
		})

		ans := make([][]int, n)
		for i, _ := range ans {
			ans[i] = make([]int, m)
		}

		for i, cnt := 0, 0; i < m; i++ {
			ans[paths[i][1] / m][cnt] = paths[i][0]
			cnt++
		}

		for i := m; i < len(paths); i++ {
			for j, _ := range ans[paths[i][1] / m] {
				if ans[paths[i][1] / m][j] == 0 {
					ans[paths[i][1] / m][j] = paths[i][0]
					break
				}
			}
		}

		for _, row := range ans {
			for _, cell := range row {
				Fprint(out, cell, " ")
			}
			Fprintln(out)
		}
	}
}

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

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

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

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

package main

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

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

	var T, n, m int
	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &n, &m)
		a := make([][]int, n)
		for i := range a {
			a[i] = make([]int, m)
			for j := range a[i] {
				Fscan(in, &a[i][j])
			}
			sort.Ints(a[i])
		}
		for j := m; j > 1; j-- {
			p := 0
			for i, r := range a {
				if r[0] < a[p][0] {
					p = i
				}
			}
			a[p] = append(append(append([]int(nil), a[p][1:j]...), a[p][0]), a[p][j:]...)
		}
		for _, r := range a {
			for _, v := range r {
				Fprint(out, v, " ")
			}
			Fprintln(out)
		}
	}
}

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

package main

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

type path struct {
	i, j, l int
}

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

	var t int

	fmt.Fscanf(reader, "%d\n", &t)
	for ; t > 0; t-- {
		var n, m int
		fmt.Fscanf(reader, "%d %d\n", &n, &m)
		allPath := make([]path, 0, n*m)
		var tempPath path
		for i, j := 0, 0; i < n; i++ {
			tempPath.i = i
			for j = 0; j < m-1; j++ {
				tempPath.j = j
				fmt.Fscanf(reader, "%d ", &tempPath.l)
				allPath = append(allPath, tempPath)
			}

			tempPath.j = j
			fmt.Fscanf(reader, "%d\n", &tempPath.l)
			allPath = append(allPath, tempPath)
		}

		sort.Slice(allPath, func(i, j int) bool { return allPath[i].l < allPath[j].l })

		var ans [102][102]int

		for j := 1; j <= m; j++ {
			temp := allPath[j-1]
			ans[temp.i][j] = temp.l
		}

		for j := m; j < len(allPath); j++ {
			temp := allPath[j]

			start := ans[temp.i][0] + 1

			for ; ans[temp.i][start] > 0; start++ {

			}

			ans[temp.i][start] = temp.l
		}

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

			fmt.Printf("%d\n", ans[i][m])
		}
	}
}


In order to write a string, Atilla needs to first learn all letters that are contained in the string.Atilla needs to write a message which can be represented as a string $$$s$$$. He asks you what is the minimum alphabet size required so that one can write this message.The alphabet of size $$$x$$$ ($$$1 \leq x \leq 26$$$) contains only the first $$$x$$$ Latin letters. For example an alphabet of size $$$4$$$ contains only the characters $$$\texttt{a}$$$, $$$\texttt{b}$$$, $$$\texttt{c}$$$ and $$$\texttt{d}$$$.

The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the length of the string. The second line of each test case contains a string $$$s$$$ of length $$$n$$$, consisting of lowercase Latin letters.

For each test case, output a single integer — the minimum alphabet size required to so that Atilla can write his message $$$s$$$.

5

1

a

4

down

10

codeforces

3

bcf

5

zzzzz

NoteFor the first test case, Atilla needs to know only the character $$$\texttt{a}$$$, so the alphabet of size $$$1$$$ which only contains $$$\texttt{a}$$$ is enough.For the second test case, Atilla needs to know the characters $$$\texttt{d}$$$, $$$\texttt{o}$$$, $$$\texttt{w}$$$, $$$\texttt{n}$$$. The smallest alphabet size that contains all of them is $$$23$$$ (such alphabet can be represented as the string $$$\texttt{abcdefghijklmnopqrstuvw}$$$).

package main

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

func main() {
    reader := bufio.NewReader(os.Stdin)
    line, _ := reader.ReadString('\n')
    T, err := strconv.Atoi(line[:len(line)-2])
   if err != nil {
       fmt.Println(err)
   }
    for t:= 0; t < T; t++ {
        line, _ := reader.ReadString('\n')
        n, _ := strconv.Atoi(line[:len(line)-2])
        s, _ := reader.ReadString('\n')
        z := 0
        for i:= 0; i < n; i++ {
            x := int(s[i]) - 97 + 1
            if x > z {
                z = x
            }
        }
        fmt.Println(z)
    }
}

package main

import (
	"fmt"
)

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

	for i := 0; i < t; i++ {
		execute()
	}
}

func execute() {
	var max rune
	var x int
	fmt.Scan(&x)
	var s string
	fmt.Scan(&s)
	for _, v := range s {
		if v > max {
			max = v
		}
	}
	fmt.Println(max - 'a' + 1)
}

package main

import (
	"bufio"
	"bytes"
	"fmt"
	"index/suffixarray"
	"log"
	"math"
	"net"
	"os"
	"path"
	"sort"
	"strconv"
	"strings"
	"time"
)

// For Codeforces
func main() {
	io := newStdIO()
	defer io.Flush()
	for T := io.ScanUInt16(); T > 0; T-- {
		solve(&io)
	}
}
func solve(io *IO) {
	n := io.ScanInt32()
	s := io.ScanString()

	var max byte = 'a'
	for i := int32(0); i < n; i++ {
		if s[i] > max {max = s[i]}
	}
	io.PrintLn(max - 'a'+1)
}

// #region INTERFACES

// From https://pkg.go.dev/golang.org/x/exp/constraints
type Signed interface {
	~int | ~int8 | ~int16 | ~int32 | ~int64
}
type Unsigned interface {
	~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr
}
type Integer interface {
	Signed | Unsigned
}
type Float interface {
	~float32 | ~float64
}
type Complex interface {
	~complex64 | ~complex128
}
type Ordered interface {
	Integer | Float | ~string
}

type Prioritizable[T any] interface {
	PriorTo(x T) bool // If you take this as a relation: if (a,b) in R => (b,a) not in R
}

// #endregion
// #region TYPES WITH METHODS
// #region SingleLinkedList
type singleLinkedListNode[T comparable] struct {
	Value T
	Next  *singleLinkedListNode[T]
}

type SingleLinkedList[T comparable, IndexType Unsigned] struct {
	first  *singleLinkedListNode[T]
	last   *singleLinkedListNode[T]
	length IndexType
}

func NewSingleLinkedList[T comparable, IndexType Unsigned]() *SingleLinkedList[T, IndexType] {
	return &SingleLinkedList[T, IndexType]{
		first:  nil,
		last:   nil,
		length: 0,
	}
}
func (l *SingleLinkedList[T, I]) Len() I { return l.length }

// length > 0
func (l *SingleLinkedList[T, I]) First() T { return l.first.Value }

// length > 0
func (l *SingleLinkedList[T, I]) Last() T { return l.last.Value }

func (l *SingleLinkedList[T, I]) InsertFirst(value T) {
	if l.length == 0 {
		nodeToInsert := &singleLinkedListNode[T]{
			Value: value,
			Next:  l.first,
		}
		l.first = nodeToInsert
		l.last = nodeToInsert
	} else {
		l.first = &singleLinkedListNode[T]{
			Value: value,
			Next:  l.first,
		}
	}
	l.length++
}

func (l *SingleLinkedList[T, I]) InsertLast(value T) {
	if l.length == 0 {
		nodeToInsert := &singleLinkedListNode[T]{
			Value: value,
			Next:  l.first,
		}
		l.first = nodeToInsert
		l.last = nodeToInsert
	} else {
		l.last.Next = &singleLinkedListNode[T]{
			Value: value,
			Next:  nil,
		}
		l.last = l.last.Next
	}
	l.length++
}

// index <= length
func (l *SingleLinkedList[T, I]) InsertAt(index I, value T) {
	if index == 0 {
		l.InsertFirst(value)
		return
	}
	if index == l.length {
		l.InsertLast(value)
		return
	}

	n := l.first
	for index > 1 {
		n = n.Next
		index--
	}
	n.Next = &singleLinkedListNode[T]{
		Value: value,
		Next:  n.Next,
	}
	l.length++
}

func (l *SingleLinkedList[T, I]) Contains(value T) bool {
	tmp := l.first
	for i := I(0); i < l.length; i++ {
		if tmp.Value == value {
			return true
		}
		tmp = tmp.Next
	}
	return false
}
func (l *SingleLinkedList[T, I]) Clear() {
	l.first = nil
	l.last = nil
	l.length = 0
}

// index < length
func (l *SingleLinkedList[T, I]) GetElementAt(index I) T {
	n := l.first
	for index > 0 {
		n = n.Next
		index--
	}
	return n.Value
}

// index < length
func (l *SingleLinkedList[T, I]) SetElementAt(index I, value T) {
	n := l.first
	for index > 0 {
		n = n.Next
		index--
	}
	n.Value = value
}

func (l *SingleLinkedList[T, I]) RemoveFirst() T {
	tmp := l.first
	l.first = l.first.Next
	l.length--
	if l.length == 0 {
		l.last = nil
	}
	return tmp.Value
}
func (l *SingleLinkedList[T, I]) RemoveLast() (value T) {
	value = l.last.Value
	if l.length == 1 {
		l.first = nil
		l.last = nil
		l.length = 0
		return
	}

	tmp := l.first
	for i := I(2); i < l.length; i++ {
		tmp = tmp.Next
	}
	l.last = tmp
	return
}

func (l *SingleLinkedList[T, I]) RemoveAt(index I) T {
	if index == 0 {
		return l.RemoveFirst()
	}
	if index == l.length-1 {
		return l.RemoveLast()
	}

	tmp := l.first
	for i := I(1); i < index; i++ {
		tmp = tmp.Next
	}
	res := tmp.Next.Value
	tmp.Next = tmp.Next.Next
	return res
}

func (l *SingleLinkedList[T, I]) ToSlice() (res []T) {
	res = make([]T, 0, l.length)
	tmp := l.first
	for i := I(0); i < l.length; i++ {
		res = append(res, tmp.Value)
		tmp = tmp.Next
	}
	return
}
func (it *SingleLinkedList[T, I]) String() string {
	return "Qua:: " + fmt.Sprint(it.ToSlice())
}

// #endregion
// #region Queue

type Queue[T comparable, I Unsigned] struct {
	l SingleLinkedList[T, I]
}

func NewQueue[T comparable, I Unsigned]() *Queue[T, I] {
	return &Queue[T, I]{
		l: SingleLinkedList[T, I]{
			first:  nil,
			last:   nil,
			length: 0,
		},
	}
}
func (q *Queue[T, I]) Len() I          { return q.l.length }
func (q *Queue[T, I]) Enqueue(value T) { q.l.InsertLast(value) }
func (q *Queue[T, I]) Dequeue(T) T     { return q.l.RemoveFirst() }
func (q *Queue[T, I]) Preview() T      { return q.l.First() }
func (q *Queue[T, I]) String() string  { return q.l.String() }

// #endregion
// #region Stack

type Stack[T comparable, I Unsigned] struct {
	l SingleLinkedList[T, I]
}

func NewStack[T comparable, I Unsigned]() *Stack[T, I] {
	return &Stack[T, I]{
		l: SingleLinkedList[T, I]{
			first:  nil,
			last:   nil,
			length: 0,
		},
	}
}
func (s *Stack[T, I]) Len() I         { return s.l.length }
func (s *Stack[T, I]) Push(value T)   { s.l.InsertFirst(value) }
func (s *Stack[T, I]) Pop(T) T        { return s.l.RemoveFirst() }
func (s *Stack[T, I]) Preview() T     { return s.l.First() }
func (s *Stack[T, I]) String() string { return s.l.String() }

// #endregion
// #region Heap
type BinaryHeap[T Prioritizable[T], I Signed] struct {
	s []T
}

func NewBinaryHeap[T Prioritizable[T], I Signed](s []T) (h *BinaryHeap[T, I]) {
	h = &BinaryHeap[T, I]{
		s: s,
	}

	for i := (h.Len() - 2) / 2; i >= 0; i-- {
		h.heapifyDown(i)
	}
	return
}
func (h *BinaryHeap[T, I]) Len() I {
	return I(len(h.s))
}
func (h *BinaryHeap[T, I]) Push(value T) {
	h.s = append(h.s, value)
	h.heapifyUp(h.Len() - 1)
}
func (h *BinaryHeap[T, I]) Pop() (res T) {
	res = h.s[0]
	h.s[0] = h.s[h.Len()-1]
	h.s = h.s[:h.Len()-1]
	h.heapifyDown(0)
	return
}

func (h *BinaryHeap[T, I]) heapifyDown(index I) bool {
	origin := index
	for {
		j := index*2 + 2
		if j < h.Len() {
			if h.s[j-1].PriorTo(h.s[j]) {
				j--
			}
		} else {
			if j <= h.Len() && !h.s[j].PriorTo(h.s[index]) {
				h.s[j], h.s[index] = h.s[index], h.s[j]
			}
			break
		}
		if h.s[j].PriorTo(h.s[index]) {
			h.s[j], h.s[index] = h.s[index], h.s[j]
			index = j
		} else {
			break
		}
	}
	return origin != index
}
func (h *BinaryHeap[T, I]) heapifyUp(index I) {
	for {
		parent := (index - 1) / 2
		if parent == index || h.s[parent].PriorTo(h.s[index]) {
			break
		}
		h.s[index], h.s[parent] = h.s[parent], h.s[index]
		index = parent
	}
}

// #endregion

// #endregion

// #region FUNCTIONS
func Max[T Ordered](a, b T) T {
	if a >= b {
		return a
	}
	return b
}
func Min[T Ordered](a, b T) T {
	if a <= b {
		return a
	}
	return b
}
func Abs[T Integer | Float](a T) T {
	if a < 0 {
		return -a
	}
	return a
}
func Swap[T any](a, b *T) {
	*a, *b = *b, *a
}

// At least one != 0
func GCD[T Unsigned](a, b T) T {
	if b < a {
		Swap(&a, &b)
	}
	for {
		if a == 0 {
			return b
		}
		r := (b % a)
		b = a
		a = r
	}
}

// At least one != 0
func LCM[T Unsigned](a, b T) T {
	return (a * b) / GCD(a, b)
}

func First[T any](a T, _ any) T { return a }

// #endregion

// #region IO STUFF
type IO struct {
	r *bufio.Reader
	w *bufio.Writer
}

func newStdIO() IO {
	return IO{
		r: bufio.NewReader(os.Stdin),
		w: bufio.NewWriter(os.Stdout),
	}
}

// Is assumed that input.txt file exists
func newFileIO() IO {
	return IO{
		r: bufio.NewReader(First(os.Open("input.txt"))),
		w: bufio.NewWriter(First(os.OpenFile("output.txt", os.O_CREATE|os.O_RDWR|os.O_TRUNC, os.ModePerm))),
	}
}

func (io *IO) ScanInt8() (x int8)   { fmt.Fscan(io.r, &x); return }
func (io *IO) ScanInt16() (x int16) { fmt.Fscan(io.r, &x); return }
func (io *IO) ScanInt32() (x int32) { fmt.Fscan(io.r, &x); return }
func (io *IO) ScanInt64() (x int64) { fmt.Fscan(io.r, &x); return }

func (io *IO) ScanUInt8() (x uint8)   { fmt.Fscan(io.r, &x); return }
func (io *IO) ScanUInt16() (x uint16) { fmt.Fscan(io.r, &x); return }
func (io *IO) ScanUInt32() (x uint32) { fmt.Fscan(io.r, &x); return }
func (io *IO) ScanUInt64() (x uint64) { fmt.Fscan(io.r, &x); return }

func (io *IO) ScanFloat32() (x float32) { fmt.Fscan(io.r, &x); return }
func (io *IO) ScanFloat64() (x float64) { fmt.Fscan(io.r, &x); return }

func (io *IO) ScanString() (x string) { fmt.Fscan(io.r, &x); return }

func (io *IO) Print(x ...any)   { fmt.Fprint(io.w, x...) }
func (io *IO) PrintLn(x ...any) { fmt.Fprintln(io.w, x...) }

func (io *IO) Flush() { io.w.Flush() }

// #endregion

// #region KEEP IMPORTS
func D() {
	_ = bufio.Reader{}
	_ = bytes.Buffer{}
	_ = suffixarray.Index{}
	_ = log.Default()
	_ = math.Abs(0)
	_ = net.Dialer{}
	_ = path.ErrBadPattern
	_ = sort.Float64sAreSorted(nil)
	_ = strconv.ErrRange
	_ = strings.Builder{}
	_ = time.ANSIC
	_ = newStdIO()
	_ = newFileIO()
}

// #endregion

package main
// github.com/jamesgrimard/codeforces
import(
    "fmt"
    "bufio"
    "os"
)
func main() {
	in:= bufio.NewReader(os.Stdin)
	out:= bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in,&t)
	for i:=0;i<t;i++{
		var n int
		var s string
		fmt.Fscan(in,&n,&s)
		var max byte = 0
		for j:=0;j<n;j++{
			if s[j] > max {
				max = s[j]
			}
		}
		fmt.Fprintln(out,max-96)
	}
}

package main

import "fmt"

func main() {
	var (
		t int
		n int
		str string
		max byte
	)
	fmt.Scanln(&t)
	for i := 0; i < t; i++ {
		fmt.Scanln(&n)
		fmt.Scanln(&str)
		max = str[0]
		for j := 0; j < n; j++ {
			if max < str[j] {
				max = str[j]
			}
		}
		fmt.Println(max - 96)
	}
}

package main

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

const cf = true

func solve() {
	var n int
	fmt.Fscan(in, &n)
	var str string
	fmt.Fscan(in, &str)
	mx := 0
	for i := range str {
		mx = max(mx, int(str[i]-'a'+1))
	}
	fmt.Fprintln(out, mx)
}

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

func LCM(a, b int) int {
	return a * b / GCD(a, b)
}

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

	return a
}

type SqrtInt interface {
	SignedSqrt | UnsignedSqrt
}

type SignedSqrt interface {
	~int | ~int32 | ~int64
}

type UnsignedSqrt interface {
	~uint | ~uint32 | ~uint64 | ~uintptr
}

func sqrt[T SqrtInt](x T) T {
	l, r := T(0), T(2000000123)
	for l < r {
		mid := (l + r) / 2
		if mid*mid > x {
			r = mid
		} else {
			l = mid + 1
		}
	}
	return l - 1
}

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
}

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

func reverseStr(s string) string {
	r := []byte(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)
	}
}

package main

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

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

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

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

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

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

/**
Run solve the problem CF1760B
Date: 11/21/2022
User: wotan
URL: https://codeforces.com/problemset/problem/1760/B
Problem: CF1760B
**/
func (in *CF1760B) Run() {
	for t := in.NextInt(); t > 0; t-- {
		n := in.NextInt()
		str := in.NextString()
		max := 0
		for i := 0; i < n; i++ {
			v := int(str[i] - 'a')
			if v > max {
				max = v
			}
		}
		fmt.Println(max+1)

	}
}

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

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

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

package main

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

// to sort a string
type sortRunes []rune

func (s sortRunes) Less(i, j int) bool {
	return s[i] < s[j]
}

func (s sortRunes) Swap(i, j int) {
	s[i], s[j] = s[j], s[i]
}

func (s sortRunes) Len() int {
	return len(s)
}

func SortString(s string) string {
	r := []rune(s)
	sort.Sort(sortRunes(r))
	return string(r)
}

func main() {
	n := readInt()
	for i := 0; i < n; i++ {
		l := readInt()
		s := readString()
		var max int
		for i := 0; i < l; i++ {
			d := int(s[i] - 'a')
			if max < d {
				max = d
			}
		}
		writeLine(max + 1)
	}
}

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

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"
	"strconv"
	"strings"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	t, _ := strconv.Atoi(scanner.Text())
	for i := 0; i < t; i++ {
		max := 0
		scanner.Scan()
		scanner.Scan()
		sl := strings.Split(scanner.Text(), "")
		for j := 0; j < len(sl); j++ {
			c := []rune(sl[j])
			if int(c[0]-'a'+1) > max {
				max = int(c[0]-'a') + 1
			}
		}
		fmt.Println(max)
	}
}

package main

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

func main() {
	var testCases int

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

	defer writer.Flush()
	fmt.Fscan(reader, &testCases)

	for testCase := 1; testCase <= testCases; testCase++ {
		var n int
		var s string
		fmt.Fscan(reader, &n)
		fmt.Fscan(reader, &s)

		output := solve(s, n)

		fmt.Fprintln(writer, output)
	}
}

func solve(s string, n int) int {

	max := 0
	for _, c := range s {
		t := int(c-'a') + 1
		if t > max {
			max = t
		}
	}

	return max

}

package main

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

func readArray(sc *bufio.Scanner) (arr []int) {
	sc.Scan()
	for _, value := range strings.Split(sc.Text(), " ") {
		number, _ := strconv.Atoi(value)
		arr = append(arr, number)
	}
	return
}

func readData(sc *bufio.Scanner) (a string) {
	sc.Scan()
	sc.Scan()
	a = sc.Text()
	return
}

func Sum(x, y int, arr []int) int {
	left, right := len(arr)-x, len(arr)-x+y
	l := 0
	if left != 0 {
		l = arr[left-1]
	}
	r := len(arr)
	if right <= len(arr) {
		r = arr[right-1]
	}
	return r - l
}

// 001   1
// 1010100101

func solve(a string) rune {
	max := rune(0)
	for _, i := range a {
		v := i - 96
		if v > max {
			max = v
		}
	}
	return max
}

func main() {
	var n int
	fmt.Scanln(&n)
	sc := bufio.NewScanner(os.Stdin)
	for ; n > 0; n-- {
		a := readData(sc)
		fmt.Println(solve(a))
	}
}

package main

import "fmt"

func main() {
	var n, t int
	var s string
	fmt.Scan(&t)
	for t > 0 {
		t--
		fmt.Scan(&n, &s)
		max := 'a'
		for _, c := range s {
			if c > max {
				max = c
			}
		}
		fmt.Println(max - 'a' + 1)
	}

}

package main

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

func solve(reader *bufio.Reader, writer *bufio.Writer) {
	_ = readInt(reader)
	s := readString(reader)

	maxx := 0
	for _, r := range s {
		maxx = max(int(r-'a'), maxx)
	}

	fmt.Fprintln(writer, maxx+1)
}

func main() {
	reader := bReader(os.Stdin)
	writer := bWriter(os.Stdout)

	t := readInt(reader)

	for t > 0 {
		solve(reader, writer)
		t--
	}

	writer.Flush()
}

func min[T int | int64](a, b T) T {
	if a < b {
		return a
	}

	return b
}

func max[T int | int64](a, b T) T {
	if a > b {
		return a
	}

	return b
}

func abs[T int | int64](a T) T {
	if a < 0 {
		return a * -1
	} else {
		return a
	}
}

func gcd[T int | int64](x, y T) T {
	for y > 0 {
		x, y = y, x%y
	}

	return x
}

func lcm[T int | int64](x, y T) T {
	return x * y / gcd(x, y)
}

func bReader(stdin *os.File) *bufio.Reader {
	return bufio.NewReaderSize(stdin, 16*1024*1024)
}

func bWriter(stdout *os.File) *bufio.Writer {
	return bufio.NewWriterSize(stdout, 16*1024*1024)
}

func readLine(reader *bufio.Reader) string {
	str, _, err := reader.ReadLine()
	if err == io.EOF {
		return ""
	}

	return strings.TrimRight(string(str), "\r\n")
}

func checkError(err error) {
	if err != nil {
		panic(err)
	}
}

func readInt(reader *bufio.Reader) int {
	return int(readInt64(reader))
}

func readInt64(reader *bufio.Reader) int64 {
	value, err := strconv.ParseInt(readLine(reader), 10, 64)
	checkError(err)

	return value
}

func readString(reader *bufio.Reader) string {
	return readLine(reader)
}

func readArrayString(reader *bufio.Reader) []string {
	return strings.Split(strings.TrimSpace(readLine(reader)), " ")
}

func readArrayInt(reader *bufio.Reader) []int {
	arTemp := strings.Split(strings.TrimSpace(readLine(reader)), " ")
	n := len(arTemp)

	var ar []int

	for i := 0; i < n; i++ {
		arItemTemp, err := strconv.ParseInt(arTemp[i], 10, 64)
		checkError(err)
		arItem := int(arItemTemp)
		ar = append(ar, arItem)
	}

	return ar
}

func readArrayInt64(reader *bufio.Reader) []int64 {
	arTemp := strings.Split(strings.TrimSpace(readLine(reader)), " ")
	n := len(arTemp)

	var ar []int64

	for i := 0; i < n; i++ {
		arItemTemp, err := strconv.ParseInt(arTemp[i], 10, 64)
		checkError(err)
		arItem := arItemTemp
		ar = append(ar, arItem)
	}

	return ar
}

func readTwoInt(reader *bufio.Reader) (int, int) {
	ar := readArrayInt(reader)
	return ar[0], ar[1]
}

func readTwoInt64(reader *bufio.Reader) (int64, int64) {
	ar := readArrayInt64(reader)
	return ar[0], ar[1]
}

func readThreeInt(reader *bufio.Reader) (int, int, int) {
	ar := readArrayInt(reader)
	return ar[0], ar[1], ar[2]
}

func readThreeInt64(reader *bufio.Reader) (int64, int64, int64) {
	ar := readArrayInt64(reader)
	return ar[0], ar[1], ar[2]
}

package main

import (
	"fmt"
)

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

func solve() {
	var s string
	var n int
	fmt.Scan(&n)
	fmt.Scan(&s)
	// n := len(s)
	mav := 0
	for _, r := range s {
		mav = max(mav, int(r - 'a') + 1)
	}
	fmt.Println(mav)
}

func main() {
	var t int
	fmt.Scan(&t)
	for i := 0; i < t; i++ {
		solve()
	}
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	//输入t
	var t, n int
	var s string
	fmt.Fscan(in, &t)
	//nums := make([]int, 3)
	for i := 0; i < t; i++ {
		fmt.Fscan(in, &n)
		fmt.Fscan(in, &s)
		ans := s[0] - 'a' + 1
		for j := 0; j < len(s); j++ {
			id := s[j] - 'a' + 1
			if id > ans {
				ans = id
			}
		}
		// 输出res
		fmt.Fprintln(out, ans)
	}
}

package main

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

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

func main() {
	var t, n int
	in := bufio.NewReader(os.Stdin)
	fmt.Fscan(in, &t)
	for i := 0; i < t; i++ {
		var s string
		fmt.Fscan(in, &n)
		fmt.Fscan(in, &s)
		mx := 0
		for _, v := range s {
			mx = max(mx, int(v-'a'+1))
		}
		fmt.Println(mx)
	}
}

package main

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

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

// source: _
func solve() {
	_, s := _readInt(), _readStr()
	l := make([]rune, 26)
	for _, r := range s {
		l[r-'a']++
	}
	for i := 25; i >= 0; i-- {
		if l[i] != 0 {
			_print(i + 1)
			return
		}
	}
}

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

// ====
func _readInt() int {
	var x int
	fmt.Fscan(in, &x)
	return x
}
func _readStr() string {
	var x string
	fmt.Fscan(in, &x)
	return x
}
func _readArr(x ...int) (int, []int) {
	var n int
	if len(x) == 0 {
		fmt.Fscan(in, &n)
	} else {
		n = x[0]
	}
	var v = make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscan(in, &v[i])
	}
	return n, v
}
func _print(x ...any) {
	fmt.Fprintln(out, x...)
}
func _max(x ...int) int {
	mi := 0
	for i := 1; i < len(x); i++ {
		if x[i] > x[mi] {
			mi = i
		}
	}
	return x[mi]
}
func _min(x ...int) int {
	mi := 0
	for i := 1; i < len(x); i++ {
		if x[i] < x[mi] {
			mi = i
		}
	}
	return x[mi]
}
func _sum(x ...int) int {
	res := 0
	for _, i := range x {
		res += i
	}
	return res
}
func _abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}
func _sortStr(x string) string {
	r := []rune(x)
	sort.Slice(r, func(i, j int) bool {
		return r[i] < r[j]
	})
	return string(r)
}
func _reverseInts(x []int) {
	n := len(x)
	for i := 0; i < n/2; i++ {
		x[i], x[n-1-i] = x[n-1-i], x[i]
	}
}
func _reverseStr(s string) string {
	x := []rune(s)
	n := len(x)
	for i := 0; i < n/2; i++ {
		x[i], x[n-1-i] = x[n-1-i], x[i]
	}
	return string(x)
}
func _makeMatrix(n, m int) [][]int {
	x := make([][]int, n)
	for i := range x {
		x[i] = make([]int, m)
	}
	return x
}

package main

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

var sc = bufio.NewScanner(os.Stdin)

const mod int = 998244353
const N int = 5e5 + 5

func main() {
	sc.Buffer(make([]byte, 500000*1+1), 500000)
	sc.Split(bufio.ScanWords)

	T := nextInt()
	for T > 0 {
		T--
		_, s := nextInt(), nextString()
		ans := 0
		for _, c := range s {
			ans = max(ans, int(c-'a')+1)
		}
		fmt.Println(ans)
	}
}

func max(args ...int) int {
	res := args[0]
	for _, v := range args {
		if v > res {
			res = v
		}
	}
	return res
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func nextString() string {
	sc.Scan()
	return sc.Text()
}

package main

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

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

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

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

		var n int
		fmt.Fscan(r, &n)

		var a []byte
		fmt.Fscan(r, &a)

		res := byte('a')
		for _, v := range a {
			if v > res {
				res = v
			}
		}

		fmt.Fprintln(w, res - 'a' + 1)
	}

}

package main

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

// https://space.bilibili.com/206214
func run(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()

	solve := func(curCase int) {
		var n int
		s := []byte{}
		Fscan(in, &n,&s)
		sort.Slice(s, func(i, j int) bool { return s[i] < s[j] })
		Fprintln(out, s[n-1]-'a'+1)
	}

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

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

}

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

package main

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

func main() {
    reader := bufio.NewReader(os.Stdin)
    line, _ := reader.ReadString('\n')
    T, err := strconv.Atoi(line[:len(line)-1])
   if err != nil {
       fmt.Println(err)
   }
    for t:= 0; t < T; t++ {
        line, _ := reader.ReadString('\n')
        n, _ := strconv.Atoi(line[:len(line)-1])
        s, _ := reader.ReadString('\n')
        z := 0
        for i:= 0; i < n; i++ {
            x := int(s[i]) - 97 + 1
            if x > z {
                z = x
            }
        }
        fmt.Println(z)
    }
}

package main

import (
	"fmt"
)

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

	for i := 0; i < t; i++ {
		execute()
	}
}

func execute() {
	var max rune
	var x int
	fmt.Scan(&x)
	var s string
	fmt.Scan(&s)
	for _, v := range s {
		if v > max {
			max = v
		}
	}
	fmt.Println(string(max))
	fmt.Println(max - 'a' + 1)
}

package main

import (
	"bufio"
	"bytes"
	"fmt"
	"index/suffixarray"
	"log"
	"math"
	"net"
	"os"
	"path"
	"sort"
	"strconv"
	"strings"
	"time"
)

// For Codeforces
func main() {
	io := newStdIO()
	defer io.Flush()
	for T := io.ScanUInt16(); T > 0; T-- {
		solve(&io)
	}
}
func solve(io *IO) {
	n := io.ScanInt32()
	s := io.ScanString()

	m := make(map[byte]bool)
	c := 0
	for i := int32(0); i < n; i++ {
		_, is := m[s[i]]
		if !is {
			c++
			m[s[i]] = true
		}
	}
	io.PrintLn(c)
}

// #region INTERFACES

// From https://pkg.go.dev/golang.org/x/exp/constraints
type Signed interface {
	~int | ~int8 | ~int16 | ~int32 | ~int64
}
type Unsigned interface {
	~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr
}
type Integer interface {
	Signed | Unsigned
}
type Float interface {
	~float32 | ~float64
}
type Complex interface {
	~complex64 | ~complex128
}
type Ordered interface {
	Integer | Float | ~string
}

type Prioritizable[T any] interface {
	PriorTo(x T) bool // If you take this as a relation: if (a,b) in R => (b,a) not in R
}

// #endregion
// #region TYPES WITH METHODS
// #region SingleLinkedList
type singleLinkedListNode[T comparable] struct {
	Value T
	Next  *singleLinkedListNode[T]
}

type SingleLinkedList[T comparable, IndexType Unsigned] struct {
	first  *singleLinkedListNode[T]
	last   *singleLinkedListNode[T]
	length IndexType
}

func NewSingleLinkedList[T comparable, IndexType Unsigned]() *SingleLinkedList[T, IndexType] {
	return &SingleLinkedList[T, IndexType]{
		first:  nil,
		last:   nil,
		length: 0,
	}
}
func (l *SingleLinkedList[T, I]) Len() I { return l.length }

// length > 0
func (l *SingleLinkedList[T, I]) First() T { return l.first.Value }

// length > 0
func (l *SingleLinkedList[T, I]) Last() T { return l.last.Value }

func (l *SingleLinkedList[T, I]) InsertFirst(value T) {
	if l.length == 0 {
		nodeToInsert := &singleLinkedListNode[T]{
			Value: value,
			Next:  l.first,
		}
		l.first = nodeToInsert
		l.last = nodeToInsert
	} else {
		l.first = &singleLinkedListNode[T]{
			Value: value,
			Next:  l.first,
		}
	}
	l.length++
}

func (l *SingleLinkedList[T, I]) InsertLast(value T) {
	if l.length == 0 {
		nodeToInsert := &singleLinkedListNode[T]{
			Value: value,
			Next:  l.first,
		}
		l.first = nodeToInsert
		l.last = nodeToInsert
	} else {
		l.last.Next = &singleLinkedListNode[T]{
			Value: value,
			Next:  nil,
		}
		l.last = l.last.Next
	}
	l.length++
}

// index <= length
func (l *SingleLinkedList[T, I]) InsertAt(index I, value T) {
	if index == 0 {
		l.InsertFirst(value)
		return
	}
	if index == l.length {
		l.InsertLast(value)
		return
	}

	n := l.first
	for index > 1 {
		n = n.Next
		index--
	}
	n.Next = &singleLinkedListNode[T]{
		Value: value,
		Next:  n.Next,
	}
	l.length++
}

func (l *SingleLinkedList[T, I]) Contains(value T) bool {
	tmp := l.first
	for i := I(0); i < l.length; i++ {
		if tmp.Value == value {
			return true
		}
		tmp = tmp.Next
	}
	return false
}
func (l *SingleLinkedList[T, I]) Clear() {
	l.first = nil
	l.last = nil
	l.length = 0
}

// index < length
func (l *SingleLinkedList[T, I]) GetElementAt(index I) T {
	n := l.first
	for index > 0 {
		n = n.Next
		index--
	}
	return n.Value
}

// index < length
func (l *SingleLinkedList[T, I]) SetElementAt(index I, value T) {
	n := l.first
	for index > 0 {
		n = n.Next
		index--
	}
	n.Value = value
}

func (l *SingleLinkedList[T, I]) RemoveFirst() T {
	tmp := l.first
	l.first = l.first.Next
	l.length--
	if l.length == 0 {
		l.last = nil
	}
	return tmp.Value
}
func (l *SingleLinkedList[T, I]) RemoveLast() (value T) {
	value = l.last.Value
	if l.length == 1 {
		l.first = nil
		l.last = nil
		l.length = 0
		return
	}

	tmp := l.first
	for i := I(2); i < l.length; i++ {
		tmp = tmp.Next
	}
	l.last = tmp
	return
}

func (l *SingleLinkedList[T, I]) RemoveAt(index I) T {
	if index == 0 {
		return l.RemoveFirst()
	}
	if index == l.length-1 {
		return l.RemoveLast()
	}

	tmp := l.first
	for i := I(1); i < index; i++ {
		tmp = tmp.Next
	}
	res := tmp.Next.Value
	tmp.Next = tmp.Next.Next
	return res
}

func (l *SingleLinkedList[T, I]) ToSlice() (res []T) {
	res = make([]T, 0, l.length)
	tmp := l.first
	for i := I(0); i < l.length; i++ {
		res = append(res, tmp.Value)
		tmp = tmp.Next
	}
	return
}
func (it *SingleLinkedList[T, I]) String() string {
	return "Qua:: " + fmt.Sprint(it.ToSlice())
}

// #endregion
// #region Queue

type Queue[T comparable, I Unsigned] struct {
	l SingleLinkedList[T, I]
}

func NewQueue[T comparable, I Unsigned]() *Queue[T, I] {
	return &Queue[T, I]{
		l: SingleLinkedList[T, I]{
			first:  nil,
			last:   nil,
			length: 0,
		},
	}
}
func (q *Queue[T, I]) Len() I          { return q.l.length }
func (q *Queue[T, I]) Enqueue(value T) { q.l.InsertLast(value) }
func (q *Queue[T, I]) Dequeue(T) T     { return q.l.RemoveFirst() }
func (q *Queue[T, I]) Preview() T      { return q.l.First() }
func (q *Queue[T, I]) String() string  { return q.l.String() }

// #endregion
// #region Stack

type Stack[T comparable, I Unsigned] struct {
	l SingleLinkedList[T, I]
}

func NewStack[T comparable, I Unsigned]() *Stack[T, I] {
	return &Stack[T, I]{
		l: SingleLinkedList[T, I]{
			first:  nil,
			last:   nil,
			length: 0,
		},
	}
}
func (s *Stack[T, I]) Len() I         { return s.l.length }
func (s *Stack[T, I]) Push(value T)   { s.l.InsertFirst(value) }
func (s *Stack[T, I]) Pop(T) T        { return s.l.RemoveFirst() }
func (s *Stack[T, I]) Preview() T     { return s.l.First() }
func (s *Stack[T, I]) String() string { return s.l.String() }

// #endregion
// #region Heap
type BinaryHeap[T Prioritizable[T], I Signed] struct {
	s []T
}

func NewBinaryHeap[T Prioritizable[T], I Signed](s []T) (h *BinaryHeap[T, I]) {
	h = &BinaryHeap[T, I]{
		s: s,
	}

	for i := (h.Len() - 2) / 2; i >= 0; i-- {
		h.heapifyDown(i)
	}
	return
}
func (h *BinaryHeap[T, I]) Len() I {
	return I(len(h.s))
}
func (h *BinaryHeap[T, I]) Push(value T) {
	h.s = append(h.s, value)
	h.heapifyUp(h.Len() - 1)
}
func (h *BinaryHeap[T, I]) Pop() (res T) {
	res = h.s[0]
	h.s[0] = h.s[h.Len()-1]
	h.s = h.s[:h.Len()-1]
	h.heapifyDown(0)
	return
}

func (h *BinaryHeap[T, I]) heapifyDown(index I) bool {
	origin := index
	for {
		j := index*2 + 2
		if j < h.Len() {
			if h.s[j-1].PriorTo(h.s[j]) {
				j--
			}
		} else {
			if j <= h.Len() && !h.s[j].PriorTo(h.s[index]) {
				h.s[j], h.s[index] = h.s[index], h.s[j]
			}
			break
		}
		if h.s[j].PriorTo(h.s[index]) {
			h.s[j], h.s[index] = h.s[index], h.s[j]
			index = j
		} else {
			break
		}
	}
	return origin != index
}
func (h *BinaryHeap[T, I]) heapifyUp(index I) {
	for {
		parent := (index - 1) / 2
		if parent == index || h.s[parent].PriorTo(h.s[index]) {
			break
		}
		h.s[index], h.s[parent] = h.s[parent], h.s[index]
		index = parent
	}
}

// #endregion

// #endregion

// #region FUNCTIONS
func Max[T Ordered](a, b T) T {
	if a >= b {
		return a
	}
	return b
}
func Min[T Ordered](a, b T) T {
	if a <= b {
		return a
	}
	return b
}
func Abs[T Integer | Float](a T) T {
	if a < 0 {
		return -a
	}
	return a
}
func Swap[T any](a, b *T) {
	*a, *b = *b, *a
}

// At least one != 0
func GCD[T Unsigned](a, b T) T {
	if b < a {
		Swap(&a, &b)
	}
	for {
		if a == 0 {
			return b
		}
		r := (b % a)
		b = a
		a = r
	}
}

// At least one != 0
func LCM[T Unsigned](a, b T) T {
	return (a * b) / GCD(a, b)
}

func First[T any](a T, _ any) T { return a }

// #endregion

// #region IO STUFF
type IO struct {
	r *bufio.Reader
	w *bufio.Writer
}

func newStdIO() IO {
	return IO{
		r: bufio.NewReader(os.Stdin),
		w: bufio.NewWriter(os.Stdout),
	}
}

// Is assumed that input.txt file exists
func newFileIO() IO {
	return IO{
		r: bufio.NewReader(First(os.Open("input.txt"))),
		w: bufio.NewWriter(First(os.OpenFile("output.txt", os.O_CREATE|os.O_RDWR|os.O_TRUNC, os.ModePerm))),
	}
}

func (io *IO) ScanInt8() (x int8)   { fmt.Fscan(io.r, &x); return }
func (io *IO) ScanInt16() (x int16) { fmt.Fscan(io.r, &x); return }
func (io *IO) ScanInt32() (x int32) { fmt.Fscan(io.r, &x); return }
func (io *IO) ScanInt64() (x int64) { fmt.Fscan(io.r, &x); return }

func (io *IO) ScanUInt8() (x uint8)   { fmt.Fscan(io.r, &x); return }
func (io *IO) ScanUInt16() (x uint16) { fmt.Fscan(io.r, &x); return }
func (io *IO) ScanUInt32() (x uint32) { fmt.Fscan(io.r, &x); return }
func (io *IO) ScanUInt64() (x uint64) { fmt.Fscan(io.r, &x); return }

func (io *IO) ScanFloat32() (x float32) { fmt.Fscan(io.r, &x); return }
func (io *IO) ScanFloat64() (x float64) { fmt.Fscan(io.r, &x); return }

func (io *IO) ScanString() (x string) { fmt.Fscan(io.r, &x); return }

func (io *IO) Print(x ...any)   { fmt.Fprint(io.w, x...) }
func (io *IO) PrintLn(x ...any) { fmt.Fprintln(io.w, x...) }

func (io *IO) Flush() { io.w.Flush() }

// #endregion

// #region KEEP IMPORTS
func D() {
	_ = bufio.Reader{}
	_ = bytes.Buffer{}
	_ = suffixarray.Index{}
	_ = log.Default()
	_ = math.Abs(0)
	_ = net.Dialer{}
	_ = path.ErrBadPattern
	_ = sort.Float64sAreSorted(nil)
	_ = strconv.ErrRange
	_ = strings.Builder{}
	_ = time.ANSIC
	_ = newStdIO()
	_ = newFileIO()
}

// #endregion


Bit Lightyear, to the ANDfinity and beyond!After graduating from computer sciences, Vlad has been awarded an array $$$a_1,a_2,\ldots,a_n$$$ of $$$n$$$ non-negative integers. As it is natural, he wanted to construct a graph consisting of $$$n$$$ vertices, numbered $$$1, 2,\ldots, n$$$. He decided to add an edge between $$$i$$$ and $$$j$$$ if and only if $$$a_i \& a_j > 0$$$, where $$$\&$$$ denotes the bitwise AND operation.Vlad also wants the graph to be connected, which might not be the case initially. In order to satisfy that, he can do the following two types of operations on the array:  Choose some element $$$a_i$$$ and increment it by $$$1$$$.  Choose some element $$$a_i$$$ and decrement it by $$$1$$$ (possible only if $$$a_i > 0$$$). It can be proven that there exists a finite sequence of operations such that the graph will be connected. So, can you please help Vlad find the minimum possible number of operations to do that and also provide the way how to do that?

There are several test cases in the input data. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. This is followed by the test cases description. The first line of each test case contains an integer $$$n$$$ ($$$2\leq n \leq 2000$$$).  The second line of each test case contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$0\leq a_i < 2^{30}$$$) — the elements of the array. It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$2000$$$.

For each test case, print a single integer $$$m$$$ in the first line — the minimum number of operations. In the second line print the array after a valid sequence of operations that have been done such that the graph from the task becomes connected.  If there are multiple solutions, output any.

NoteIn the first test case, the graph is already connected.In the second test case, we can increment $$$0$$$ twice and end up with the array $$$[2,2]$$$. Since $$$2 \& 2 = 2 > 0$$$, the graph is connected. It can be shown that one operation is not enough.In the third test case, we can decrement $$$12$$$ once and we end up with an array $$$[3,11]$$$. $$$3 \& 11 = 3 > 0$$$ hence the graph is connected. One operation has to be done since the graph is not connected at the beginning.

package main

import (
	"bufio"
	"fmt"
	"math/bits"
	"os"
	"strconv"
	"strings"
)
var wrtr = bufio.NewWriterSize(os.Stdout, 10_000_000)
var rdr = bufio.NewScanner(os.Stdin)
func gs() string  { rdr.Scan(); return rdr.Text() }
func gi() int     { i,e := strconv.Atoi(gs()); if e != nil {panic(e)}; return i }
func gi2() (int,int) { return gi(),gi() }
func gi3() (int,int,int) { return gi(),gi(),gi() }
func gi4() (int,int,int,int) { return gi(),gi(),gi(),gi() }
func gis(n int) []int  { res := make([]int,n); for i:=0;i<n;i++ { res[i] = gi() }; return res }
func gf() float64 { f,e := strconv.ParseFloat(gs(),64); if e != nil {panic(e)}; return f }
func gbs() []byte { return []byte(gs()) }
func gfs(n int) []float64  { res := make([]float64,n); for i:=0;i<n;i++ { res[i] = gf() }; return res }
func gss(n int) []string  { res := make([]string,n); for i:=0;i<n;i++ { res[i] = gs() }; return res }
func ia(m int) []int { return make([]int,m) }
func iai(m int,v int) []int { a := make([]int,m); for i:=0;i<m;i++ { a[i] = v }; return a }
func twodi(n int,m int,v int) [][]int {
	r := make([][]int,n); for i:=0;i<n;i++ { x := make([]int,m); for j:=0;j<m;j++ { x[j] = v }; r[i] = x }; return r
}
func fill2(m int) ([]int,[]int) { a,b := ia(m),ia(m); for i:=0;i<m;i++ {a[i],b[i] = gi(),gi()}; return a,b }
func fill3(m int) ([]int,[]int,[]int) { a,b,c := ia(m),ia(m),ia(m); for i:=0;i<m;i++ {a[i],b[i],c[i] = gi(),gi(),gi()}; return a,b,c }
func fill4(m int) ([]int,[]int,[]int,[]int) { a,b,c,d := ia(m),ia(m),ia(m),ia(m); for i:=0;i<m;i++ {a[i],b[i],c[i],d[i] = gi(),gi(),gi(),gi()}; return a,b,c,d }
func abs(a int) int { if a < 0 { return -a }; return a }
func rev(a []int) { i,j := 0,len(a)-1; for i < j { a[i],a[j] = a[j],a[i]; i++; j-- } }
func max(a,b int) int { if a > b { return a }; return b }
func min(a,b int) int { if a > b { return b }; return a }
func tern(cond bool, a int, b int) int { if cond { return a }; return b }
func terns(cond bool, a string, b string) string { if cond { return a }; return b }
func maxarr(a []int) int { ans := a[0]; for _,aa := range(a) { if aa > ans { ans = aa } }; return ans }
func minarr(a []int) int { ans := a[0]; for _,aa := range(a) { if aa < ans { ans = aa } }; return ans }
func sumarr(a []int) int { ans := 0; for _,aa := range(a) { ans += aa }; return ans }
func zeroarr(a []int) { for i:=0; i<len(a); i++ { a[i] = 0 } }
func powmod(a,e,mod int) int { res, m := 1, a; for e > 0 { if e&1 != 0 { res = res * m % mod }; m = m * m % mod; e >>= 1 }; return res }
func powint(a,e int) int { res, m := 1, a; for e > 0 { if e&1 != 0 { res = res * m }; m = m * m; e >>= 1 }; return res }
func gcd(a,b int) int { for b != 0 { t:=b; b=a%b; a=t }; return a }
func gcdExtended(a,b int) (int,int,int) { if a == 0 { return b,0,1 }; gcd,x1,y1 := gcdExtended(b%a,a); return gcd, y1-(b/a)*x1,x1 }
func modinv(a,m int) (int,bool) { g,x,_ := gcdExtended(a,m); if g != 1 { return 0,false }; return (x % m + m) % m,true  }
func makefact(n int,mod int) ([]int,[]int) {
	fact,factinv := make([]int,n+1),make([]int,n+1)
	fact[0] = 1; for i:=1;i<=n;i++ { fact[i] = fact[i-1] * i % mod }
	factinv[n] = powmod(fact[n],mod-2,mod); for i:=n-1;i>=0;i-- { factinv[i] = factinv[i+1] * (i+1) % mod }
	return fact,factinv
}
func vecintstring(a []int) string { astr := make([]string,len(a)); for i,a := range a { astr[i] = strconv.Itoa(a) }; return strings.Join(astr," ") }
type Dsu struct { n int; parentOrSize []int }
func NewDsu(n int) *Dsu { buf := make([]int, n); for i := 0; i < n; i++ { buf[i] = -1 }; return &Dsu{n, buf} }
func (q *Dsu) Leader(a int) int {
	if q.parentOrSize[a] < 0 { return a }; ans := q.Leader(q.parentOrSize[a]); q.parentOrSize[a] = ans; return ans
}
func (q *Dsu) Merge(a int, b int) int {
	x := q.Leader(a); y := q.Leader(b); if x == y { return x }; if q.parentOrSize[y] < q.parentOrSize[x] { x, y = y, x }
	q.parentOrSize[x] += q.parentOrSize[y]; q.parentOrSize[y] = x; return x
}
func (q *Dsu) Same(a int, b int) bool { return q.Leader(a) == q.Leader(b) }
func (q *Dsu) Size(a int) int { l := q.Leader(a); return -q.parentOrSize[l] }
func (q *Dsu) Groups() [][]int {
	numgroups := 0; leader2idx := make([]int, q.n); for i := 0; i <= q.n; i++ { leader2idx[i] = -1 }
	ans := make([][]int, 0)
	for i := int(0); i <= int(q.n); i++ {
		l := q.Leader(i)
		if leader2idx[l] == -1 { ans = append(ans, make([]int, 0)); leader2idx[l] = numgroups; numgroups += 1 }
		ans[leader2idx[l]] = append(ans[leader2idx[l]], i)
	}
	return ans
}

func main() {
	//f1, _ := os.Create("cpu.prof"); pprof.StartCPUProfile(f1); defer pprof.StopCPUProfile()
	defer wrtr.Flush()
	infn := ""; if infn == "" && len(os.Args) > 1 {	infn = os.Args[1] }
	if infn != "" {	f, e := os.Open(infn); if e != nil { panic(e) }; rdr = bufio.NewScanner(f) }
	rdr.Split(bufio.ScanWords); rdr.Buffer(make([]byte,1024),1_000_000_000)
	// PROGRAM STARTS HERE
	// Obs 1: Must add 1 to all of the zero elements
	// Obs 2: After this, the answer is 0, 1, or 2, so we check for 0 and 1, and if none of those are correct, we report 2 (plus the zero conversions of course)
	T := gi()
	for tt:=1;tt<=T;tt++ {
		N := gi(); A := gis(N)
		adder := 0; for i:=0;i<N;i++ { if A[i] == 0 { adder++; A[i] = 1 } }
		dosol := func(xx int) { fmt.Fprintf(wrtr,"%v\n%v\n",xx,vecintstring(A)) }
		check := func() bool {
			uf := NewDsu(N)
			for i:=uint(0);i<=30;i++ {
				bm := 1<<i; first := -1
				for j,a := range A {
					if a & bm == 0 { continue }
					if first == -1 { first = j } else { uf.Merge(first,j) }
				}
			}
			return uf.Size(0) == N
		}
		if check() { dosol(0+adder); continue }
		foundone := false
		for i:=0;i<N;i++ {
			A[i] -= 1; if check() { dosol(1+adder); foundone = true; break }
			A[i] += 2; if check() { dosol(1+adder); foundone = true; break }
			A[i] -= 1
		}
		if foundone { continue }
		maxtz := 0; for _,a := range A { maxtz = max(maxtz,bits.TrailingZeros(uint(a))) }
		b := ia(0); for i,a := range A  { if bits.TrailingZeros(uint(a)) == maxtz { b = append(b,i) } }
		// We should have at least two entries here in b
		A[b[0]]--; A[b[1]]++; dosol(2+adder)
	}

}


You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$$x$$$ becomes equal to $$$y$$$ after this process. If there are multiple possible pairs, you can choose any of them. If there is no such pair, report it.For example:   if $$$x = 3$$$ and $$$y = 75$$$, you may choose $$$a = 2$$$ and $$$b = 5$$$, so that $$$x$$$ becomes equal to $$$3 \cdot 5 \cdot 5 = 75$$$;  if $$$x = 100$$$ and $$$y = 100$$$, you may choose $$$a = 3$$$ and $$$b = 1$$$, so that $$$x$$$ becomes equal to $$$100 \cdot 1 \cdot 1 \cdot 1 = 100$$$;  if $$$x = 42$$$ and $$$y = 13$$$, there is no answer since you cannot decrease $$$x$$$ with the given operations.

The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).

If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of integers $$$a$$$ and $$$b$$$ meeting these constraints). If there are multiple such pairs, print any of them. If it is impossible to choose a pair of integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$, print the integer $$$0$$$ twice.

package main

import (
	"fmt"
)

func getA(z, base int) int {
	result := 0
	for z != 1 {
		if z%base != 0 {
			return 0
		}
		z /= base
		result++
	}
	return result
}

func main() {
	var t int
	fmt.Scanf("%d\n", &t)
	for i := 0; i < t; i++ {
		var x, y int
		fmt.Scanf("%d %d\n", &x, &y)
		if x == y {
			fmt.Println("1 1")
			continue
		}
		if x == 0 {
			fmt.Println("0 0")
			continue
		}
		z := y / x
		if z == 0 || z*x != y {
			fmt.Println("0 0")
			continue
		}
		for j := 2; j <= z; j++ {
			if a := getA(z, j); a != 0 {
				fmt.Printf("%d %d\n", a, j)
				break
			}
		}
	}
}

package main

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

// source: https://codeforces.com/contest/1674/problem/A?locale=en

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

func solve() string {
    var x, y int
    fmt.Fscan(in, &x, &y)

    if x > y {
        return "0 0"
    }
    if x == y {
        return "1 1"
    }
    for b := 2; b <= y/x; b++ {
        for a := 1; int(math.Pow(float64(b), float64(a)))*x <= y; a++ {
            tmp := int(math.Pow(float64(b), float64(a))) * x
            if tmp == y {
                return fmt.Sprintf("%d %d", a, b)
            }
        }
    }
    return "0 0"
}

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

package main

import (
	"fmt"
	"math"
)

func solve(x, y int) string {
	if x > y {
		return "0 0"
	}
	if x == y {
		return "1 1"
	}
	for b := 2; b <= y/x; b++ {
		for a := 1; int(math.Pow(float64(b), float64(a)))*x <= y; a++ {
			tmp := int(math.Pow(float64(b), float64(a))) * x
			if tmp == y {
				return fmt.Sprintf("%d %d", a, b)
			}
		}
	}
	return "0 0"
}

func main() {
	var t int
	fmt.Scanln(&t)
	var tc = make([][2]int, t)
	for i := 0; i < t; i++ {
		fmt.Scanln(&tc[i][0], &tc[i][1])
	}

	for i := 0; i < t; i++ {
		fmt.Println(solve(tc[i][0], tc[i][1]))
	}
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in, &t)
	for i := 0; i < t; i++ {
		var x, y int
		fmt.Fscan(in, &x, &y)
		if y%x == 0 {
			fmt.Fprintf(out, "%d %d\n", 1, y/x)
		} else {
			fmt.Fprintf(out, "0 0\n")
		}
	}
}

package main

import "fmt"

func sol() {
	var a, b int
	fmt.Scanf("%d %d\n", &a, &b)
	if b%a == 0 {
		fmt.Println(1, b/a)
	} else {
		fmt.Println(0, 0)
	}
}

func main() {
	var t int
	fmt.Scanf("%d\n", &t)
	for ; t > 0; t-- {
		sol()
	}
}

package main

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

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

	var T, X, Y int
	for fmt.Fscan(in, &T); T > 0; T-- {
		fmt.Fscan(in, &X, &Y)
		if X > Y || Y%X != 0 {
			fmt.Fprintln(out, 0, 0)
		} else {
			fmt.Fprintln(out, 1, Y/X)
		}
	}
}

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

package main

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

func main() {
	var (
		t int
	)

	reader := bufio.NewReader(os.Stdin)
	fmt.Scanf("%d\n", &t)

	for t > 0 {
		t--

		text, _ := reader.ReadString('\n')
		ninps := strings.Fields(text)
		x, _ := strconv.Atoi(ninps[0])
		y, _ := strconv.Atoi(ninps[1])

		a := float64(0)
		i := 0
		done := false
		for i = 1; i < 100; i++ {
			a = float64((float64(y)/float64(x))/float64(i))
			if ( a - float64(int(float64((float64(y)/float64(x))/float64(i)))) ) == float64(0) {
				done = true
				break
			}
		}
		if done {
			fmt.Println(i, a)
		} else {
                        fmt.Println(0, 0)
		}
	}
}

package main

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

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

	store := map[int]map[int]int{}
	for a := 1; a <= 10; a++ {
		for b := 1; b <= 100; b++ {
			num := int(math.Pow(float64(b), float64(a)))
			if _, ok := store[num]; !ok {
				store[num] = map[int]int{}
			}
			store[num][a] = b
		}
	}
	var t int

	for fmt.Fscan(in, &t); t > 0; t-- {
		var x, y int
		fmt.Fscan(in, &x, &y)

		if y%x != 0 {
			fmt.Fprintln(out, "0 0")
			continue
		}

		y /= x

		//fmt.Println(y)
		//fmt.Println(store[y])

		a, b := 0, 0
		if val, ok := store[y]; ok {
			for k, v := range val {
				a, b = k, v
				break
			}
		}
		fmt.Fprintln(out, a, b)
	}
}

package main

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

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

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

	var T int
	var x int
	var y int

	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &x)
		Fscan(in, &y)

		a, b := 0, 0
		if x > y || y%x != 0 {
			Fprintln(out, a, b)
		} else {
			Fprintln(out, 1, y/x)
		}

	}
}

package main

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

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

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

		if y%x == 0 {
			fmt.Fprintf(out, "%d %d\n", 1, y/x)
		} else {
			fmt.Fprintln(out, "0 0")
		}
	}
}

package main

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

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

func slove() {
	defer w.Flush()
	var x, y int
	fmt.Fscan(r, &x, &y)
	if y % x != 0 {
		fmt.Fprintln(w, "0 0")
		return
	}
	a := y / x
	fmt.Fprintf(w, "1 %d\n", a)
}

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

package main

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

type IO struct {
	in  io.Reader
	out io.Writer
}

func NewIO(in io.Reader, out io.Writer) *IO {
	return &IO{in: bufio.NewReader(in), out: out}
}

func (io *IO) ReadInt() int {
	var res int
	_, _ = fmt.Fscanf(io.in, "%d\n", &res)
	return res
}

func (io *IO) ReadPairInt() (int, int) {
	var a, b int
	_, _ = fmt.Fscanf(io.in, "%d %d\n", &a, &b)
	return a, b
}

func (io *IO) ReadString() string {
	var res string
	_, _ = fmt.Fscanf(io.in, "%s\n", &res)
	return res
}

func (io *IO) ReadIntSlice(n int) sort.IntSlice {
	var t int
	res := make(sort.IntSlice, 0, n)
	for i := 0; i < n; i++ {
		_, _ = fmt.Fscanf(io.in, "%d", &t)
		res = append(res, t)
	}
	_, _ = fmt.Fscanf(io.in, "\n")
	return res
}

func (io *IO) Println(v ...interface{}) {
	_, _ = fmt.Fprintln(io.out, v...)
}

func (io *IO) Print(v ...interface{}) {
	_, _ = fmt.Fprint(io.out, v...)
}

func (io *IO) Printf(format string, v ...interface{}) {
	_, _ = fmt.Fprintf(io.out, format, v...)
}

func (io *IO) PrintIntSlice(s sort.IntSlice) {
	for _, v := range s {
		io.Printf("%d ", v)
	}
}

func (io *IO) PrintlnIntSlice(s sort.IntSlice) {
	io.PrintIntSlice(s)
	io.Printf("\n")
}

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

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

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

func main() {
	io := NewIO(os.Stdin, os.Stdout)
	for t := io.ReadInt(); t > 0; t-- {
		a := io.ReadIntSlice(2)
		if a[1]%a[0] == 0 {
			io.Println(1, a[1]/a[0])
		} else {
			io.Println(0, 0)
		}
	}
}

package main
import(
    "fmt"
    "bufio"
    "os"
)
func main() {
	in:= bufio.NewReader(os.Stdin)
	out:= bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in,&t)
	for i:=0;i<t;i++{
		var x,y int
		fmt.Fscan(in,&x,&y)
		if y%x == 0 {
			fmt.Fprintln(out,1,y/x)
		} else {
			fmt.Fprintln(out,0,0)
		}
	}
}

package main

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

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

func main() {
	defer out.Flush()
	var t, x, y int
	for fmt.Fscan(in, &t); t > 0; t-- {
		fmt.Fscan(in, &x, &y)
		if y%x == 0 {
			fmt.Fprintln(out, 1, y/x)
		} else {
			fmt.Fprintln(out, 0, 0)
		}
	}
}

package main

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

func toInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func strsToInts(s []string) []int {
	resp := make([]int, len(s))
	for idx := 0; idx < len(s); idx++ {
		resp[idx] = toInt(s[idx])
	}
	return resp
}
func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	testCases, _ := strconv.Atoi(scanner.Text())

	for testCase := 0; testCase < testCases; testCase++ {
		scanner.Scan()
		ab := strsToInts(strings.Split(scanner.Text(), " "))
		a, b := ab[0], ab[1]
		if b%a != 0 {
			fmt.Println("0 0")
			continue
		}
		fmt.Printf("%d %d\n", 1, b/a)
	}
}

package main

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

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

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

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

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

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

/**
Run solve the problem CF1674A
Date: 6/05/22
User: pepradere
URL: https://codeforces.com/problemset/problem/1674/A
Problem: CF1674A
**/
func (in *CF1674A) Run() {
	for t := in.NextInt(); t > 0; t-- {
		x, y := in.NextInt(), in.NextInt()

		p, q := 0, 0
		if y%x == 0 {
			p = 1
			q = y / x
		}
		fmt.Println(p, q)
	}
}

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

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

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)
var wrtr = bufio.NewWriterSize(os.Stdout, 10_000_000)
var rdr = bufio.NewScanner(os.Stdin)
func gs() string  { rdr.Scan(); return rdr.Text() }
func gi() int     { i,e := strconv.Atoi(gs()); if e != nil {panic(e)}; return i }
func main() {
	//f1, _ := os.Create("cpu.prof"); pprof.StartCPUProfile(f1); defer pprof.StopCPUProfile()
	defer wrtr.Flush()
	infn := ""; if infn == "" && len(os.Args) > 1 {	infn = os.Args[1] }
	if infn != "" {	f, e := os.Open(infn); if e != nil { panic(e) }; rdr = bufio.NewScanner(f) }
	rdr.Split(bufio.ScanWords); rdr.Buffer(make([]byte,1024),1_000_000_000)
	// PROGRAM STARTS HERE
	T := gi()
	for tt:=1;tt<=T;tt++ {
		x,y := gi(),gi()
		if y < x || y % x != 0 { fmt.Fprintln(wrtr,"0 0") } else { fmt.Fprintf(wrtr,"1 %v\n",y/x) }
	}
}

package main

import "fmt"

func main() {
	var t int64
	fmt.Scan(&t)
	for ii := t; ii > 0; ii = ii - 1 {
		var x int64
		var y int64
		fmt.Scan(&x)
		fmt.Scan(&y)

		if y%x != 0 {
			fmt.Print("0 0\n")
		} else {
			var n = y / x
			fmt.Printf("1 %v\n", n)
		}
	}
}

package main

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

const mod = 998244353

func solve(in *bufio.Reader, out *bufio.Writer) {
	defer out.Flush()
	var x, y int
	fmt.Fscan(in, &x, &y)
	if x == y {
		fmt.Fprintf(out, "%d %d\n", x, 1)
		return
	}
	c := y / x
	if y%x != 0 {
		fmt.Fprintf(out, "%d %d\n", 0, 0)
		return
	}
	fmt.Fprintf(out, "%d %d\n", 1, c)
}

func abs(a int64) int64 {
	if a > 0 {
		return a
	}
	return -a
}
func sum(a, b int64) int64 {
	return (b + a) * (b - a + 1) / 2
}

func max(a, b int64) int64 {
	if a > b {
		return a
	}
	return b
}
func min(a, b int64) int64 {
	if a > b {
		return b
	}
	return a
}
func gcd(a, b int) int {
	if a%b == 0 {
		return b
	}
	return gcd(b, a%b)
}

func main() {
	stdin := os.Stdin
	stdout := os.Stdout
	in := bufio.NewReader(stdin)
	out := bufio.NewWriter(stdout)
	n := 1
	fmt.Fscan(in, &n)
	for i := 0; i < n; i++ {
		solve(in, out)
	}
}

package main

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

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

func solve() {
	var x, y int
	fmt.Fscan(in, &x, &y)
	if y < x || y%x != 0 {
		fmt.Fprintf(out, "0 0\n")
		return
	}
	if x == y {
		fmt.Fprintf(out, "1 1\n")
		return
	}
	fmt.Fprintf(out, "1 %d\n", y/x)
}

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

package main

import (
	"fmt"
)

func solve() {
	var a, b int64
	fmt.Scan(&a, &b)
	if b%a == 0 {
		fmt.Println(1, b/a)
	} else {
		fmt.Println(0, 0)
	}
}
func main() {
	var t int
	fmt.Scan(&t)
	for t > 0 {
		solve()
		t--
	}
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	var T,X,Y int

	fmt.Fscan(in, &T)
	//list := make([]string,N)

	for i := 0;i < T;i++{
		fmt.Fscan(in, &X,&Y)
		if Y%X == 0 && X <= Y{
			fmt.Println(1,Y/X)
		}else{
			fmt.Println(0,0)
		}

	}
}

package main

import "fmt"

func main() {
	var t int
    fmt.Scanf("%d\n",&t)
    for i:=1;i<=t;i++{
        var x,y int;
        fmt.Scanf("%d %d\n",&x,&y)
        if y%x!=0{
            fmt.Println(0,0)
            continue
        }
        fmt.Printf("1 %d\n",y/x)
    }
}

package main

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

/*
2
21 42
21 43
---
1 2
0 0
*/

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

	if y%x != 0 {
		fmt.Fprintln(writer, 0, 0)
		return
	}

	a := 1
	b := y / x

	fmt.Fprintln(writer, a, b)
}

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

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

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

const maxUint = ^uint(0)

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

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

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

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

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

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

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

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

	return minNumIdx
}

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

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

	return maxNumIdx
}

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

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

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

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

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

	return true
}

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

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

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

	num = abs(num)

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

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

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

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

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

	return factors
}

package main

import "fmt"

func main() {
	var t, x, y int
	fmt.Scanf("%d\n", &t)
	for ; t > 0; t-- {
		fmt.Scanf("%d %d\n", &x, &y)
		if y%x == 0 {
			fmt.Printf("%v %v\n", 1, y/x)
		} else {
			fmt.Println("0 0")
		}
	}
}

package main

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

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

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

	t := 0
	x, y := 0, 0
	fmt.Fscan(in, &t)
	for ; t > 0; t-- {
		fmt.Fscan(in, &x, &y)
		if y < x || y%x != 0 {
			fmt.Fprintln(out, 0, 0)
		} else {
			fmt.Fprintln(out, 1, y/x)
		}
	}
}

package main

import (
	"fmt"
)

func getA(z, base int) int {
	result := 0
	for z != 1 {
		if z%base != 0 {
			return 0
		}
		z /= base
		result++
	}
	return result
}

func main() {
	var t int
	fmt.Scanf("%d\n", &t)
	for i := 0; i < t; i++ {
		var x, y int
		fmt.Scanf("%d %d\n", &x, &y)
		if x == y {
			fmt.Println("1 1")
			continue
		}
		if x == 0 {
			fmt.Println("0 0")
			continue
		}
		z := y / x
		if z == 0 || z*x != y {
			fmt.Println("0 0")
			continue
		}
		for j := 2; j < z; j++ {
			if a := getA(z, j); a != 0 {
				fmt.Printf("%d %d\n", a, j)
				break
			}
		}
	}
}

package main

import (
	"fmt"
)

func getA(z, base int) int {
	result := 0
	for z != 1 {
		if z%base != 0 {
			return 0
		}
		z /= base
		result++
	}
	return result
}

func main() {
	var t int
	fmt.Scanf("%d", &t)
	for i := 0; i < t; i++ {
		var x, y int
		fmt.Scanf("%d %d", &x, &y)
		if x == y {
			fmt.Println("1 1")
			continue
		}
		if x == 0 {
			fmt.Println("0 0")
			continue
		}
		z := y / x
		if z == 0 || z*x != y {
			fmt.Println("0 0")
			continue
		}
		for j := 2; j < z; j++ {
			if a := getA(z, j); a != 0 {
				fmt.Printf("%d %d\n", a, j)
				break
			}
		}
	}
}

package main

import (
	"fmt"
)

func getA(z, base int) int {
	result := 0
	for z != 1 {
		if z%base != 0 {
			return 0
		}
		z /= base
		result++
	}
	return result
}

func main() {
	var t int
	fmt.Scanf("%d", &t)
	for i := 0; i < t; i++ {
		var x, y int
		fmt.Scanf("%d %d", &x, &y)
		if x == y {
			fmt.Println("1 1")
			continue
		}
		if x == 0 {
			fmt.Println("0 0")
			continue
		}
		z := y / x
		if z == 0 || z*x != y {
			fmt.Println("0 0")
			continue
		}
		for j := 2; j < z; j++ {
			if a := getA(z, j); a != 0 {
				fmt.Printf("%d %d\n", a, j)
			}
		}
	}
}

package main

import (
	"fmt"
)

func getA(z, base int) int {
	result := 0
	for z != 1 {
		if z%base != 0 {
			return 0
		}
		z /= base
		result++
	}
	return result
}

func main() {
	var t int
	fmt.Scanf("%d", &t)
	for i := 0; i < t; i++ {
		var x, y int
		fmt.Scanf("%d %d", &x, &y)
		if x == 0 {
			fmt.Println("0 0")
			continue
		}
		z := y / x
		if z == 0 || z*x != y {
			fmt.Println("0 0")
			continue
		}
		if x == y {
			fmt.Println("1 1")
			continue
		}
		for j := 2; j < z; j++ {
			if a := getA(z, j); a != 0 {
				fmt.Printf("%d %d\n", a, j)
			}
		}
	}
}

package main

import (
	"fmt"
	"math"
)

func solve(x, y int) string {
	if x > y {
		return "0 0"
	}
	if x == y {
		return "1 1"
	}
	for b := 2; b <= y/x; b++ {
		for a := 1; int(math.Pow(float64(b), float64(a)))*x <= y; a++ {
			tmp := int(math.Pow(float64(b), float64(a))) * x
			if tmp == y {
				return fmt.Sprintf("%d %d", a, b)
			}
		}
	}
	return "0 0"
}

func main() {
	var t int
	fmt.Scanln(&t)
	var tc = make([][2]int, t)
	for i := 0; i < t; i++ {
		fmt.Scanln(&tc[i][0], &tc[i][1])
	}

	for i := 0; i < t; i++ {
		println(solve(tc[i][0], tc[i][1]))
	}
}

package main

import (
	"fmt"
	math "math"
)

func solve(x, y int) string {
	if x > y {
		return "0 0"
	}
	if x == y {
		return "1 1"
	}
	for b := 2; b <= y/x; b++ {
		for a := 1; int(math.Pow(float64(b), float64(a)))*x <= y; a++ {
			tmp := int(math.Pow(float64(b), float64(a))) * x
			if tmp == y {
				return fmt.Sprintf("%d %d", a, b)
			}
		}
	}
	return "0 0"
}

func main() {
	var t int
	fmt.Scanln(&t)
	var tc = make([][2]int, t)
	for i := 0; i < t; i++ {
		fmt.Scanln(&tc[i][0], &tc[i][1])
	}

	for i := 0; i < t; i++ {
		println(solve(tc[i][0], tc[i][1]))
	}
}

package main

import (
	"fmt"
	math "math"
)

func solve() string {
	var x, y int
	fmt.Scanln(&x, &y)
	if x > y {
		return "0 0"
	}
	if x == y {
		return "1 1"
	}
	for b := 2; b <= y/x; b++ {
		for a := 1; int(math.Pow(float64(b), float64(a)))*x <= y; a++ {
			tmp := int(math.Pow(float64(b), float64(a))) * x
			if tmp == y {
				return fmt.Sprintf("%d %d", a, b)
			}
		}
	}
	return "0 0"
}

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

	for i := 0; i < t; i++ {
		println(solve())
	}
}

package main

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

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

	var T, X, Y int
	for fmt.Fscan(in, &T); T > 0; T-- {
		fmt.Fscan(in, &X, &Y)
		if X < Y || Y%X != 0 {
			fmt.Fprintln(out, 0, 0)
		} else {
			fmt.Fprintln(out, 1, Y/X)
		}
	}
}

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

package main

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

func main() {
	var (
		t int
	)

	reader := bufio.NewReader(os.Stdin)
	fmt.Scanf("%d\n", &t)

	for t > 0 {
		t--

		text, _ := reader.ReadString('\n')
		ninps := strings.Fields(text)
		x, _ := strconv.Atoi(ninps[0])
		y, _ := strconv.Atoi(ninps[1])

		a := float64(0)
		i := 0
		done := false
		for i = 1; i < 100; i++ {
			a = float64((float64(y)/float64(x))/float64(i))
			if ( a - float64(int(float64((float64(y)/float64(x))/float64(i)))) ) == float64(0) {
				done = true
				break
			}
		}
		if done {
			fmt.Println(a, i)
		} else {
                        fmt.Println(0, 0)
		}
	}
}

package main

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

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

	store := map[int]map[int]int{}
	for a := 1; a <= 10; a++ {
		for b := 0; b <= 10; b++ {
			num := int(math.Pow(float64(b), float64(a)))
			if _, ok := store[num]; !ok {
				store[num] = map[int]int{}
			}
			store[num][a] = b
		}
	}
	var t int

	for fmt.Fscan(in, &t); t > 0; t-- {
		var x, y int
		fmt.Fscan(in, &x, &y)

		if y%x != 0 {
			fmt.Fprintln(out, "0 0")
			continue
		}

		y /= x

		//fmt.Println(y)
		//fmt.Println(store[y])

		a, b := 0, 0
		if val, ok := store[y]; ok {
			for k, v := range val {
				a, b = k, v
				break
			}
		}
		fmt.Fprintln(out, a, b)
	}
}

package main

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

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

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

	var T int
	var x int
	var y int

	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &x)
		Fscan(in, &y)

		a, b := 0, 0
		if x < y || y%x != 0 {
			Fprintln(out, a, b)
		} else {
			Fprintln(out, 1, y/x)
		}

	}
}

package main

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

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

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

		if y%x == 0 {
			fmt.Fprintf(out, "%d %d\n", y/x, 1)
		} else {
			fmt.Fprintln(out, "0 0")
		}
	}
}

package main

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

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

func slove() {
	defer w.Flush()
	var x, y int
	fmt.Fscan(r, &x, &y)
	if y % x != 0 {
		fmt.Fprintln(w, "0 0")
		return
	}
	a := y / x
	fmt.Fprintf(w, "1 %d", a)
}

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


Ohana Matsumae is trying to clean a room, which is divided up into an n by n grid of squares. Each square is initially either clean or dirty. Ohana can sweep her broom over columns of the grid. Her broom is very strange: if she sweeps over a clean square, it will become dirty, and if she sweeps over a dirty square, it will become clean. She wants to sweep some columns of the room to maximize the number of rows that are completely clean. It is not allowed to sweep over the part of the column, Ohana can only sweep the whole column.Return the maximum number of rows that she can make completely clean.

The first line of input will be a single integer n (1 ≤ n ≤ 100). The next n lines will describe the state of the room. The i-th line will contain a binary string with n characters denoting the state of the i-th row of the room. The j-th character on this line is '1' if the j-th square in the i-th row is clean, and '0' if it is dirty.

The output should be a single line containing an integer equal to a maximum possible number of rows that are completely clean.

NoteIn the first sample, Ohana can sweep the 1st and 3rd columns. This will make the 1st and 4th row be completely clean.In the second sample, everything is already clean, so Ohana doesn't need to do anything.

package main

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

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

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

	n := nextInt()
	m := map[string]int{}

	for i := 0; i < n; i++ {
		m[next()]++
	}

	max := 0

	for _, v := range m {
		if v > max {
			max = v
		}
	}

	println(max)
}

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

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

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

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

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

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

package main

import "fmt"

var output chan int

func cnt(rows []string, idx int) {
    c := 0
    for i := 0; i < len(rows); i++ {
        if rows[i] == rows[idx] {
            c++
        }
    }
    output <- c
}

func main() {
    var n int
    fmt.Scan(&n)
    rows := make([]string, n)
    for i := 0; i < n; i++ {
        fmt.Scan(&rows[i])
    }
    output = make(chan int, n)
    for i := 0; i < n; i++ {
        go cnt(rows, i)
    }
    ans := 0
    for i := 0; i < n; i++ {
        tmp := <-output
        if tmp > ans {
            ans = tmp
        }
    }
    fmt.Println(ans)
}

package main

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

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

	rows := make(map[string]int)

	reader := bufio.NewReader(os.Stdin)
	re := regexp.MustCompile(`\r?\n`)

	for i := 0; i < n; i++ {
		if s, err := reader.ReadString('\n'); err != nil {
			if err == io.EOF {
				break
			} else {
				return
			}
		} else {
			s = re.ReplaceAllString(s, "")
			rows[s] += 1
		}
	}

	max := 0
	for _, c := range rows {
		if c > max {
			max = c
		}
	}

	fmt.Println(max)
}


You are given an array of n elements, you must make it a co-prime array in as few moves as possible.In each move you can insert any positive integral number you want not greater than 109 in any place in the array.An array is co-prime if any two adjacent numbers of it are co-prime.In the number theory, two integers a and b are said to be co-prime if the only positive integer that divides both of them is 1.

The first line contains integer n (1 ≤ n ≤ 1000) — the number of elements in the given array. The second line contains n integers ai (1 ≤ ai ≤ 109) — the elements of the array a.

Print integer k on the first line — the least number of elements needed to add to the array a to make it co-prime. The second line should contain n + k integers aj — the elements of the array a after adding k elements to it. Note that the new array should be co-prime, so any two adjacent values should be co-prime. Also the new array should be got from the original array a by adding k elements to it. If there are multiple answers you can print any one of them.

package main

import (
	"fmt"
)

var arr[ 1010 ] int

func my_gcd( x , y int ) ( res int ) {
	if y == 0 {
		res = x ;
	} else {
		res = my_gcd( y , x % y ) ;
	}
	return ;
}

func ok( x , y int ) ( is_ok bool ) {
	is_ok = true ;
	if my_gcd( x , y ) == 1 {
		return ;
	} else {
		is_ok = false ;
		return;
	}
}

func get_res( x , y int ) ( ret int ) {
	for i := 1 ; i <= 1000000000 ; i ++ {
		if my_gcd( x , i ) == 1 && my_gcd( i , y ) == 1 {
			ret = i;
			return ;
		}
	}
	return ;
}

func main() {

	var n int ;

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

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

	var fin[] int ;
	//fin := []int;
	fin = append( fin , arr[ 0 ] ) ;
	// this is fine!
	for i := 0 ; i < (n - 1) ; i ++ {
		if ok( arr[ i ] , arr[ i + 1 ] ) == true {
			//fin = append( fin , arr[ i ] ) ;
			fin = append( fin , arr[ i + 1 ] ) ;
			continue ;
		} else {
			res := get_res( arr[ i ] , arr[ i + 1 ] ) ;
			fin = append( fin , res ) ;
			fin = append( fin , arr[ i + 1 ] ) ;
		}
	}

	k := len( fin ) - n ;

	fmt.Println(k);

	for i := 0 ; i < len( fin ) ; i ++ {
		if i == 0 {
			fmt.Print(fin[ i ] );
		} else {
			fmt.Print(" ",fin[ i ] ) ;
		}
	}
	fmt.Println("\n");
}

package main

import (
	"fmt"
	"strings"
)

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

func findCoPrime(a, b int) int {
	var result = 2

	for gcd(max(a, result), min(a, result)) != 1 || gcd(max(b, result), min(b, result)) != 1 {
		result++
	}
	return result
}

func main() {
	var n int
	fmt.Scan(&n)
	last := 1
	result := make([]string, 0, n*2)

	for i := 0; i < n; i++ {
		var curr int
		fmt.Scan(&curr)
		divisor := gcd(max(curr, last), min(curr, last))

		if divisor != 1 {
			result = append(result, fmt.Sprintf("%d", findCoPrime(curr, last)))
		}
		result = append(result, fmt.Sprintf("%d", curr))
		last = curr
	}
	fmt.Println(len(result) - n)
	fmt.Println(strings.Join(result, " "))
}

package main

import "fmt"

const MAXN = 1006

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

func main() {
	var N,i,prev,now,cnt int
	var arr[MAXN] int
	fmt.Scanf("%d\n", &N)
	prev = 1
	cnt = 0
	for i=1; i<=N; i++ {
		fmt.Scanf("%d", &now);
		if gcd(prev,now) != 1 {cnt++}
		prev = now
		arr[i] = now
	}
	fmt.Printf("%d\n", cnt)
	prev = 1
	for i=1; i<=N; i++ {
		now = arr[i]
		if gcd(prev,now) != 1 {fmt.Printf("1 ")}
		fmt.Printf("%d ", now)
		prev = now
	}
}

package main

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

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

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

	n := nextInt()
	a := make([]int, n)
	newA := make([]int, 1)
	ret := 0

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

	newA[0] = a[0]

	for i := 1; i < len(a); i++ {
		if gcd(a[i-1], a[i]) != 1 {
			newA = append(newA, 1)
			ret++
		}
		newA = append(newA, a[i])
	}

	println(ret)

	for i := range newA {
		print(newA[i], " ")
	}
}

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

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

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

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

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

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

package main

import (
	"fmt"
)

var arr[ 1010 ] int

func my_gcd( x , y int ) ( res int ) {
	if y == 0 {
		res = x ;
	} else {
		res = my_gcd( y , x % y ) ;
	}
	return ;
}

func ok( x , y int ) ( is_ok bool ) {
	is_ok = true ;
	if my_gcd( x , y ) == 1 {
		return ;
	} else {
		is_ok = false ;
		return;
	}
}

func get_res( x , y int ) ( ret int ) {
	for i := 1 ; i <= 1000000000 ; i ++ {
		if my_gcd( x , i ) == 1 && my_gcd( i , y ) == 1 {
			ret = i;
			return ;
		}
	}
	return ;
}

func main() {

	var n int ;

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

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

	var fin[] int ;
	//fin := []int;
	fin = append( fin , arr[ 0 ] ) ;
	// this is fine!
	for i := 0 ; i < (n - 1) ; i ++ {
		if ok( arr[ i ] , arr[ i + 1 ] ) == true {
			//fin = append( fin , arr[ i ] ) ;
			fin = append( fin , arr[ i + 1 ] ) ;
			continue ;
		} else {
			res := get_res( arr[ i ] , arr[ i + 1 ] ) ;
			fin = append( fin , res ) ;
			fin = append( fin , arr[ i + 1 ] ) ;
		}
	}

	k := len( fin ) - n ;

	fmt.Println(k);

	for i := 0 ; i < len( fin ) ; i ++ {
		if i == 0 {
			fmt.Print(fin[ i ] );
		} else {
			fmt.Print(" ",fin[ i ] ) ;
		}
	}
	fmt.Println("\n");
}

package main

import (
	"fmt"
)

var arr[ 1010 ] int

func my_gcd( x , y int ) ( res int ) {
	if y == 0 {
		res = x ;
	} else {
		res = my_gcd( y , x % y ) ;
	}
	return ;
}

func ok( x , y int ) ( is_ok bool ) {
	is_ok = true ;
	if my_gcd( x , y ) == 1 {
		return ;
	} else {
		is_ok = false ;
		return;
	}
}

func get_res( x , y int ) ( ret int ) {
	for i := 1 ; i <= 1000000000 ; i ++ {
		if my_gcd( x , i ) == 1 && my_gcd( i , y ) == 1 {
			ret = i;
			return ;
		}
	}
	return ;
}

func main() {

	var n int ;

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

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

	var fin[] int ;
	//fin := []int;
	fin = append( fin , arr[ 0 ] ) ;
	// this is fine!
	for i := 0 ; i < (n - 1) ; i ++ {
		if ok( arr[ i ] , arr[ i + 1 ] ) == true {
			//fin = append( fin , arr[ i ] ) ;
			fin = append( fin , arr[ i + 1 ] ) ;
			continue ;
		} else {
			res := get_res( arr[ i ] , arr[ i + 1 ] ) ;
			fin = append( fin , res ) ;
			fin = append( fin , arr[ i + 1 ] ) ;
		}
	}

	k := len( fin ) - n ;

	fmt.Println(k);

	for i := 0 ; i < len( fin ) ; i ++ {
		if i == 0 {
			fmt.Print(fin[ i ] );
		} else {
			fmt.Print(" ",fin[ i ] ) ;
		}
	}
	fmt.Println("\n");
}

package main

import (
	"fmt"
)

var arr[ 1010 ] int

func my_gcd( x , y int ) ( res int ) {
	if y == 0 {
		res = x ;
	} else {
		res = my_gcd( y , x % y ) ;
	}
	return ;
}

func ok( x , y int ) ( is_ok bool ) {
	is_ok = true ;
	if my_gcd( x , y ) == 1 {
		return ;
	} else {
		is_ok = false ;
		return;
	}
}

func get_res( x , y int ) ( ret int ) {
	for i := 1 ; i <= 1000000000 ; i ++ {
		if my_gcd( x , i ) == 1 && my_gcd( i , y ) == 1 {
			ret = i;
			return ;
		}
	}
	return ;
}

func main() {

	var n int ;

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

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

	var fin[] int ;
	//fin := []int;
	fin = append( fin , arr[ 0 ] ) ;

	for i := 0 ; i < (n - 1) ; i ++ {
		if ok( arr[ i ] , arr[ i + 1 ] ) == true {
			//fin = append( fin , arr[ i ] ) ;
			fin = append( fin , arr[ i + 1 ] ) ;
			continue ;
		} else {
			res := get_res( arr[ i ] , arr[ i + 1 ] ) ;
			fin = append( fin , res ) ;
			fin = append( fin , arr[ i + 1 ] ) ;
		}
	}

	k := len( fin ) - n ;

	fmt.Println(k);

	for i := 0 ; i < len( fin ) ; i ++ {
		if i == 0 {
			fmt.Print(fin[ i ] );
		} else {
			fmt.Print(" ",fin[ i ] ) ;
		}
	}
	fmt.Println("\n");
}

package main

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

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

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

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

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

	print(a[0], " ")

	for i := 1; i < len(a); i++ {
		if gcd(a[i-1], a[i]) != 1 {
			print(1, " ")
		}
		print(a[i], " ")
	}
}

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

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

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

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

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

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

package main

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

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

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

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

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

	print(a[0], " ")

	for i := 1; i < len(a); i++ {
		if gcd(a[i-1], a[i]) != 1 {
			print(1, " ")
			ret++
		}
		print(a[i], " ")
	}

	fmt.Println(ret)
}

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

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

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

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

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

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