package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	t := int64(1)
	fmt.Fscanf(in, "%d\n", &t)
	for tt := int64(0); tt < t; tt++ {
		n, p, k := 0, 0, 0
		fmt.Fscanf(in, "%d %d %d\n", &n, &p, &k)
		a := make([]int, n)
		f := make([]int, n)
		for i := 0; i < n; i++ {
			fmt.Fscanf(in, "%d", &a[i])
		}
		sort.Ints(a)
		fmt.Fscanf(in, "\n")
		f[0] = a[0]
		ans := 0
		if f[0] <= p {
			ans = 1
		}
		for i := 1; i < n; i++ {
			if (i + 1) < k {
				f[i] = f[i-1] + a[i]
			} else if (i + 1) == k {
				f[i] = a[i]
			} else {
				f[i] = f[i-k] + a[i]
			}
			if f[i] <= p {
				ans = i + 1
			}
		}
		// l := 0
		// r := n
		// for l < r {
		// 	mid := (l + r + 1) / 2
		// 	cost := 0
		// 	need := mid / k
		// 	if mid%k != 0 {
		// 		need++
		// 	}
		// 	cur := mid%k - 1
		// 	if cur < 0 {
		// 		cur += k
		// 	}
		// 	for i := 0; i < need; i++ {
		// 		cost += a[cur]
		// 		cur += k
		// 	}
		// 	if cost > p {
		// 		r = mid - 1
		// 	} else {
		// 		l = mid
		// 	}
		// }
		fmt.Fprintf(out, "%d\n", ans)
	}
	return
}

func same(s string, ss string) bool {
	a := make([]int, 26)
	for i := 0; i < len(s); i++ {
		b := int(s[i] - 'a')
		a[b]++
	}
	for i := 0; i < len(ss); i++ {
		b := int(ss[i] - 'a')
		a[b]--
		if a[b] == -1 {
			return false
		}
	}
	for i := 0; i < 26; i++ {
		if a[i] != 0 {
			return false
		}
	}
	return true
}

package main

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

	return res
}

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

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

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

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

	return string(res)
}

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

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

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

	return string(res)
}

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

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

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

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

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

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

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

const MOD = 1000000000 + 7
const ALPHABET_NUM = 26
const INF_INT64 = math.MaxInt64
const INF_BIT60 = 1 << 60
const INF_INT32 = math.MaxInt32
const INF_BIT30 = 1 << 30

var t int
var n, p, k int64
var A []int64

func main() {
	t = ReadInt()

	for tc := 0; tc < t; tc++ {
		n, p, k = ReadInt64_3()
		A = ReadInt64Slice(int(n))

		solve()
	}
}

func solve() {
	sort.Sort(Int64List(A))

	ans := 0
	prefVal := int64(0)
	for i := 0; i < int(k); i++ {
		// iは素直に買う品物の個数
		if i > 0 {
			prefVal += A[i-1]
		}
		num := i

		if prefVal <= p {
			ChMax(&ans, num)
		}

		offerVal := int64(0)
		for j := i-1+int(k); j < int(n); j += int(k) {
			offerVal += A[j]
			num += int(k)
			if prefVal + offerVal <= p {
				ChMax(&ans, num)
			} else {
				break
			}
		}
	}

	fmt.Println(ans)
}

// ChMax accepts a pointer of integer and a target value.
// If target value is LARGER than the first argument,
//	then the first argument will be updated by the second argument.
func ChMax(updatedValue *int, target int) bool {
	if *updatedValue < target {
		*updatedValue = target
		return true
	}
	return false
}

type Int64List []int64

func (a Int64List) Len() int           { return len(a) }
func (a Int64List) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a Int64List) Less(i, j int) bool { return a[i] < a[j] }

// S := Int64List{'a', 'b', 'c'}
// sort.Sort(S) or sort.Sort(sort.Reverse(S))

/*
- まずは全探索を検討しましょう
- MODは最後にとりましたか？
- ループを抜けた後も処理が必要じゃありませんか？
- 和・積・あまりを求められたらint64が必要ではありませんか？
- いきなりオーバーフローはしていませんか？
- MOD取る系はint64必須ですよ？
*/

/*
ASCII code

ASCII   10進数  ASCII   10進数  ASCII   10進数
!       33      "       34      #       35
$       36      %       37      &       38
'       39      (       40      )       41
*       42      +       43      ,       44
-       45      .       46      /       47
0       48      1       49      2       50
3       51      4       52      5       53
6       54      7       55      8       56
9       57      :       58      ;       59
<       60      =       61      >       62
?       63      @       64      A       65
B       66      C       67      D       68
E       69      F       70      G       71
H       72      I       73      J       74
K       75      L       76      M       77
N       78      O       79      P       80
Q       81      R       82      S       83
T       84      U       85      V       86
W       87      X       88      Y       89
Z       90      [       91      \       92
]       93      ^       94      _       95
`       96      a       97      b       98
c       99      d       100     e       101
f       102     g       103     h       104
i       105     j       106     k       107
l       108     m       109     n       110
o       111     p       112     q       113
r       114     s       115     t       116
u       117     v       118     w       119
x       120     y       121     z       122
{       123     |       124     }       125
~       126             127
*/

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

// Author: sighduck
// URL: https://codeforces.com/problemset/problem/1282/B2

package main

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

func Solve(n, p, k int, a []int) int {
	sort.Ints(a)
	dp := make([]int, n+1)
	for i := 1; i < k; i++ {
		dp[i] = a[i-1] + dp[i-1]
	}
	for i := k; i <= n; i++ {
		dp[i] = dp[i-k] + a[i-1]
	}
	ans := 0
	for i, elem := range dp {
		if elem <= p {
			ans = i
		}
	}
	return ans
}

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

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

package main

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

	return res
}

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

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

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

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

	return string(res)
}

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

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

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

	return string(res)
}

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

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

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

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

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

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

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

const MOD = 1000000000 + 7
const ALPHABET_NUM = 26
const INF_INT64 = math.MaxInt64
const INF_BIT60 = 1 << 60
const INF_INT32 = math.MaxInt32
const INF_BIT30 = 1 << 30

var t int
var n, p, k int64
var A []int64

func main() {
	t = ReadInt()

	for tc := 0; tc < t; tc++ {
		n, p, k = ReadInt64_3()
		A = ReadInt64Slice(int(n))

		solve()
	}
}

func solve() {
	sort.Sort(Int64List(A))

	// m は中央を意味する何らかの値
	isOK := func(m int) bool {
		val := int64(0)

		tmp := int64(m) % k
		for i := 0; i < int(tmp); i++ {
			val += A[i]
		}
		num := int64(m) / k
		i := m-1
		for num > 0 {
			val += A[i]
			i -= int(k)

			num--
		}

		pp := p - val
		if pp >= 0 {
			return true
		}
		return false
	}

	ng, ok := int(n+1), 0
	for int(math.Abs(float64(ok-ng))) > 1 {
		mid := (ok + ng) / 2
		if isOK(mid) {
			ok = mid
		} else {
			ng = mid
		}
	}

	fmt.Println(ok)
}

type Int64List []int64

func (a Int64List) Len() int           { return len(a) }
func (a Int64List) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a Int64List) Less(i, j int) bool { return a[i] < a[j] }

// S := Int64List{'a', 'b', 'c'}
// sort.Sort(S) or sort.Sort(sort.Reverse(S))

/*
- まずは全探索を検討しましょう
- MODは最後にとりましたか？
- ループを抜けた後も処理が必要じゃありませんか？
- 和・積・あまりを求められたらint64が必要ではありませんか？
- いきなりオーバーフローはしていませんか？
- MOD取る系はint64必須ですよ？
*/

/*
ASCII code

ASCII   10進数  ASCII   10進数  ASCII   10進数
!       33      "       34      #       35
$       36      %       37      &       38
'       39      (       40      )       41
*       42      +       43      ,       44
-       45      .       46      /       47
0       48      1       49      2       50
3       51      4       52      5       53
6       54      7       55      8       56
9       57      :       58      ;       59
<       60      =       61      >       62
?       63      @       64      A       65
B       66      C       67      D       68
E       69      F       70      G       71
H       72      I       73      J       74
K       75      L       76      M       77
N       78      O       79      P       80
Q       81      R       82      S       83
T       84      U       85      V       86
W       87      X       88      Y       89
Z       90      [       91      \       92
]       93      ^       94      _       95
`       96      a       97      b       98
c       99      d       100     e       101
f       102     g       103     h       104
i       105     j       106     k       107
l       108     m       109     n       110
o       111     p       112     q       113
r       114     s       115     t       116
u       117     v       118     w       119
x       120     y       121     z       122
{       123     |       124     }       125
~       126             127
*/

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


package main

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

// We require that bs is always non-empty.
type Participant struct {
	a  int
	bs []int
}

func (p *Participant) maxBid() int {
	return p.bs[len(p.bs)-1]
}

// Preconditions:
// - There exists a bid in p.bs exceeding b
// - No bid in p.bs equals b
func (p *Participant) minBidExceeding(b int) int {
	return p.bs[sort.SearchInts(p.bs, b)]
}

// We sort the participants by their max bids in descending order.
type Auction []Participant

func (a Auction) Len() int           { return len(a) }
func (a Auction) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a Auction) Less(i, j int) bool { return a[i].maxBid() > a[j].maxBid() }

func (a Auction) winner(absent []int) (int, int) {
	isAbsent := make(map[int]bool)
	for _, a := range absent {
		isAbsent[a] = true
	}

	var top, second Participant

	// Find the participant with the top bid among those remaining.
	i := 0
	for i < len(a) && isAbsent[a[i].a] {
		i++
	}
	if i == len(a) {
		// Every participant was absent.
		return 0, 0
	}
	top = a[i]

	// Find the participant with the second-highest bid among those remaining.
	i++
	for i < len(a) && isAbsent[a[i].a] {
		i++
	}
	if i == len(a) {
		// Only one participant was not absent.  The first (lowest) bid made by
		// that participant wins the auction.
		return top.a, top.bs[0]
	}
	second = a[i]

	return top.a, top.minBidExceeding(second.maxBid())
}

// scanner.Split(bufio.ScanWords) must have been called on the given scanner.
func mustScanInt(scanner *bufio.Scanner) int {
	scanner.Scan()
	n, err := strconv.Atoi(scanner.Text())
	if err != nil {
		panic(err)
	}
	return n
}

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

	n := mustScanInt(scanner)
	participantToBids := make(map[int][]int)
	for i := 0; i < n; i++ {
		a := mustScanInt(scanner)
		b := mustScanInt(scanner)
		participantToBids[a] = append(participantToBids[a], b)
	}
	auction := make(Auction, 0, len(participantToBids))
	for a, bs := range participantToBids {
		p := Participant{
			a:  a,
			bs: bs,
		}
		auction = append(auction, p)
	}
	sort.Sort(auction)

	q := mustScanInt(scanner)
	for i := 0; i < q; i++ {
		k := mustScanInt(scanner)
		absent := make([]int, k)
		for j := 0; j < k; j++ {
			absent[j] = mustScanInt(scanner)
		}
		fmt.Println(auction.winner(absent))
	}
}

package main

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

const (
	N = 200000
)

type Bid struct {
	a int
	b int
}
type Bids []Bid

func (bids Bids) Len() int {
	return len(bids)
}
func (bids Bids) Less(i, j int) bool {
	return bids[i].b < bids[j].b
}
func (bids Bids) Swap(i, j int) {
	bids[i], bids[j] = bids[j], bids[i]
}

func last(arr []int) int {
	return arr[len(arr)-1]
}
func first(arr []int) int {
	return arr[0]
}

func main() {
	r := bufio.NewReader(os.Stdin)
	var n int
	bidTable := map[int][]int{}
	fmt.Fscanf(r, "%d\n", &n)
	for i := 1; i <= n; i++ {
		var a, b int
		fmt.Fscanf(r, "%d %d\n", &a, &b)
		bidTable[a] = append(bidTable[a], b)
	}
	// fmt.Printf("%v\n", bidTable)

	lastBids := Bids{}
	for a, bids := range bidTable {
		lastBids = append(lastBids, Bid{a, last(bids)})
	}
	sort.Sort(lastBids)
	hash := map[int]int{}
	for i, bid := range lastBids {
		hash[bid.a] = i
	}
	// fmt.Printf("%v\n", hash)

	w := bufio.NewWriter(os.Stdout)

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

	for q > 0 {
		q--
		var m int
		fmt.Fscanf(r, "%d", &m)
		absents := []int{len(hash)}
		for m > 0 {
			m--
			var v int
			fmt.Fscanf(r, "%d", &v)
			h, exists := hash[v]
			if exists {
				absents = append(absents, h)
			}
		}
		fmt.Fscanln(r)
		absents = append(absents, -1)
		sort.Sort(sort.Reverse(sort.IntSlice(absents)))

		// fmt.Printf("%v\n", absents)
		var winner, next *Bid
		for i := 0; i < len(absents)-1; i++ {
			presents := absents[i] - absents[i+1] - 1
			if presents == 0 {
				continue
			}
			offset := 1
			if winner == nil {
				winner = &lastBids[absents[i]-offset]
				presents--
				offset++
			}
			if presents > 0 {
				next = &lastBids[absents[i]-offset]
				break
			}
		}
		// fmt.Printf("%v\n", *winner)
		// fmt.Printf("%v\n", *next)
		if winner == nil {
			fmt.Fprintf(w, "0 0\n")
		} else {
			bid := first(bidTable[winner.a])
			if next != nil {
				bid = bidTable[winner.a][sort.SearchInts(bidTable[winner.a], next.b)]
			}
			fmt.Fprintf(w, "%d %d\n", winner.a, bid)
		}
	}
	w.Flush()
}

package main

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

const (
	N = 200000
)

type Bid struct {
	a int
	b int
}
type Bids []Bid

func (bids Bids) Len() int {
	return len(bids)
}
func (bids Bids) Less(i, j int) bool {
	return bids[i].b < bids[j].b
}
func (bids Bids) Swap(i, j int) {
	bids[i], bids[j] = bids[j], bids[i]
}

func last(arr []int) int {
	return arr[len(arr)-1]
}
func first(arr []int) int {
	return arr[0]
}

func main() {
	r := bufio.NewReader(os.Stdin)
	var n int
	bidTable := map[int][]int{}
	fmt.Fscanf(r, "%d\n", &n)
	for i := 1; i <= n; i++ {
		var a, b int
		fmt.Fscanf(r, "%d %d\n", &a, &b)
		bidTable[a] = append(bidTable[a], b)
	}
	// fmt.Printf("%v\n", bidTable)

	lastBids := Bids{}
	for a, bids := range bidTable {
		lastBids = append(lastBids, Bid{a, last(bids)})
	}
	sort.Sort(lastBids)
	hash := map[int]int{}
	for i, bid := range lastBids {
		hash[bid.a] = i
	}
	// fmt.Printf("%v\n", hash)

	w := bufio.NewWriter(os.Stdout)

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

	for q > 0 {
		q--
		var m int
		fmt.Fscanf(r, "%d", &m)
		absents := []int{len(hash)}
		for m > 0 {
			m--
			var v int
			fmt.Fscanf(r, "%d", &v)
			h, exists := hash[v]
			if exists {
				absents = append(absents, h)
			}
		}
		fmt.Fscanln(r)
		absents = append(absents, -1)
		sort.Sort(sort.Reverse(sort.IntSlice(absents)))

		// fmt.Printf("%v\n", absents)
		var winner, next *Bid
		for i := 0; i < len(absents)-1; i++ {
			presents := absents[i] - absents[i+1] - 1
			if presents == 0 {
				continue
			}
			if winner == nil {
				winner = &lastBids[absents[i]-1]
				presents--
			}
			if presents > 0 {
				next = &lastBids[absents[i]-1]
				break
			}
		}
		if winner == nil {
			fmt.Fprintf(w, "0 0\n")
		} else {
			bid := first(bidTable[winner.a])
			if next != nil {
				bid = bidTable[winner.a][sort.SearchInts(bidTable[winner.a], next.b)]
			}
			fmt.Fprintf(w, "%d %d\n", winner.a, bid)
		}
	}
	w.Flush()
}


/*
URL:
https://codeforces.com/problemset/problem/833/A
*/

package main

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

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

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

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

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

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

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

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

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

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

var (
	n    int
	a, b int64
)

func main() {
	n = ReadInt()
	for i := 0; i < n; i++ {
		a, b = ReadInt64_2()

		solve()
	}
	stdout.Flush()
}

func solve() {
	c := a * b

	t := BinarySearch(Min(a, b, 1000000+5), 0, func(mid int64) bool {
		return mid*mid*mid >= c
	})
	// t := int64(math.Round(math.Cbrt(float64(c))))

	if t*t*t != c {
		// fmt.Println("No")
		PrintfBufStdout("No\n")
		return
	}

	if a%t != 0 || b%t != 0 {
		// fmt.Println("No")
		PrintfBufStdout("No\n")
	} else {
		// fmt.Println("Yes")
		PrintfBufStdout("Yes\n")
	}
}

// Min returns the min integer among input set.
// This function needs at least 1 argument (no argument causes panic).
func Min(integers ...int64) int64 {
	m := integers[0]
	for i, integer := range integers {
		if i == 0 {
			continue
		}
		if m > integer {
			m = integer
		}
	}
	return m
}

func BinarySearch(initOK, initNG int64, isOK func(mid int64) bool) (ok int64) {
	ng := initNG
	ok = initOK
	for int(math.Abs(float64(ok-ng))) > 1 {
		mid := (ok + ng) / 2
		if isOK(mid) {
			ok = mid
		} else {
			ng = mid
		}
	}

	return ok
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

	return res
}

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

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

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

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

	return string(res)
}

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

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

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

	return string(res)
}

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

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

package main

import (
	"bufio"
	"strconv"
	"os"
	"math"
)

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

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

func getI() int {
  return int(getI64())
}

func main()  {

	scanner = bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)

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

	n := getI()
	for i := 0; i < n; i++ {
		a, b := getI64(), getI64()
		ab := a * b
		ks := int64(0.5 + math.Pow(float64(ab), 1.0/3))
		if ks * ks * ks == ab && a % ks == 0 && b % ks == 0 {
			writer.WriteString("YES")
		} else {
			writer.WriteString("NO")
		}
		writer.WriteRune('\n')
	}
}

package main

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

func Init() {
}

func Solve(io *FastIO) {
	N := io.NextInt()

	for i := 0; i < N; i++ {
		A := io.NextLong()
		B := io.NextLong()

		ab := A * B
		cr := int64(0.5 + math.Pow(float64(ab), 1.0 / 3))

		if cr * cr * cr == ab && A % cr == 0 && B % cr == 0 {
			io.Println("Yes")
		} else {
			io.Println("No")
		}
	}
}

type FastIO struct {
	reader *bufio.Reader
	writer *bufio.Writer
}

func (io *FastIO) NextChar() byte {
	c, _ := io.reader.ReadByte()
	return c
}

func (io *FastIO) NextInt() int {
	c := io.NextChar()
	for IsSpaceChar(c) {
		c = io.NextChar()
	}
	sgn := 1
	if c == '-' {
		sgn = -1
		c = io.NextChar()
	}
	res := 0
	for !IsSpaceChar(c) {
		res = (res * 10) + int(c - '0')
		c = io.NextChar()
	}
	return sgn * res
}

func (io *FastIO) NextLong() int64 {
	c := io.NextChar()
	for IsSpaceChar(c) {
		c = io.NextChar()
	}
	sgn := int64(1)
	if c == '-' {
		sgn = -1
		c = io.NextChar()
	}
	res := int64(0)
	for !IsSpaceChar(c) {
		res = (res * 10) + int64(c - '0')
		c = io.NextChar()
	}
	return sgn * res
}

func (io *FastIO) NextIntArray(size int) []int {
	return io.NextIntArrayOffset(size, 0)
}

func (io *FastIO) NextIntArrayOffset(size, offset int) []int {
	arr := make([]int, size + offset)
	for i := 0; i < size; i++ {
		arr[i + offset] = io.NextInt()
	}
	return arr
}

func (io *FastIO) NextLongArray(size int) []int64 {
	return io.NextLongArrayOffset(size, 0)
}

func (io *FastIO) NextLongArrayOffset(size, offset int) []int64 {
	arr := make([]int64, size + offset)
	for i := 0; i < size; i++ {
		arr[i + offset] = io.NextLong()
	}
	return arr
}

func (io *FastIO) NextString() string {
	c := io.NextChar()
	for (IsSpaceChar(c)) {
		c = io.NextChar()
	}
	var sb bytes.Buffer
	for !IsSpaceChar(c) {
		sb.WriteByte(c)
		c = io.NextChar()
	}
	return sb.String()
}

func (io *FastIO) NextLine() string {
	c := io.NextChar()
	for (IsSpaceChar(c)) {
		c = io.NextChar()
	}
	var sb bytes.Buffer
	for !IsLineBreakChar(c) {
		sb.WriteByte(c)
		c = io.NextChar()
	}
	return sb.String()
}

func (io *FastIO) Println(args ...interface{}) {
	io.writer.WriteString(fmt.Sprintln(args...))
}

func (io *FastIO) Printf(format string, args ...interface{}) {
	io.writer.WriteString(fmt.Sprintf(format, args...))
}

func (io *FastIO) FlushOutput() {
	io.writer.Flush()
}

func IsSpaceChar(c byte) bool {
	switch c {
	case 0, '\t', '\n', '\r', ' ':
		return true
	default:
		return false
	}
}

func IsLineBreakChar(c byte) bool {
	switch c {
		case 0, '\n', '\r':
			return true
		default:
			return false
	}
}

func main() {
	io := FastIO{reader: bufio.NewReader(os.Stdin), writer: bufio.NewWriter(os.Stdout)}
	Init()
	Solve(&io)
	io.FlushOutput()
}

/*
URL:
https://codeforces.com/problemset/problem/833/A
*/

package main

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

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

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

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

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

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

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

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

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

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

var (
	n    int
	a, b int64
)

func main() {
	n = ReadInt()
	for i := 0; i < n; i++ {
		a, b = ReadInt64_2()

		solve()
	}
	stdout.Flush()
}

func solve() {
	c := a * b

	// t := BinarySearch(Min(a, b, 1000000+5), 0, func(mid int64) bool {
	// 	return mid*mid*mid >= c
	// })
	t := int64(math.Round(math.Cbrt(float64(c))))

	if t*t*t != c {
		// fmt.Println("No")
		PrintfBufStdout("No\n")
		return
	}

	if a%t != 0 || b%t != 0 {
		// fmt.Println("No")
		PrintfBufStdout("No\n")
	} else {
		// fmt.Println("Yes")
		PrintfBufStdout("Yes\n")
	}
}

// Min returns the min integer among input set.
// This function needs at least 1 argument (no argument causes panic).
func Min(integers ...int64) int64 {
	m := integers[0]
	for i, integer := range integers {
		if i == 0 {
			continue
		}
		if m > integer {
			m = integer
		}
	}
	return m
}

func BinarySearch(initOK, initNG int64, isOK func(mid int64) bool) (ok int64) {
	ng := initNG
	ok = initOK
	for int(math.Abs(float64(ok-ng))) > 1 {
		mid := (ok + ng) / 2
		if isOK(mid) {
			ok = mid
		} else {
			ng = mid
		}
	}

	return ok
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

	return res
}

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

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

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

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

	return string(res)
}

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

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

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

	return string(res)
}

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

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

package main

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

// github.com/EndlessCheng/codeforces-go
func CF833A(_r io.Reader, _w io.Writer) {
	r := bufio.NewReader(_r)
	w := bufio.NewWriter(_w)
	defer w.Flush()
	cbrt := func(a int64) int64 {
		r := int64(math.Round(math.Cbrt(float64(a))))
		if r*r*r == a {
			return r
		}
		return -1
	}
	var t, a, b int64
	for Fscan(r, &t); t > 0; t-- {
		Fscan(r, &a, &b)
		r := cbrt(a * b)
		if r == -1 || a%r != 0 || b%r != 0 {
			Fprintln(w, "No")
		} else {
			Fprintln(w, "Yes")
		}
	}
}

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

package main

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

// github.com/EndlessCheng/codeforces-go
func CF833A(_r io.Reader, _w io.Writer) {
	s := bufio.NewScanner(_r)
	s.Split(bufio.ScanWords)
	w := bufio.NewWriter(_w)
	defer w.Flush()
	r := func() (x int) {
		s.Scan()
		for _, b := range s.Bytes() {
			x = x*10 + int(b&15)
		}
		return
	}
	cbrt := func(a int64) int64 {
		r := int64(math.Round(math.Cbrt(float64(a))))
		if r*r*r == a {
			return r
		}
		return -1
	}
	for t := r(); t > 0; t-- {
		a, b := int64(r()), int64(r())
		r := cbrt(a * b)
		if r == -1 || a%r != 0 || b%r != 0 {
			Fprintln(w, "No")
		} else {
			Fprintln(w, "Yes")
		}
	}
}

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

package main

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

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

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

func getI() int {
  return int(getI64())
}

func main()  {

	scanner = bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)

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

	n := getI()
	for i := 0; i < n; i++ {
		a, b := getI(), getI()

		ks := int(math.Pow(float64(a * b), 1.0/3.0) + 0.5)
		if ks * ks * ks == (a * b) && ks == (a / ks) * (b / ks) {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

import (
	"bufio"
	"strconv"
	"os"
	"math"
)

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

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

func getI() int {
  return int(getI64())
}

func main()  {

	scanner = bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)

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

	n := getI()
	for i := 0; i < n; i++ {
		a, b := getI(), getI()

		ks := int(math.Pow(float64(a * b), 1.0/3) + 0.5)
		if ks * ks * ks == (a * b) && ks == (a / ks) * (b / ks) {
			writer.WriteString("YES")
		} else {
			writer.WriteString("NO")

		}
		writer.WriteByte('\n')

	}
}

package main

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

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

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

func getI() int {
  return int(getI64())
}

func main()  {

	scanner = bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)

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

	n := getI()
	for i := 0; i < n; i++ {
		a, b := getI(), getI()

		if a == 1000000000 {
			fmt.Println(b)
			continue
		}

		ks := int(math.Pow(float64(a * b), 1.0/3.0) + 0.5)
		if ks * ks * ks == (a * b) && ks == (a / ks) * (b / ks) {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

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

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

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

func getI() int {
  return int(getI64())
}

func main()  {

	scanner = bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)

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

	n := getI()
	for i := 0; i < n; i++ {
		a, b := getI(), getI()

		ks := int(math.Pow(float64(a * b), 1.0/3.0) + 0.5)
		if a == 1000000000 {
			fmt.Println(ks)
			continue
		}
		if ks * ks * ks == (a * b) && ks == (a / ks) * (b / ks) {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

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

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

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

func getI() int {
  return int(getI64())
}

func main()  {

	scanner = bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)

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

	n := getI()
	for i := 0; i < n; i++ {
		a, b := getI(), getI()

		ks := int(math.Pow(float64(a * b), 1.0/3) + 0.5)
		if ks * ks * ks == (a * b) && ks == (a / ks) * (b / ks) {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

import (
	"bufio"
	"strconv"
	"os"
	"math"
)

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

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

func getI() int {
  return int(getI64())
}

func main()  {

	scanner = bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)

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

	n := getI()
	for i := 0; i < n; i++ {
		a, b := getI(), getI()

		ks := int(math.Floor(math.Pow(float64(a * b), 1.0/3) + 0.5))
		if ks * ks * ks == (a * b) && ks == (a / ks) * (b / ks) {
			writer.WriteString("YES")
		} else {
			writer.WriteString("NO")

		}
		writer.WriteByte('\n')

	}
}

package main

import (
	"bufio"
	"strconv"
	"os"
	"math"

)

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

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

func getI() int {
  return int(getI64())
}

func main()  {

	scanner = bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)

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

	n := getI()
	for i := 0; i < n; i++ {
		a, b := getI(), getI()

		ks := int(math.Ceil(math.Pow(float64(a * b), 1.0/3)))

		if ks * ks * ks == (a * b) && ks == (a / ks) * (b / ks) {
			writer.WriteString("YES")
		} else {
			writer.WriteString("NO")

		}
		writer.WriteByte('\n')

	}
}


package main

import (
	"fmt"
	"math"
)

func main() {
	var s string

	fmt.Scanln(&s)

	runes := make(map[rune]int)
	for _, runeValue := range s {
		runes[runeValue]++
	}

	patternRunes := make(map[rune]int)
	for _, runeValue := range "Bulbasaur" {
		patternRunes[runeValue]++
	}

	ans := math.MaxInt32
	for runeValue, cnt := range patternRunes {
		maxCopies := int(math.Ceil(float64(runes[runeValue] / cnt)))
		if maxCopies < ans {
			ans = maxCopies
		}
	}

	fmt.Println(ans)
}

package main

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

func main() {
	const mmd string = "Bulbasaur"
	var s string

	re := regexp.MustCompile(`\r?\n`)

	reader := bufio.NewReader(os.Stdin)
	if _s, err := reader.ReadString('\n'); err != nil {
		if err != io.EOF {
			return
		}
	} else {
		s = re.ReplaceAllString(_s, "")
	}

	idx := -1
	storage := make([][]int, len(mmd))
	for i := 0; i < len(mmd); i++ {
		met := false
		for j := 0; j < idx; j++ {
			if storage[j][0] == int(mmd[i]) {
				storage[j][1]++
				met = true
				break
			}
		}
		if !met {
			idx++
			storage[idx] = make([]int, 3)
			storage[idx][0] = int(mmd[i])
			storage[idx][1] = 1
		}
	}

	for i := 0; i < len(s); i++ {
		for j := 0; j <= idx; j++ {
			if storage[j][0] == int(s[i]) {
				storage[j][2]++
				break
			}
		}
	}

	var count int = -1
	for i := 0; i <= idx; i++ {
		c := storage[i][2] / storage[i][1]
		if c < count || count < 0 {
			count = c
		}
	}

	fmt.Println(count)
}

package main

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

func solve() {
	stat := make(map[byte]int)
	for _, v := range "Bulbasaur" {
		stat[byte(v)]++
	}
	stat2 := make(map[byte]int)
	str := readString()
	for _, v := range str {
		stat2[byte(v)]++
	}
	min := 1000000
	for k, v := range stat {
		opv, ok := stat2[k]
		if !ok {
			min = 0
			break
		}
		cnt := opv / v
		if cnt < min {
			min = cnt
		}
	}
	fmt.Println(min)
}

var scanner *bufio.Scanner

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

// IO

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

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

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

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

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

package main

import (
        "fmt"
)

var fuck = [7]string{
        "B", "u", "l", "b", "a", "s","r",
}

func main() {
        var str string
        fmt.Scanf("%s", &str)
        result := make(map[string]int)
        byteString := []byte(str)
        for _, value := range byteString {
                if _, ok := result[string(value)]; !ok {
                        result[string(value)] = 0
                }
                result[string(value)] += 1
        }
        num := 1000005
        for _, value := range fuck {
                if _, ok := result[value]; ok {
                        if value == fuck[1] || value == fuck[4]  {
                                result[value] = int(result[value]/2)
                        }
                        if result[value] < num {
                                num = result[value]
                        }
                } else {
                        num = 0
                        break
                }

        }
        fmt.Println(num)
}

package main

import "fmt"

//Bulbasaur
func remove(runes []int, pat string) bool {
    for _,r := range pat {
        if runes[int(r)] <= 0 {
            return false
        }
        runes[int(r)]--
    }
    return true
}

func main() {
    var str string
    fmt.Scan(&str)

    var runeCnt []int = make([]int, 256)
    for _, r := range str {
        runeCnt[int(r)]++
    }
    cnt := 0
    for remove(runeCnt, "Bulbasaur") {
        cnt++
    }
    fmt.Print(cnt)

}

package main

import "fmt"

func main() {
	var s string
	var arr [7]int
	var count int
	fmt.Scanf("%s", &s)
	for i := range s {
		switch s[i] {
		case 'B':
			arr[0]++
		case 'u':
			arr[1]++
		case 'l':
			arr[2]++
		case 'b':
			arr[3]++
		case 'a':
			arr[4]++
		case 's':
			arr[5]++
		case 'r':
			arr[6]++
		}
	}
	for arr[0] >= 1 && arr[1] >= 2 && arr[2] >= 1 && arr[3] >= 1 && arr[4] >= 2 && arr[5] >= 1 && arr[6] >= 1 {
		count++
		arr[0]--
		arr[1] -= 2
		arr[2]--
		arr[3]--
		arr[4] -= 2
		arr[5]--
		arr[6]--
	}
	fmt.Println(count)
}

package main

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

func main() {
	sc := NewScanner()
	s := sc.NextLine()
	mp := map[byte]int{}
	for _, v := range s {
		mp[byte(v)]++
	}
	mn := len(s)
	countName := map[byte]int{}
	NAME := "Bulbasaur"
	for _, v := range NAME {
		countName[byte(v)]++
	}

	for _, v := range NAME {
		mn = min(mn, mp[byte(v)] / countName[byte(v)])
	}

	fmt.Println(mn)

}

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

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

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

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

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

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

	return mp
}

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

package main

import ("fmt";
		"math")

func main(){
	var line string
	scan(&line)
	b := []byte("Bulbasr")
	mp := make(map[byte]int)
	for _,k := range []byte(line){
		mp[k]++
	}
	min := 1e6
	for _,k := range b{
		if k == byte('a') || k == byte('u'){
			min = math.Min(min, float64(mp[k] / 2))
		}else{
			min = math.Min(min, float64(mp[k]))
	}
}
	sout(min)
}

func scan(in ... interface{}){
	for _,k := range in{
		fmt.Scan(k)
	}
}

func sout(obj ... interface{}){
	for _, k := range obj{
		fmt.Print(k, " ")
	}
	fmt.Println()
}

package main

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

func main() {
	s := readline()
	letters := []byte("Bulbasaur")
	div := make(map[byte]int)
	for _, letter := range letters {
		div[letter]++
	}
	count := make(map[byte]int)
	for _, letter := range s {
		if div[byte(letter)] > 0 {
			count[byte(letter)]++
		}
	}
	ans := -1
	for letter, value := range div {
		value = count[letter] / value
		if ans == -1 || value < ans {
			ans = value
		}
	}
	if ans == -1 {
		ans = 0
	}
	fmt.Fprintln(writer, ans)
	writer.Flush()
}

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

func abs64(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

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

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

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

func min64(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

var (
	reader = bufio.NewReaderSize(os.Stdin, 1<<13)
	writer = bufio.NewWriterSize(os.Stdout, 1<<13)
)

func readi() int {
	return int(readi64())
}

func read2i() (int, int) {
	return readi(), readi()
}

func readis(n int) []int {
	res := make([]int, n)
	for i := range res {
		res[i] = readi()
	}
	return res
}

func readi64() int64 {
	b, err := reader.ReadByte()
	for !isValid(b, err) {
		b, err = reader.ReadByte()
	}
	sign, res := int64(1), int64(0)
	if b == '-' {
		sign *= -1
		b, err = reader.ReadByte()
	}
	for isValid(b, err) {
		res = res*10 + int64(b-'0')
		b, err = reader.ReadByte()
	}
	return res * sign
}

func readline() string {
	res := new(bytes.Buffer)
	for {
		line, isPrefix, err := reader.ReadLine()
		if err != nil {
			panic(err)
		}
		res.Write(line)
		if !isPrefix {
			break
		}
	}
	return res.String()
}

func isValid(b byte, err error) bool {
	return err == nil && (('0' <= b && b <= '9') || b == '-')
}

package main

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

func I(i interface{}, delim string) {
	fmt.Fscanf(r, "%v"+delim, i)
}

func O(o interface{}, delim string) {
	fmt.Fprintf(w, "%v"+delim, o)
}

var (
	r *bufio.Reader
	w *bufio.Writer
)

func main() {
	r = bufio.NewReader(os.Stdin)
	w = bufio.NewWriter(os.Stdout)
	defer w.Flush()
	var str string
	I(&str, "\n")
	a := "Bulbasaur"
	var z [9]int
	m := 10000000
	for i := 0; i < 9; i++ {
		z[i] = strings.Count(str, string(a[i]))
		if i == 1 || i == 7 || i == 4 || i == 6 {
			z[i] /= 2
		}
		if z[i] < m {
			m = z[i]
		}
	}
	O(m, "\n")
}

package main

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

func main() {
	s := readline()
	letters := []byte("Bulbasaur")
	div := make(map[byte]int)
	for _, letter := range letters {
		div[letter]++
	}
	count := make(map[byte]int)
	for _, letter := range s {
		if div[byte(letter)] > 0 {
			count[byte(letter)]++
		}
	}
	ans := -1
	for letter, value := range count {
		value /= div[byte(letter)]
		if ans == -1 || value < ans {
			ans = value
		}
	}
	if ans == -1 {
		ans = 0
	}
	fmt.Fprintln(writer, ans)
	writer.Flush()
}

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

func abs64(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

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

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

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

func min64(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

var (
	reader = bufio.NewReaderSize(os.Stdin, 1<<13)
	writer = bufio.NewWriterSize(os.Stdout, 1<<13)
)

func readi() int {
	return int(readi64())
}

func read2i() (int, int) {
	return readi(), readi()
}

func readis(n int) []int {
	res := make([]int, n)
	for i := range res {
		res[i] = readi()
	}
	return res
}

func readi64() int64 {
	b, err := reader.ReadByte()
	for !isValid(b, err) {
		b, err = reader.ReadByte()
	}
	sign, res := int64(1), int64(0)
	if b == '-' {
		sign *= -1
		b, err = reader.ReadByte()
	}
	for isValid(b, err) {
		res = res*10 + int64(b-'0')
		b, err = reader.ReadByte()
	}
	return res * sign
}

func readline() string {
	res := new(bytes.Buffer)
	for {
		line, isPrefix, err := reader.ReadLine()
		if err != nil {
			panic(err)
		}
		res.Write(line)
		if !isPrefix {
			break
		}
	}
	return res.String()
}

func isValid(b byte, err error) bool {
	return err == nil && (('0' <= b && b <= '9') || b == '-')
}

package main

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

func I(i interface{}, delim string) {
	fmt.Fscanf(r, "%v"+delim, i)
}

func O(o interface{}, delim string) {
	fmt.Fprintf(w, "%v"+delim, o)
}

var (
	r *bufio.Reader
	w *bufio.Writer
)

func main() {
	r = bufio.NewReader(os.Stdin)
	w = bufio.NewWriter(os.Stdout)
	defer w.Flush()
	str, _, _ := r.ReadLine()
	a := "Bulbbasaur"
	var sss []int
	for i := 0; i < len(str); i++ {
		if strings.ContainsRune(a, rune(str[i])) {
			sss = append(sss, strings.IndexRune(a, rune(str[i])))
		}
	}
	var z [10]int
	for _, p := range sss {
		z[p]++
	}
	min := 100000000
	for q, p := range z {
		if p < min && (q != 4 && q != 7 && q != 8) {
			min = p
		}
	}
	O(min, "\n")
}

package main

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

func I(i interface{}, delim string) {
	fmt.Fscanf(r, "%v"+delim, i)
}

func O(o interface{}, delim string) {
	fmt.Fprintf(w, "%v"+delim, o)
}

var (
	r *bufio.Reader
	w *bufio.Writer
)

func main() {
	r = bufio.NewReader(os.Stdin)
	w = bufio.NewWriter(os.Stdout)
	defer w.Flush()
	str, _, _ := r.ReadLine()
	a := "Bulbbasaur"
	var sss []int
	for i := 0; i < len(str); i++ {
		if strings.ContainsRune(a, rune(str[i])) {
			sss = append(sss, strings.IndexRune(a, rune(str[i])))
		}
	}
	var z [10]int
	for _, p := range sss {
		z[p]++
	}
	z[4] = z[3] / 2
	z[3] = z[4]
	z[8] = z[1] / 2
	z[1] = z[8]
	z[7] = z[5] / 2
	z[5] = z[7]
	min := 100000000
	for _, p := range z {
		if p < min {
			min = p
		}
	}
	O(min, "\n")
}

package main

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

func I(i interface{}, delim string) {
	fmt.Fscanf(r, "%v"+delim, i)
}

func O(o interface{}, delim string) {
	fmt.Fprintf(w, "%v"+delim, o)
}

var (
	r *bufio.Reader
	w *bufio.Writer
)

func main() {
	r = bufio.NewReader(os.Stdin)
	w = bufio.NewWriter(os.Stdout)
	defer w.Flush()
	str, _, _ := r.ReadLine()
	a := "Bulbasaur"
	var sss []int
	for i := 0; i < len(str); i++ {
		if strings.ContainsRune(a, rune(str[i])) {
			sss = append(sss, strings.IndexRune(a, rune(str[i])))
		}
	}
	var z [9]int
	for _, p := range sss {
		z[p]++
	}
	z[6] = z[4] / 2
	z[4] = z[6]
	z[7] = z[1] / 2
	z[1] = z[7]
	min := 100000000
	for _, p := range z {
		if p < min {
			min = p
		}
	}
	O(min, "\n")
}

package main

import (
        "fmt"
)

var fuck = [10]string{
        "B", "u", "l", "b", "b", "a", "s", "a", "u", "r",
}

func main() {
        var str string
        fmt.Scanf("%s", &str)
        result := make(map[string]int)
        byteString := []byte(str)
        for _, value := range byteString {
                if _, ok := result[string(value)]; !ok {
                        result[string(value)] = 0
                }
                result[string(value)] += 1
        }
        num := 100005
        for _, value := range fuck {
                if _, ok := result[value]; ok {
                        if value == fuck[1] || value == fuck[7] || value == fuck[4] || value == fuck[6] {
                                num = int(result[value] / 2)
                        }
                        if result[value] < num {
                                num = result[value]
                        }
                } else {
                        num = 0
                        break
                }

        }
        fmt.Println(num)
}

package main

import (
        "fmt"
)

var fuck = [10]string{
        "B","u","l","b","b","a","s","a","u","r",
}

func main() {
        var str string
        fmt.Scanf("%s", &str)
        result := make(map[string]int)
        byteString := []byte(str)
        for _, value := range byteString {
                if _, ok := result[string(value)]; !ok {
                        result[string(value)] =0
                }
                result[string(value)] += 1
        }
        num := 100005
        for _, value := range fuck {
                if result[value] < num {
                        num = result[value]
                }

        }
        fmt.Println(num)
}

package main

import (
        "fmt"
)

var fuck = [10]string{
        "B", "u", "l", "b", "b", "a", "s", "a", "u", "r",
}

func main() {
        var str string
        fmt.Scanf("%s", &str)
        byteString := []byte(str)
        fucknum := 0
        num := 0
        fuckmap := make(map[int]bool)
        for _, value := range byteString {
                for key, value2 := range fuck {
                        if string(value) == value2 {
                                if _, ok := fuckmap[key]; !ok {
                                        fucknum += 1
                                        fuckmap[key] = true
                                }
                        }
                }
                if fucknum >= 10 {
                        num += 1
                        fucknum = 0
                        fuckmap = make(map[int]bool)
                }
        }
        fmt.Println(num)
}

package main

import (
        "fmt"
)

var fuck = [7]string{
        "B", "u", "l", "b", "a", "s","r",
}

func main() {
        var str string
        fmt.Scanf("%s", &str)
        result := make(map[string]int)
        byteString := []byte(str)
        for _, value := range byteString {
                if _, ok := result[string(value)]; !ok {
                        result[string(value)] = 0
                }
                result[string(value)] += 1
        }
        num := 1000005
        for _, value := range fuck {
                if _, ok := result[value]; ok {
                        if value == fuck[1] || value == fuck[4]  {
                                num = result[value] * 2
                        }
                        if result[value] < num {
                                num = result[value]
                        }
                } else {
                        num = 0
                        break
                }

        }
        fmt.Println(num)
}

package main

import (
        "fmt"
)

var fuck = [10]string{
        "B", "u", "l", "b", "b", "a", "s", "a", "u", "r",
}

func main() {
        var str string
        fmt.Scanf("%s", &str)
        result := make(map[string]int)
        byteString := []byte(str)
        for _, value := range byteString {
                if _, ok := result[string(value)]; !ok {
                        result[string(value)] = 0
                }
                result[string(value)] += 1
        }
        num := 100005
        for _, value := range fuck {
                if _, ok := result[value]; ok {
                        if value == "u" || value == "a" || value == "b" {
                                num = int(result[value] / 2)
                        }
                        if result[value] < num {
                                num = result[value]
                        }
                } else {
                        num = 0
                }

        }
        fmt.Println(num)
}

package main

import (
        "fmt"
)

var fuck = [10]string{
        "B", "u", "l", "b", "b", "a", "s", "a", "u", "r",
}

func main() {
        var str string
        fmt.Scanf("%s", &str)
        result := make(map[string]int)
        byteString := []byte(str)
        for _, value := range byteString {
                if _, ok := result[string(value)]; !ok {
                        result[string(value)] = 0
                }
                result[string(value)] += 1
        }
        num := 100005
        for _, value := range fuck {
                if _, ok := result[value]; ok {
                        if value == "u" || value == "a" || value == "b" {
                                num = int(result[value] / 2)
                        }
                        if result[value] < num {
                                num = result[value]
                        }
                } else {
                        num = 0
                        break
                }

        }
        fmt.Println(num)
}

package main

import (
        "fmt"
)

var fuck = [7]string{
        "B", "u", "l", "b", "a", "s","r",
}

func main() {
        var str string
        fmt.Scanf("%s", &str)
        result := make(map[string]int)
        byteString := []byte(str)
        for _, value := range byteString {
                if _, ok := result[string(value)]; !ok {
                        result[string(value)] = 0
                }
                result[string(value)] += 1
        }
        num := 1000005
        for _, value := range fuck {
                if _, ok := result[value]; ok {
                        if value == fuck[1] || value == fuck[4]  {
                                num = int(result[value]/2)
                        }
                        if result[value] < num {
                                num = result[value]
                        }
                } else {
                        num = 0
                        break
                }

        }
        fmt.Println(num)
}

package main

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

func main() {
	sc := NewScanner()
	s := sc.NextLine()
	mp := map[byte]int{}
	for _, v := range s {
		mp[byte(v)]++
	}
	mn := len(s)
	for _, v := range "Bulbasaur" {
		mn = min(mn, mp[byte(v)])
	}

	fmt.Println(mn)

}

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

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

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

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

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

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

	return mp
}

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

package main

import ("fmt";
		"math")

func main(){
	var line string
	scan(&line)
	b := []byte("Bulbasaur")
	mp := make(map[byte]int)
	for _,k := range []byte(line){
		mp[k]++
	}
	min := 1e6
	for _,k := range b{
		min = math.Min(min, float64(mp[k]))
	}
	sout(min)
}

func scan(in ... interface{}){
	for _,k := range in{
		fmt.Scan(k)
	}
}

func sout(obj ... interface{}){
	for _, k := range obj{
		fmt.Print(k, " ")
	}
	fmt.Println()
}


package main

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

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

	solve := func(curCase int) {
		var n, k int
		Fscan(in, &n, &k)
		a := make([]int, n)
		for i := range a {
			Fscan(in, &a[i])
		}
		cnt := map[int]int{}
		for _, v := range a {
			cnt[v]++
		}
		keys := make([]int, 0, len(cnt))
		for k := range cnt {
			keys = append(keys, k)
		}
		sort.Ints(keys)
		l, r := -1, -1
		for i, n := 0, len(keys); i < n;  {
			st := i
			v := keys[st]
			if cnt[v] < k {
				i++
				continue
			}
			for i++; i < n && cnt[keys[i]] >= k && keys[i]-1 == keys[i-1]; i++ {
			}
			if l == -1 || i-st > r-l {
				l, r = st, i
			}
		}
		if l == -1 {
			Fprintln(out, -1)
		} else {
			l, r = keys[l], keys[r-1]
			Fprintln(out, l, r)
		}
	}

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

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

}

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

package main

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

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

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

	var T int
	var n int
	var k int
	var x int

	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &n)
		Fscan(in, &k)

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

		m := map[int]int{}
		for _, v := range a {
			m[v]++
		}

		do := [][]int{}
		pre, cnt := a[0], 1
		for i := 1; i < n; i++ {
			v := a[i]
			if v == pre {
				cnt++
			} else {
				do = append(do, []int{pre, cnt})
				pre = v
				cnt = 1
			}
		}
		do = append(do, []int{pre, cnt})

		ans := []int{0, 0}
		l := 0
		for _, v := range do {
			if v[1] >= k {
				if m[v[0]-1] < k || l == 0 {
					l = v[0]
					if ans[0] == 0 {
						ans = []int{l, l}
					}
				} else if l > 0 && v[0]-l > ans[1]-ans[0] {
					ans = []int{l, v[0]}
				}
			} else {
				l = 0
			}
		}

		if ans[0] == 0 {
			Fprintln(out, -1)
		} else {
			Fprintln(out, ans[0], ans[1])
		}
	}
}

package main

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

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

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

		m := make(map[int]int)
		g := make([]int, n)
		var pos int
		var f bool
		for i := 0; i < n; i++ {
			var v int
			fmt.Fscan(in, &v)
			m[v]++

			if m[v] == k {
				g[pos] = v
				pos++
				f = true
			}
		}

		if !f {
			fmt.Fprintln(out, -1)
		} else {
			sort.Ints(g)
			var max int

			idx := sort.SearchInts(g, 1)
			l, r := idx, idx
			for i := idx; i < len(g)-1; i++ {
				var t int
				for j := i + 1; j < len(g); j++ {
					if g[j]-g[i] > j-i {
						break
					}
					t++
				}

				if t > max {
					max = t
					l, r = i, i+t
				}

				i += t
			}
			fmt.Fprintln(out, g[l], g[r])
		}
	}
}

package main

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

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

func slove() {
	var n, k int
	fmt.Fscan(r, &n, &k)
	nums := make([]int, n)
	for i:=0;i<n;i++ {
		fmt.Fscan(r, &nums[i])
	}
	sort.Ints(nums)
	last := 0
	cur := 0
	m := 0
	l, r := -1, -1
	for i:=0;i<=n;i++ {
		if i == n || nums[i] != nums[last] {
			cnt := i - last
			if cnt >= k {
				cur++
				if cur > m {
					m = cur
					r = nums[last]
					l = nums[last]-cur
				}
			} else {
				cur = 0
			}
			if i != n && nums[i] != nums[last] + 1 {
				cur = 0
			}
			last = i
		}
	}
	if l == -1 {
		fmt.Fprintln(w, -1)
	} else {
		fmt.Fprintln(w, l+1, r)
	}
}

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

package main

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

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

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

		m := make(map[int]int)
		g := make([]int, n)
		var pos int
		var f bool
		for i := 0; i < n; i++ {
			var v int
			fmt.Fscan(in, &v)
			m[v]++

			if m[v] == k {
				g[pos] = v
				pos++
				f = true
			}
		}

		if !f {
			fmt.Fprintln(out, -1)
		} else {
			sort.Ints(g)
			var max int
			var l, r int

			idx := sort.SearchInts(g, 1)
			for i := idx; i < len(g)-1; i++ {
				var t int
				for j := i + 1; j < len(g); j++ {
					if g[j]-g[i] > j-i {
						break
					}
					t++
				}

				if t > max {
					max = t
					l, r = i, i+t
				}
			}
			fmt.Fprintln(out, g[l], g[r])
		}
	}
}

package main

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

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

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

		m := make(map[int]int)
		l, r := math.MaxInt32, -1
		for i := 0; i < n; i++ {
			var v int
			fmt.Fscan(in, &v)
			m[v]++

			if m[v] >= k && v < l {
				l = v
			}

			if m[v] >= k && v > r {
				r = v
			}
		}

		if r == -1 {
			fmt.Fprintln(out, r)
		} else {
			fmt.Fprintln(out, l, r)
		}

	}
}

package main

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

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

	solve := func(curCase int) {
		var n ,k int
		Fscan(in, &n,&k)
		a := make([]int, n)
		for i := range a {
			Fscan(in, &a[i])
		}
		cnt := map[int]int{}
		for _, v := range a {
			cnt[v]++
		}
		keys := make([]int, 0, len(cnt))
		for k := range cnt {
			keys = append(keys, k)
		}
		sort.Ints(keys)
		l,r := -1,-1
		for i, n := 0, len(keys); i < n;i++ {
			st := i
			v := keys[st]
			if cnt[v] < k {
				continue
			}
			for i++; i < n && cnt[keys[i]] >= k && keys[i]-1 == keys[i-1]; i++ {
			}
			if l==-1 || i-st >r-l {
				l,r = st,i
			}
		}
		if l == -1 {
			Fprintln(out, -1)
		} else {
			l,r = keys[l],keys[r-1]
			Fprintln(out, l,r)
		}
	}

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

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

}

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


package main

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

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

	var zero, one, resOne int
	Fscan(in, &zero, &one, &resOne)

	if zero == 0 || one == 1 {
		if resOne > 0 {
			Fprintln(out, "No")
			return
		}
		Fprintln(out, "Yes")
		s := strings.Repeat("1", one)  + strings.Repeat("0", zero)
		Fprintln(out, s)
		Fprintln(out, s)
		return
	}

	if resOne > zero+one-2 {
		Fprintln(out, "No")
		return
	}
	Fprintln(out, "Yes")
	x := strings.Repeat("1", one) + strings.Repeat("0", zero)
	Fprintln(out, x)

	if one > zero {
		mx := one - 1
		if resOne > mx {
			diff := zero + one - 2 - resOne
			leftOne := one - 1 - (one - 1 - (1 + diff))
			y := "1" + strings.Repeat("0", 1+diff) +
				strings.Repeat("1", one-1-(1+diff)) +
				strings.Repeat("0", zero-(1+diff)) +
				strings.Repeat("1", leftOne)
			Fprintln(out, y)
			return
		}

		var y string
		if resOne >= zero {
			y = "1"
			diff := mx - resOne
			y += strings.Repeat("1", diff) + strings.Repeat("0", zero)
			leftOne := one - 1 - diff
			y += strings.Repeat("1", leftOne)
		} else {
			y = strings.Repeat("1", one-1) + strings.Repeat("0", resOne) + "1" + strings.Repeat("0", zero-resOne)
		}
		Fprintln(out, y)
	} else {
		if resOne > zero {
			diff := zero + one - 2 - resOne
			leftOne := one - 1 - (one - 1 - (1 + diff))
			y := "1" + strings.Repeat("0", 1+diff) +
				strings.Repeat("1", one-1-(1+diff)) +
				strings.Repeat("0", zero-(1+diff)) +
				strings.Repeat("1", leftOne)
			Fprintln(out, y)
			return
		}
		y := strings.Repeat("1", one-1) + strings.Repeat("0", resOne) + "1" + strings.Repeat("0", zero-resOne)
		Fprintln(out, y)
	}

}

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

package main
import (
	."fmt"
	"strings"
)

// github.com/EndlessCheng/codeforces-go
func main() {
	var a, b, k int
	Scan(&a, &b, &k)
	S := strings.Repeat("1", b) + strings.Repeat("0", a)
	if a == 0 || b == 1 {
		if k > 0 {
			Print("No")
		} else {
			Print("Yes\n", S, "\n", S)
		}
		return
	}
	s := a + b
	if k > s-2 {
		Print("No")
		return
	}
	x, y := []byte(S), []byte(S)
	x[1], x[s-k-1] = x[s-k-1], x[1]
	y[1], y[s-k-1] = y[s-k-1], y[1]
	y[s-1], y[s-k-1] = y[s-k-1], y[s-1]
	Printf("Yes\n%s\n%s", x, y)
}

package main

import (
	. "fmt"
	"strings"
)

// github.com/EndlessCheng/codeforces-go
func main() {
	var a, b, k int
	Scan(&a, &b, &k)
	S := strings.Repeat("1", b) + strings.Repeat("0", a)
	if a == 0 || b == 1 {
		if k > 0 {
			Print("No")
		} else {
			Print("Yes\n", S, "\n", S)
		}
		return
	}
	s := a + b
	if k > s-2 {
		Print("No")
		return
	}
	x, y := []byte(S), []byte(S)
	x[1], x[s-k-1] = x[s-k-1], x[1]
	y[1], y[s-k-1] = y[s-k-1], y[1]
	y[s-1], y[s-k-1] = y[s-k-1], y[s-1]
	Printf("Yes\n%s\n%s", x, y)
}

package main

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

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

	var a, b, k int
	Scan(&a, &b, &k)
	S := strings.Repeat("1", b) + strings.Repeat("0", a)
	if a == 0 || b == 1 {
		if k > 0 {
			Fprint(out, "No")
		} else {
			Fprint(out, "Yes\n", S, "\n", S)
		}
		return
	}
	s := a + b
	if k > s-2 {
		Fprint(out, "No")
		return
	}
	x, y := []byte(S), []byte(S)
	x[1], x[s-k-1] = x[s-k-1], x[1]
	y[1], y[s-k-1] = y[s-k-1], y[1]
	y[s-1], y[s-k-1] = y[s-k-1], y[s-1]
	Fprintf(out, "Yes\n%s\n%s", x, y)
}

package main

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

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

func solveD() {
	var a, b, k int
	scan(&a, &b, &k)

	if a == 0 {
		if k != 0 {
			printf("No")
		} else {
			by := []byte{}
			for i := 0; i < b; i++ {
				by = append(by, '1')
			}
			s := string(by)
			printf("Yes\n%s\n%s", s, s)
		}
		return
	}

	if k > a+b-2 {
		printf("No")
		return
	}

	x := make([]byte, a+b)
	y := make([]byte, a+b)
	check := func(x []byte) bool {
		cnt0, cnt1 := 0, 0
		for _, ch := range x {
			if ch == '0' {
				cnt0++
			} else {
				cnt1++
			}
		}
		return cnt0 == a && cnt1 == b && x[0] == '1'
	}
	for i := 0; i < b; i++ {
		x[i] = '1'
	}
	for i := b; i < a+b; i++ {
		x[i] = '0'
	}

	if k < a {
		diff := a - k
		for i := range x {
			y[i] = x[i]
		}
		y[b-1] = '0'
		y[a+b-1-diff] = '1'

		if check(x) && check(y) {
			printf("Yes\n%s\n%s", string(x), string(y))
		} else {
			printf("No")
		}
		return
	}

	diff := k - a
	y[b-1-diff] = '0'
	for i := 0; i < b-1-diff; i++ {
		y[i] = '1'
	}
	for i := b - diff; i < a+b; i++ {
		y[i] = x[i]
	}
	y[a+b-1] = '1'

	if check(x) && check(y) {
		printf("Yes\n%s\n%s", string(x), string(y))
	} else {
		printf("No")
	}
}

func main() {
	defer writer.Flush()
	//redirectInputToFile(reader, "input.txt")

	T := 1
	//scan(&T)
	for t := 0; t < T; t++ {
		solveD()
	}
}

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

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

func redirectInputToFile(r *bufio.Reader, fp string) {
	f, err := os.Open(fp)
	if err != nil {
		panic(err)
	}
	r.Reset(f)
}

package main

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

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

	var zero, one, resOne int
	Fscan(in, &zero, &one, &resOne)

	if zero == 0 || one == 1 {
		if resOne > 0 {
			Fprintln(out, "No")
			return
		}
		Fprintln(out, "Yes")
		s := strings.Repeat("1", one) // + strings.Repeat("0", zero)
		Fprintln(out, s)
		Fprintln(out, s)
		return
	}

	if resOne > zero+one-2 {
		Fprintln(out, "No")
		return
	}
	Fprintln(out, "Yes")
	x := strings.Repeat("1", one) + strings.Repeat("0", zero)
	Fprintln(out, x)

	if one > zero {
		mx := one - 1
		if resOne > mx {
			diff := zero + one - 2 - resOne
			leftOne := one - 1 - (one - 1 - (1 + diff))
			y := "1" + strings.Repeat("0", 1+diff) +
				strings.Repeat("1", one-1-(1+diff)) +
				strings.Repeat("0", zero-(1+diff)) +
				strings.Repeat("1", leftOne)
			Fprintln(out, y)
			return
		}

		var y string
		if resOne >= zero {
			y = "1"
			diff := mx - resOne
			y += strings.Repeat("1", diff) + strings.Repeat("0", zero)
			leftOne := one - 1 - diff
			y += strings.Repeat("1", leftOne)
		} else {
			y = strings.Repeat("1", one-1) + strings.Repeat("0", resOne) + "1" + strings.Repeat("0", zero-resOne)
		}
		Fprintln(out, y)
	} else {
		if resOne > zero {
			diff := zero + one - 2 - resOne
			leftOne := one - 1 - (one - 1 - (1 + diff))
			y := "1" + strings.Repeat("0", 1+diff) +
				strings.Repeat("1", one-1-(1+diff)) +
				strings.Repeat("0", zero-(1+diff)) +
				strings.Repeat("1", leftOne)
			Fprintln(out, y)
			return
		}
		y := strings.Repeat("1", one-1) + strings.Repeat("0", resOne) + "1" + strings.Repeat("0", zero-resOne)
		Fprintln(out, y)
	}

}

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

package main

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

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

	var zero, one, resOne int
	Fscan(in, &zero, &one, &resOne)

	if zero == 0 || one == 1 {
		if resOne > 0 {
			Fprintln(out, "No")
			return
		}
		Fprintln(out, "Yes")
		s := strings.Repeat("1", one)
		Fprintln(out, s)
		Fprintln(out, s)
		return
	}

	if resOne > zero+one-2 {
		Fprintln(out, "No")
		return
	}
	Fprintln(out, "Yes")
	x := strings.Repeat("1", one) + strings.Repeat("0", zero)
	Fprintln(out, x)

	if one > zero {
		mx := one - 1
		if resOne > mx {
			// 11111111110000000
			// 10001111110000111

			diff := zero + one - 2 - resOne
			leftOne := one - 1 - (one - 1 - (1 + diff))
			y := "1" + strings.Repeat("0", 1+diff) +
				strings.Repeat("1", one-1-(1+diff)) +
				strings.Repeat("0", zero-(1+diff)) +
				strings.Repeat("1", leftOne)
			Fprintln(out, y)
			return
		}

		var y string
		if resOne >= zero {
			y = "1"
			diff := mx - resOne
			y += strings.Repeat("1", diff) + strings.Repeat("0", zero)
			leftOne := one - 1 - diff
			y += strings.Repeat("1", leftOne)
		} else {
			y = strings.Repeat("1", one-1) + strings.Repeat("0", resOne) + "1" + strings.Repeat("0", zero-resOne)
		}
		Fprintln(out, y)
	} else {
		if resOne > zero {
			diff := zero + one - 2 - resOne
			leftOne := one - 1 - (one - 1 - (1 + diff))
			y := "1" + strings.Repeat("0", 1+diff) +
				strings.Repeat("1", one-1-(1+diff)) +
				strings.Repeat("0", zero-(1+diff)) +
				strings.Repeat("1", leftOne)
			Fprintln(out, y)
			return
		}
		y := strings.Repeat("1", one-1) + strings.Repeat("0", resOne) + "1" + strings.Repeat("0", zero-resOne)
		Fprintln(out, y)
	}

}

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

package main

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

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

	var zero, one, resOne int
	Fscan(in, &zero, &one, &resOne)

	if zero == 0 {
		if resOne > 0 {
			Fprintln(out, "No")
			return
		}
		Fprintln(out, "Yes")
		s := strings.Repeat("1", one)
		Fprintln(out, s)
		Fprintln(out, s)
		return
	}

	if resOne > zero+one-2 {
		Fprintln(out, "No")
		return
	}
	Fprintln(out, "Yes")
	x := strings.Repeat("1", one) + strings.Repeat("0", zero)
	Fprintln(out, x)

	if one > zero {
		mx := one - 1
		if resOne > mx {
			// 11111111110000000
			// 10001111110000111

			diff := zero + one - 2 - resOne
			leftOne := one - 1 - (one - 1 - (1 + diff))
			y := "1" + strings.Repeat("0", 1+diff) +
				strings.Repeat("1", one-1-(1+diff)) +
				strings.Repeat("0", zero-(1+diff)) +
				strings.Repeat("1", leftOne)
			Fprintln(out, y)
			return
		}

		var y string
		if resOne >= zero {
			y = "1"
			diff := mx - resOne
			y += strings.Repeat("1", diff) + strings.Repeat("0", zero)
			leftOne := one - 1 - diff
			y += strings.Repeat("1", leftOne)
		} else {
			y = strings.Repeat("1", one-1) + strings.Repeat("0", resOne) + "1" + strings.Repeat("0", zero-resOne)
		}
		Fprintln(out, y)
	} else {
		if resOne > zero {
			diff := zero + one - 2 - resOne
			leftOne := one - 1 - (one - 1 - (1 + diff))
			y := "1" + strings.Repeat("0", 1+diff) +
				strings.Repeat("1", one-1-(1+diff)) +
				strings.Repeat("0", zero-(1+diff)) +
				strings.Repeat("1", leftOne)
			Fprintln(out, y)
			return
		}
		y := strings.Repeat("1", one-1) + strings.Repeat("0", resOne) + "1" + strings.Repeat("0", zero-resOne)
		Fprintln(out, y)
	}

}

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

package main

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

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

	var zero, one, resOne int
	Fscan(in, &zero, &one, &resOne)

	if zero == 0 {
		if resOne > 0 {
			Fprintln(out, "No")
			return
		}
		Fprintln(out, "Yes")
		s := strings.Repeat("1", one)
		Fprintln(out, s)
		Fprintln(out, s)
		return
	}

	if one > zero {
		mx := one - 1
		if resOne > mx {
			Fprintln(out, "No")
			return
		}
		Fprintln(out, "Yes")
		x := strings.Repeat("1", one) + strings.Repeat("0", zero)

		var y string
		if resOne >= zero {
			y = "1"
			diff := mx - resOne
			y += strings.Repeat("1", diff) + strings.Repeat("0", zero)
			leftOne := one - 1 - diff
			y += strings.Repeat("1", leftOne)
		} else {
			y = strings.Repeat("1", one-1) + strings.Repeat("0", resOne) + "1" + strings.Repeat("0", zero-resOne)
		}
		Fprintln(out, x)
		Fprintln(out, y)
	} else {
		mx := zero
		if resOne > mx {
			Fprintln(out, "No")
			return
		}
		Fprintln(out, "Yes")
		x := strings.Repeat("1", one) + strings.Repeat("0", zero)

		y := strings.Repeat("1", one-1) + strings.Repeat("0", resOne) + "1" + strings.Repeat("0", zero-resOne)

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

}

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

package main

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

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

	var zero, one, resOne int
	Fscan(in, &zero, &one, &resOne)

	if one > zero {
		mx := one - 1
		if resOne > mx {
			Fprintln(out, "No")
			return
		}
		Fprintln(out, "Yes")
		x := strings.Repeat("1", one) + strings.Repeat("0", zero)

		var y string
		if resOne >= zero {
			y = "1"
			diff := mx - resOne
			y += strings.Repeat("1", diff) + strings.Repeat("0", zero)
			leftOne := one - 1 - diff
			y += strings.Repeat("1", leftOne)
		} else {
			y = strings.Repeat("1", one-1) + strings.Repeat("0", resOne) + "1" + strings.Repeat("0", zero-resOne)
		}
		Fprintln(out, x)
		Fprintln(out, y)
	} else {
		mx := zero
		if resOne > mx {
			Fprintln(out, "No")
			return
		}
		Fprintln(out, "Yes")
		x := strings.Repeat("1", one) + strings.Repeat("0", zero)

		y := strings.Repeat("1", one-1) + strings.Repeat("0", resOne) + "1" + strings.Repeat("0", zero-resOne)

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

}

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

package main

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

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

func solveD() {
	var a, b, k int
	scan(&a, &b, &k)

	if k > a+b-2 {
		printf("No")
		return
	}

	x := make([]byte, a+b)
	y := make([]byte, a+b)
	check := func(x []byte) bool {
		cnt0, cnt1 := 0, 0
		for _, ch := range x {
			if ch == '0' {
				cnt0++
			} else {
				cnt1++
			}
		}
		return cnt0 == a && cnt1 == b && x[0] == '1'
	}
	for i := 0; i < b; i++ {
		x[i] = '1'
	}
	for i := b; i < a+b; i++ {
		x[i] = '0'
	}

	if k < a {
		diff := a - k
		for i := range x {
			y[i] = x[i]
		}
		y[b-1] = '0'
		y[a+b-1-diff] = '1'

		if check(x) && check(y) {
			printf("Yes\n%s\n%s", string(x), string(y))
		} else {
			printf("No")
		}
		return
	}

	diff := k - a
	y[b-1-diff] = '0'
	for i := 0; i < b-1-diff; i++ {
		y[i] = '1'
	}
	for i := b - diff; i < a+b; i++ {
		y[i] = x[i]
	}
	y[a+b-1] = '1'

	if check(x) && check(y) {
		printf("Yes\n%s\n%s", string(x), string(y))
	} else {
		printf("No")
	}
}

func main() {
	defer writer.Flush()
	//redirectInputToFile(reader, "input.txt")

	T := 1
	//scan(&T)
	for t := 0; t < T; t++ {
		solveD()
	}
}

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

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

func redirectInputToFile(r *bufio.Reader, fp string) {
	f, err := os.Open(fp)
	if err != nil {
		panic(err)
	}
	r.Reset(f)
}

package main

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

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

func solveD() {
	var a, b, k int
	scan(&a, &b, &k)

	if k > a+b-2 {
		printf("No")
		return
	}

	y := make([]byte, a+b)
	x := make([]byte, a+b)
	for i := 0; i < b; i++ {
		x[i] = '1'
	}
	for i := b; i < a+b; i++ {
		x[i] = '0'
	}

	if k < a {
		diff := a - k
		for i := range x {
			y[i] = x[i]
		}
		y[b-1] = '0'
		y[a+b-1-diff] = '1'
		printf("Yes\n%s\n%s", string(x), string(y))
		return
	}

	diff := k - a
	y[b-1-diff] = '0'
	for i := 0; i < b-1-diff; i++ {
		y[i] = '1'
	}
	for i := b - diff; i < a+b; i++ {
		y[i] = x[i]
	}
	y[a+b-1] = '1'

	printf("Yes\n%s\n%s", string(x), string(y))
}

func main() {
	defer writer.Flush()
	//redirectInputToFile(reader, "input.txt")

	T := 1
	//scan(&T)
	for t := 0; t < T; t++ {
		solveD()
	}
}

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

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

func redirectInputToFile(r *bufio.Reader, fp string) {
	f, err := os.Open(fp)
	if err != nil {
		panic(err)
	}
	r.Reset(f)
}

package main

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

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

func solveD() {
	var a, b, k int
	scan(&a, &b, &k)

	if k > a+b-2 {
		printf("No")
		return
	}

	x := []byte{}
	for i := 0; i < b; i++ {
		x = append(x, '1')
	}
	for i := 0; i < a; i++ {
		x = append(x, '0')
	}

	start := a + b - 1 - k
	y := []byte{'1'}
	for j := 0; j < start; j++ {
		y = append(y, '0')
	}
	for j := start + 1; j < len(x); j++ {
		y = append(y, x[j])
	}
	y[len(y)-1] = '1'

	printf("Yes\n%s\n%s", string(x), string(y))
}

func main() {
	defer writer.Flush()
	//redirectInputToFile(reader, "input.txt")

	T := 1
	//scan(&T)
	for t := 0; t < T; t++ {
		solveD()
	}
}

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

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

func redirectInputToFile(r *bufio.Reader, fp string) {
	f, err := os.Open(fp)
	if err != nil {
		panic(err)
	}
	r.Reset(f)
}