A positive (strictly greater than zero) integer is called round if it is of the form d00...0. In other words, a positive integer is round if all its digits except the leftmost (most significant) are equal to zero. In particular, all numbers from $$$1$$$ to $$$9$$$ (inclusive) are round.For example, the following numbers are round: $$$4000$$$, $$$1$$$, $$$9$$$, $$$800$$$, $$$90$$$. The following numbers are not round: $$$110$$$, $$$707$$$, $$$222$$$, $$$1001$$$.You are given a positive integer $$$n$$$ ($$$1 \le n \le 10^4$$$). Represent the number $$$n$$$ as a sum of round numbers using the minimum number of summands (addends). In other words, you need to represent the given number $$$n$$$ as a sum of the least number of terms, each of which is a round number.

The first line contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the input. Then $$$t$$$ test cases follow. Each test case is a line containing an integer $$$n$$$ ($$$1 \le n \le 10^4$$$).

Print $$$t$$$ answers to the test cases. Each answer must begin with an integer $$$k$$$ — the minimum number of summands. Next, $$$k$$$ terms must follow, each of which is a round number, and their sum is $$$n$$$. The terms can be printed in any order. If there are several answers, print any of them.

package main

import (
	"fmt"
	"strings"
)

func isWin(initArray string) {
	fmt.Printf("%v\n", len(initArray)-strings.Count(initArray, "0"))
	for k, v := range initArray {
		if v != '0' {
			fmt.Printf("%v%v ", string(v), strings.Repeat("0", len(initArray)-1-k))
		}
	}
	fmt.Println()
}

func main() {
	var n int
	fmt.Scanf("%d\n", &n)
	for i := 0; i < n; i++ {
		var array string
		fmt.Scan(&array)
		isWin(array)
		// fmt.Printf("%v\n", isWin(array))
	}
}

 package main

 import (
         "fmt"
 )

 func main() {

         t := 0
         fmt.Scanf("%d\n", &t)
         for i := 0; i < t; i++ {
             var a, k int
             k = 1
             var ans []int

             fmt.Scanf("%d\n", &a)
             for a > 0{
              //   fmt.Println("a = " , a, "a%10 = ", a%10)
                 if a%10 != 0{
                    ans = append(ans,a%10 * k)
                 }
                 a /= 10

                  k *= 10

             }
             fmt.Println(len(ans))
             for i := len(ans)-1; i >= 0 ; i-- {
             fmt.Printf("%d ", ans[i])
                }
                fmt.Println()

        }
 }

package main

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

func main() {
	var t, n int
	in := bufio.NewReader(os.Stdin)
	fmt.Fscan(in, &t)
	for i := 0; i < t; i++ {
		mul := 1
		fmt.Fscan(in, &n)
		ans := make([]int, 0)
		for n > 0 {
			x := n % 10
			if x != 0 {
				ans = append(ans, x*mul)
			}
			n /= 10
			mul *= 10
		}
		fmt.Println(len(ans))
		for _, v := range ans {
			fmt.Printf("%d ", v)
		}
		fmt.Println()
	}
}

package main

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

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

func Assert(b bool) {
	if !b {
		panic("Assertion error")
	}
}

func main() {
	input := os.Stdin
	// 	input := strings.NewReader(`5
	//5009
	//7
	//9876
	//10000
	//10
	//`)
	scanner := bufio.NewScanner(input)

	getNumber := func() int {
		if !scanner.Scan() {
			panic("expected line")
		}
		t, err := strconv.ParseInt(scanner.Text(), 10, 64)
		CheckError(err)
		return int(t)
	}

	t := getNumber()
	for i := 0; i < t; i++ {
		n := getNumber()

		//fmt.Println(n)
		processNumber(n)
	}

	CheckError(scanner.Err())
}

func processNumber(n int) {
	//n := 5009 // 10000 // 7 // 9876

	lst := []string{}
	mult := 1
	for n > 0 {
		q := n / 10
		r := n % 10

		if r != 0 {
			lst = append(lst, strconv.Itoa(r*mult))
		}

		n = q
		mult *= 10
	}

	//fmt.Println(lst)
	fmt.Printf("%d\n%s\n", len(lst), strings.Join(lst, " "))
}

package main

import (
	"fmt"
)
func solve() {
	var n int
	fmt.Scanf("%d\n", &n)
	var k int = 1
	var ans[] int

	for n != 0 {
		var val int = n%10
		val *=k
		k*=10
		if val != 0 {
			ans = append(ans, val)
		}
		n /= 10
	}
	fmt.Printf("%d\n", len(ans))
	for _,v := range ans {
		fmt.Printf("%d ", v)
	}
	fmt.Printf("\n")
}
func main() {
	var t int
	fmt.Scanf("%d\n", &t)
	for i := 1; i <= t; i++ {
		solve()
	}
}

package main

import (
	"fmt"
	"math"
)

func main() {
	var (
		n, num int
		temp   string
		answer = make([]int, 5, 5)
	)

	fmt.Scanf("%d\n", &n)
	for i := 0; i < n; i++ {
		fmt.Scanf("%s\n", &temp)
		num = 0
		for j := 0; j < len(temp); j++ {
			if temp[j] != '0' {
				answer[num] = int(temp[j]-'0') * int(math.Pow10(len(temp)-j-1))
				num++
			}
		}
		fmt.Println(num)
		for j := 0; j < num; j++ {
			fmt.Print(answer[j], " ")
		}
		fmt.Println()
	}
}

package main

import (
	"fmt"
	"math"
)

func main() {
	var (
		n, num int
		temp   string
		answer = make([]int, 5, 5)
	)

	fmt.Scanf("%d\n", &n)
	for i := 0; i < n; i++ {
		fmt.Scanf("%s\n", &temp)
		num = 0
		for j := 0; j < len(temp); j++ {
			if temp[j] != '0' {
				answer[num] = int(temp[j]-'0') * int(math.Pow10(len(temp)-j-1))
				num++
			}
		}
		fmt.Println(num)
		for j := 0; j < num; j++ {
			fmt.Printf("%v ", answer[j])
		}
		fmt.Println()
	}
}

package main

import (
	"fmt"
	"math"
)

func main() {
	var (
		n    int
		temp string
	)

	fmt.Scanf("%d\n", &n)
	for i := 0; i < n; i++ {
		fmt.Scanf("%s\n", &temp)
		answer := make([]int, 0, 10)
		for j := 0; j < len(temp); j++ {
			if temp[j] != '0' {
				answer = append(answer, int(temp[j]-'0')*int(math.Pow10(len(temp)-j-1)))
			}
		}
		fmt.Println(len(answer))
		for _, v := range answer {
			fmt.Printf("%v ", v)
		}
		fmt.Println()
	}
}

package main

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

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-- {
		var s string
		fmt.Fscan(in, &s)
		fmt.Fprintln(out, len(s)-strings.Count(s, "0"))
		for i, ch := range s {
			if ch == '0' {
				continue
			}
			fmt.Fprint(out, string(ch), strings.Repeat("0", len(s)-i-1), " ")
		}
		fmt.Fprintln(out)
	}
}

package main

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

func main(){
    var(
        t,n int
        sc  =bufio.NewScanner(os.Stdin)
    )
    sc.Scan()
    t,_=strconv.Atoi(sc.Text())
    for t>0{
        t1,t2:=0,1
        a:=[]int{}
        sc.Scan()
        n,_=strconv.Atoi(sc.Text())
        for n!=0{
            if n%10!=0{
                t1++
                a=append(a,t2*(n%10))
            }
            n/=10
            t2*=10
        }
        fmt.Println(t1)
        for i:=0;i<len(a);i++{
            fmt.Print(a[i]," ")
        }
        fmt.Println()
        t--
    }
}

package main

import "fmt"

func main() {
	var t int
	fmt.Scanf("%d\n", &t)
	for i := 0; i < t; i++ {
		var num int
		fmt.Scanf("%d\n", &num)
		var ans []int
		val := 1
		for num > 0 {
			digit := (num % 10) * val
			if digit > 0 {
				ans = append(ans, digit)
			}
			num /= 10
			val *= 10
		}
		fmt.Println(len(ans))
		fmt.Printf("%d", ans[0])
		for _, x := range ans[1:] {
			fmt.Printf(" %d", x)
		}
		fmt.Printf("\n")
	}

}

package main

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

func unique(intSlice []int) []int {
    keys := make(map[int]bool)
    list := []int{}
    for _, entry := range intSlice {
        if _, value := keys[entry]; !value {
            keys[entry] = true
            list = append(list, entry)
        }
    }
    return list
}

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
func scanf(f string, a ...interface{}) { fmt.Fscanf(reader, f, a...) }

func main() {
	var t int
	fmt.Scanf("%d\n", &t)
	for t1 := 0; t1 < t; t1++ {
		var n string
		var coun int
		scanf("%s\n", &n)
		var l int
		l = len(n)

		coun=0
		for i:=0; i < l; i++ {
			if( string(n[i]) == "0") {
				coun = coun+1
			}
		}
		fmt.Println(l-coun)
		for i:=0; i < l; i++ {
			//
			if n[i] != '0' {
				fmt.Print(string(n[i]))
				for j:=0; j < l-i-1; j++ {
					fmt.Print("0")
				}

				fmt.Print(" ")
			}
		}
		fmt.Print("\n")
	}
}

package main

import (
	"fmt"
	"math"
)

func main()  {

	var num int
	fmt.Scanln(&num)

	for i := 0; i < num ; i++ {
		var val int
		fmt.Scanln(&val)
		res := ""

		count := 0
		ws := 0
		for ;val / 10 != 0; val = val / 10 {
			if (val%10)>0 {
				res = fmt.Sprint(res, int(math.Pow10(count))*(val%10) , " ")
				ws++
			}
			count++
		}
		if int(math.Pow10(count))*(val) > 0 {
			res = fmt.Sprint(res, int(math.Pow10(count))*(val))
		}
		fmt.Println(ws+1)
		fmt.Println(res)

	}

}

package main

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

func main() {
	s := NewScanner()
	t := s.NextInt()

	for i := 0; i < t; i++ {
		n := s.NextInt()

		r := []int{}
		var count int
		for n > 0 {
			if n%10 != 0 {
				r = append(r, n%10*int(math.Pow(10, float64(count))))
			}
			count++
			n /= 10
		}

		fmt.Println(len(r))
		for i, e := range r {
			fmt.Printf("%d", e)
			if i != len(r)-1 {
				fmt.Print(" ")
			}
		}
		fmt.Println()
	}
}

type scanner struct {
	*bufio.Scanner
}

func NewScanner() *scanner {
	s := bufio.NewScanner(os.Stdin)
	s.Split(bufio.ScanWords)
	return &scanner{s}
}

func (s *scanner) NextInt() int {
	s.Scan()
	i, _ := strconv.Atoi(s.Text())
	return i
}

func (s *scanner) NextInt64() int64 {
	s.Scan()
	i, _ := strconv.ParseInt(s.Text(), 10, 64)
	return i
}

func (s *scanner) NextString() string {
	s.Scan()
	return s.Text()
}

// https://codeforces.com/contest/1351/problem/A
package main

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

// (c) Dmitriy Blokhin (sv.dblokhin@gmail.com)
var input io.Reader

func main() {
	var (
		T int
	)

	//f, _ := os.Open("input.txt")
	//input := bufio.NewReader(f)
	input = bufio.NewReader(os.Stdin)
	fmt.Fscan(input, &T)
	for i := 0; i < T; i++ {
		solver()
	}
}

func solver() {
	var n int
	fmt.Fscan(input, &n)

	ans := make([]int, 0)

	for n > 0 {
		c := countd(n)
		m := (n / powten(1, c - 1)) * powten(1, c - 1)
		ans = append(ans, m)
		n -= m
	}

	fmt.Println(len(ans))
	for i := 0; i < len(ans); i++ {
		if i > 0 {
			fmt.Print(" ")
		}
		fmt.Print(ans[i])
	}
	fmt.Println()
}

func powten(a, p int) int {
	for i := 0; i < p; i++ {
		a *= 10
	}
	return a
}

func countd(a int) int {
	res := 0
	for a > 0 {
		a /= 10
		res++
	}
	return res
}

package main

import (
	"fmt"
	"strconv"
	"strings"
)

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

	for i := 0; i < t; i++ {
		var n int
		fmt.Scan(&n)

		ans := make([]string, 0)
		m := 1
		for n > 0 {
			if n % 10 > 0 {
				ans = append(ans, strconv.Itoa(m * (n % 10)))
			}
			n /= 10
			m *= 10
		}

		fmt.Println(len(ans))
		fmt.Println(strings.Join(ans, " "))
	}
}

package main

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

func main() {
	reader := bufio.NewReaderSize(os.Stdin, 1024*1024)
	t := 0
	fmt.Sscanf(readLine(reader), "%d", &t)
	for i := 0; i < t; i++ {
		num := 0
		fmt.Sscanf(readLine(reader), "%d", &num)
		r := solve(num)
		fmt.Println(len(r))
		fmt.Println(strings.Join(r, " "))
	}

}

func solve(value int) []string {
	var results []string
	digit := 0
	i := 1
	for value > 0 {
		digit = value % 10
		if digit*i > 0 {
			results = append(results, strconv.Itoa(digit*i))
		}
		value /= 10
		i *= 10
	}
	return results
}

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

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

package main

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

func main() {
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	var n int64
	fmt.Scan(&t)
	for ;t>0;t--{
		fmt.Scan(&n)
		a := solve(n)
		fmt.Fprintln(out,len(a))
		for _,v := range a{
			fmt.Fprintf(out,"%d ",v)
		}
		fmt.Fprintf(out,"\n")
	}
}

func solve(n int64) []int64 {
	out := make([]int64,0,0)
	p := pow(n)
	for ;n>0;p--{
		temp := n/int64(math.Pow(10,p))
		n-=temp*int64(math.Pow(10,p))
		if temp != 0{
			out = append(out, temp*int64(math.Pow(10,p)))
		}
	}
	return out
}

func pow(n int64) float64 {
	var i float64 = 1
	for ; ; i++ {
		temp := int(float64(n) / math.Pow(10, i))
		if temp == 0 {
			break
		}
	}
	return i - 1
}

package main

import (
	"container/list"
	"fmt"
)

func getNums(num int) *list.List {
	nums := list.New()

	div := 10
	for i := 0; num > 0; i++ {
		val := -1

		if div*10 < num {
			div *= 10
			continue
		}

		if num%div == num {
			nums.PushBack(num)
			break
		} else {
			val = (num / div) * div
			nums.PushBack(val)
		}

		num -= val
		div = 10
	}

	return nums
}

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

	var inp [100000]int

	for i := 0; i < l; i++ {
		fmt.Scan(&inp[i])
	}

	for i := 0; i < l; i++ {
		values := getNums(inp[i])

		fmt.Println(values.Len())

		for e := values.Front(); e != nil; e = e.Next() {
			fmt.Print(e.Value)

			if e.Next() == nil {
				fmt.Println()
			} else {
				fmt.Print(" ")
			}
		}
	}

}

package main

import (
	"fmt"
)

func getNums(num int) []int {
	var nums []int

	div := 10
	for i := 0; num > 0; i++ {
		val := -1

		if div*10 < num {
			div *= 10
			continue
		}

		if num%div == num {
			nums = append(nums, num)
			break
		} else {
			val = (num / div) * div
			nums = append(nums, val)
		}

		num -= val
		div = 10
	}

	return nums
}

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

	var inp []int

	for i := 0; i < l; i++ {
		var x int
		fmt.Scan(&x)
		inp = append(inp, x)
	}

	for i := 0; i < l; i++ {
		values := getNums(inp[i])
		length := len(values)
		fmt.Println(length)

		for j := 0; j < length; j++ {
			fmt.Print(values[j])

			if j == length-1 {
				fmt.Println()
			} else {
				fmt.Print(" ")
			}
		}
	}

}

package main

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

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

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

func getNums(num int) []int {
	var nums []int

	div := 10
	for i := 0; num > 0; i++ {
		val := -1

		if div*10 < num {
			div *= 10
			continue
		}

		if num%div == num {
			nums = append(nums, num)
			break
		} else {
			val = (num / div) * div
			nums = append(nums, val)
		}

		num -= val
		div = 10
	}

	return nums
}

func main() {
	defer writer.Flush()

	var l int
	scanf("%d\n", &l)

	var inp []int

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

		inp = append(inp, x)
	}

	for i := 0; i < l; i++ {
		values := getNums(inp[i])
		length := len(values)

		printf("%d\n", length)

		for j := 0; j < length; j++ {
			printf("%d", values[j])

			if j == length-1 {
				printf("\n")
			} else {
				printf(" ")
			}
		}
	}

}

package main

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

)
func max(a,b int) int{
	if(a>b){
		return a
	}
	return b;
}
func main(){
	reader := bufio.NewReader(os.Stdin)
	writer := bufio.NewWriter(os.Stdout)
	defer writer.Flush()

	var T int;
	fmt.Fscanln(reader, &T)
	for t:=0;t<T;t++ {
		var n int;
		fmt.Fscanln(reader,&n)
		k:=0;
		count:=0
		temp:=n
		ans:=[]int{}
		for temp!=0 {
			if(temp%10!=0){
			ans=append(ans,(temp%10)* int(math.Pow(10.0,float64(count))))
			k++
			}
			count++
			temp=temp/10
		}
		fmt.Fprintln(writer,k);
		for _,val := range ans {
			fmt.Fprint(writer,val," ");
		}
		fmt.Fprintln(writer,"")
	}
}

package main

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

func main()  {

	scanner := bufio.NewScanner(os.Stdin)

	scanner.Scan()

	t := scanner.Text()

	testCases, err := strconv.Atoi(t)

	if err != nil {
		panic(err)
	}

	for j := 0; j < int(testCases); j ++ {

		scanner.Scan()

		nString := scanner.Text()

		n, err := strconv.Atoi(nString)

		if err != nil {
			panic(err)
		}

		res := solve(n)

		fmt.Println(len(res))

		var buff bytes.Buffer

		for i:=0 ; i < len(res); i ++ {
			s := strconv.Itoa(res[i])
			buff.WriteString(s)
			buff.WriteString(" ")
		}

		fmt.Println(buff.String())
	}
}

func solve(n int) []int {

	var ans []int

	for i := 1 ; i < 6; i ++ {
		rem := n % pow10(i)

		if rem != 0 {
			ans = append(ans, rem)
		}

		n = n - rem
	}

	return ans
}

func pow10(n int) int {
	k := 1

	for i := 0 ; i < n; i++ {
		k = 10 * k
	}

	return k
}

/*
URL:
https://codeforces.com/contest/1352/problem/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 (
	t int
)

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

func solve(n int) {
	answers := []int{}

	cur := 0
	for n > 0 {
		ans := (n % 10) * PowInt(10, cur)
		if ans != 0 {
			answers = append(answers, ans)
		}
		cur++
		n /= 10
	}

	fmt.Println(len(answers))
	fmt.Println(PrintIntsLine(answers...))
}

// PowInt is integer version of math.Pow
// PowInt calculate a power by Binary Power (二分累乗法(O(log e))).
func PowInt(a, e int) int {
	if a < 0 || e < 0 {
		panic(errors.New("[argument error]: PowInt does not accept negative integers"))
	}

	if e == 0 {
		return 1
	}

	if e%2 == 0 {
		halfE := e / 2
		half := PowInt(a, halfE)
		return half * half
	}

	return a * PowInt(a, e-1)
}

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

/*********** 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"
	"bytes"
	"fmt"
	"io"
	"os"
	"strconv"
)

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

func run(in io.Reader, out io.Writer) {
	s := bufio.NewScanner(in)
	s.Scan()

	t, _ := strconv.ParseInt(s.Text(), 10, 64)

	for i := 0; i < int(t); i++ {
		if !s.Scan() {
			break
		}

		n, _ := strconv.ParseInt(s.Text(), 10, 64)
		fmt.Fprintln(out, process(int(n)))
	}
}

func process(n int) R {
	r := make([]int, 0, 5)
	m := 1
	for n > 0 {
		if n%10 != 0 {
			r = append(r, (n%10)*m)
		}
		n = (n - n%10) / 10
		m *= 10
	}

	return r
}

type R []int

func (r R) String() string {
	var buf bytes.Buffer

	fmt.Fprintf(&buf, "%d\n", len(r))
	for _, n := range r {
		fmt.Fprintf(&buf, "%d ", n)
	}

	b := buf.Bytes()
	return string(b[:len(b)-1])
}

package main

import "fmt"

func solve() int{
	var n int
	fmt.Scanln(&n)
	i := 1
	c := 0
	for n > 0 {
		if n % 10 > 0 {
			defer fmt.Printf("%v ", i*(n % 10))
			c += 1
		}
		n /= 10
		i *= 10
	}
	fmt.Println(c)
	return 1
}

func main(){
	var t int
	fmt.Scanln(&t)
	for t > 0 {
		t -= solve()
	}
}

package main

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

func solve() {
	t := readInt()
	for i := 0; i < t; i++ {
		n := readInt()
		m := 10
		a := make([]string, 0)
		for m < n {
			rest := n % m
			if rest > 0 {
				a = append(a, strconv.Itoa(rest))
			}
			n -= rest
			m *= 10
		}
		if n > 0 {
			a = append(a, strconv.Itoa(n))
		}
		fmt.Println(len(a))
		fmt.Println(strings.Join(a, " "))
	}
}

var scanner *bufio.Scanner

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

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

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

// IO

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

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

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

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

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

package main

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

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

	var t, n int
	for Fscan(in, &t); t > 0; t-- {
		Fscan(in, &n)
		ten := 1
		s := strconv.Itoa(n)
		ans := []interface{}{}
		for i := 0; i < len(s); i++ {
			if s[len(s)-1-i] != '0' {
				ans = append(ans, ten*int(s[len(s)-1-i]-'0'))
			}
			ten *= 10
		}
		Fprintln(out, len(ans))
		Fprintln(out, ans...)
	}
}

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

package main

import . "fmt"

// github.com/EndlessCheng/codeforces-go
func main() {
	var t, n int
	for Scan(&t); t > 0; t-- {
		Scan(&n)
		a := []interface{}{}
		for i := 1; n > 0; n /= 10 {
			if n%10 > 0 {
				a = append(a, n%10*i)
			}
			i *= 10
		}
		Println(len(a))
		Println(a...)
	}
}

package main

import (
	. "fmt"
)

// github.com/EndlessCheng/codeforces-go
func main() {
	var t, n int
	for Scan(&t); t > 0; t-- {
		Scan(&n)
		a := []interface{}{}
		for i := 1; n > 0; n /= 10 {
			if n%10 > 0 {
				a = append(a, n%10*i)
			}
			i *= 10
		}
		Println(len(a))
		Println(a...)
	}
}

package main

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

func main() {
	var n,in int
	// in := bufio.NewReader(os.Stdin)
	// fmt.Fscanf(in, "%d %d\n", &n, &m)
	fmt.Scan(&n)
	for i:=0; i < n; i++{
		fmt.Scan(&in)
		var s []int
		var c int = 1
		for in != 0{
			if in % 10 != 0{
				s = append(s, in % 10 * c)
			}
			c *= 10
			in /= 10
		}
		fmt.Println(len(s))
		for k:=0; k < len(s); k++{
			fmt.Print(s[k], " ")
		}
		fmt.Println()
	}
}

package main

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

var DEBUG = true

func main() {
	defer Flush()

	T := readi()
	for i := 0; i < T; i++ {
		n := readi()
		a := solve(n)
		println(len(a))
		sp := ""
		for _, v := range a {
			printf("%s%d", sp, v)
			sp = " "
		}
		println()
	}
}

func solve(n int) []int {
	var a []int
	d := 10
	for x := n; x != 0; d *= 10 {
		v := x % d
		if v == 0 {
			continue
		}
		a = append(a, v)
		x -= v
	}
	return a
}

// -----------------------------------------------------------------------------

// IO helper functions

// Returns next token from input.  It must be initialized by SetInput()
// before the first call.
var nextToken func() ([]byte, error)
var nextLine func() ([]byte, error)

// Holds a buffer for output.  It must be initialized by SetOutput().
// All IO fucntions (read*() and [e]print*()) should write to OutputWriter
// instead of this.
var OutputBuffer *bufio.Writer

// Holds an io.Writer.  It must be initialized by SetOutput()
var OutputWriter io.Writer

// Set IO functions for interactive input/output.
func SetInteractive(w io.Writer, r io.Reader) {
	SetUnbefferedInput(r)
	OutputBuffer = nil
	OutputWriter = w
}

// Setup OutputBuffer and OutputWriter.
func SetOutput(w io.Writer) {
	OutputBuffer = bufio.NewWriter(w)
	OutputWriter = OutputBuffer
}

// Flushes OutputBuffer
func Flush() {
	if OutputBuffer != nil {
		OutputBuffer.Flush()
	}
}

// Returns true if c is a white space
func IsSpace(c byte) bool {
	switch c {
	case '\t', '\n', '\v', '\f', '\r', ' ':
		return true
	}
	return false
}

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

// Setup nextToken with input buffer.
func SetInput(r io.Reader) {
	buf := new(bytes.Buffer)
	var b []byte

	var i int
	rest := func() ([]byte, error) {
		for i < len(b) && IsSpace(b[i]) {
			i++
		}
		if i == len(b) {
			return nil, io.ErrUnexpectedEOF
		}
		j := i
		for i < len(b) && !IsSpace(b[i]) {
			i++
		}
		return b[j:i], nil
	}
	initial := func() ([]byte, error) {
		io.Copy(buf, r)
		b = buf.Bytes()
		nextToken = rest
		return rest()
	}
	nextToken = initial

	restLn := func() ([]byte, error) {
		for i < len(b) && IsNewLine(b[i]) {
			i++
		}
		if i == len(b) {
			return nil, io.ErrUnexpectedEOF
		}
		j := i
		for i < len(b) && !IsNewLine(b[i]) {
			i++
		}
		return b[j:i], nil
	}

	initialLn := func() ([]byte, error) {
		io.Copy(buf, r)
		b = buf.Bytes()
		nextLine = restLn
		return restLn()
	}
	nextLine = initialLn
}

// Setup nextToken without input buffer.
func SetUnbefferedInput(r io.Reader) {
	buf := bufio.NewReader(r)
	var b []byte

	var i int
	nextToken = func() ([]byte, error) {
		var err error
		if i == len(b) {
			b, err = buf.ReadBytes('\n')
			if err != nil {
				return nil, err
			}
			i = 0
			j := len(b) - 1
			for 0 <= j && IsSpace(b[j]) {
				j--
			}
			b = b[0 : j+1]
		}
		for i < len(b) && IsSpace(b[i]) {
			i++
		}
		j := i
		for i < len(b) && !IsSpace(b[i]) {
			i++
		}
		if i == j {
			return nil, io.ErrUnexpectedEOF
		}
		return b[j:i], nil
	}
}

// -----------------------------------------------------------------------------

// IO functions

// Reads next token and return it as []byte
func readb() []byte {
	b, err := nextToken()
	if err != nil {
		panic(err)
	}
	return b[:len(b):len(b)]
}

// Reads next token and return it as string
func reads() string {
	return string(readb())
}

// Read next line as []byte.  Trailing '\n' will not be included.
// See also comments on readb()
func readbln() []byte {
	b, err := nextLine()
	if err != nil {
		panic(err)
	}
	return b[:len(b):len(b)]
}

// Read next line as string
func readsln() string {
	return string(readbln())
}

// Reads next token and return it as int64
func readll() int64 {
	i, err := strconv.ParseInt(reads(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// Reads next token and return it as int
func readi() int {
	return int(readll())
}

// Reads next token and return it as float64
func readf() float64 {
	f, err := strconv.ParseFloat(reads(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// Write args to OutputWriter with the format f
func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(OutputWriter, f, args...)
}

// Write args to OutputWriter without format
func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(OutputWriter, args...)
}

// Write args to stderr with the format f
func eprintf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(os.Stderr, f, args...)
}

// Write args to stderr without format
func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

func dbgf(f string, args ...interface{}) {
	if !DEBUG {
		return
	}
	fmt.Fprintf(os.Stderr, f, args...)
}

func dbg(args ...interface{}) {
	if !DEBUG {
		return
	}
	fmt.Fprintln(os.Stderr, args...)
}

// -----------------------------------------------------------------------------

// Utilities

func sumSlice(a []int) int {
	var res int
	for _, v := range a {
		res += v
	}
	return res
}

func sumSlicell(a []int64) int64 {
	var res int64
	for _, v := range a {
		res += v
	}
	return res
}

func readInts(N int) (int, []int) {
	if N == 0 {
		N = readi()
	}
	a := make([]int, N)
	for i := range a {
		a[i] = readi()
	}
	return N, a
}

func readIntsll(N int) (int, []int64) {
	if N == 0 {
		N = readi()
	}
	a := make([]int64, N)
	for i := range a {
		a[i] = readll()
	}
	return N, a
}

// -----------------------------------------------------------------------------

// Simple math functions

const (
	// big prime
	INF  = 1000000007
	INF2 = 1000000009
	INF3 = 998244353
)

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

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

func minf(a, b float64) float64 {
	if a < b {
		return a
	}
	return b
}

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

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

func maxf(a, b float64) float64 {
	if a < b {
		return b
	}
	return a
}

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

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

func absf(a float64) float64 {
	if a < 0 {
		return -a
	}
	return a
}

// egcd(a, b) returns d, x, y:
//   d is gcd(a,b)
//   x, y are  integers that satisfy ax + by = d
func egcd(a, b int) (int, int, int) {
	if b == 0 {
		return a, 1, 0
	}
	d, x, y := egcd(b, a%b)
	return d, y, x - a/b*y
}

func egcdll(a, b int64) (int64, int64, int64) {
	if b == 0 {
		return a, 1, 0
	}
	d, x, y := egcdll(b, a%b)
	return d, y, x - a/b*y
}

func gcd(a, b int) int {
	d, _, _ := egcd(a, b)
	return d
}

func gcdll(a, b int64) int64 {
	d, _, _ := egcdll(a, b)
	return d
}

// set up IO functions
func init() {
	// for non-interactive
	SetInput(os.Stdin)
	SetOutput(os.Stdout)

	// Enable below when interactive.  Its ok to leave above intact.
	// SetInteractive(os.Stdout, os.Stdin)
}

package main

import (
	"fmt"
	"strconv"
	"strings"
)

func main() {
	var a int
	_, err := fmt.Scan(&a)
	if err != nil {
		return
	}

	for i := 1; i <= a; i++ {
		arr := make([]string, 0)
		var number int
		_, err := fmt.Scan(&number)
		if err != nil {
			return
		}

		for number != 0 {
			s := strconv.Itoa(number)
			round := string(s[0]) + strings.Repeat("0", len(s)-1)
			rNumber, err := strconv.Atoi(round)
			if err != nil {
				return
			}
			arr = append(arr, round)
			number = number - rNumber
		}
		fmt.Println(len(arr))
		fmt.Println(strings.Join(arr, " "))
	}

}

package main

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

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

func main() {
	sc.Split(bufio.ScanWords)
	defer out.Flush() // !!!!coution!!!! you must use Fprint(out, ) not Print()
	/* --- code --- */
	t := nextInt()
	for i := 0; i < t; i++ {
		n := next()
		test(n)
	}

}

func test(n string) {
	l := len(n)
	ans := make([]int, l)
	ansI := 0
	for i := 0; i < l; i++ {
		if string(n[l-i-1]) == "0" {
			continue
		} else {
			atoi, _ := strconv.Atoi(string(n[l-i-1]))
			ans[ansI] = atoi * pow(10, i)
			ansI++
		}
	}
	fmt.Println(ansI)
	for i := 0; i < ansI; i++ {
		fmt.Print(ans[i])
		fmt.Print(" ")
	}
	fmt.Println("")
}

// -*-*-*-*-*-*-*-*-
// * I/O utilities *
// -*-*-*-*-*-*-*-*-

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

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

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

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

func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func nextFloats(n int) []float64 {
	ret := make([]float64, n)
	for i := 0; i < n; i++ {
		ret[i] = nextFloat64()
	}
	return ret
}
func nextStrings(n int) []string {
	ret := make([]string, n)
	for i := 0; i < n; i++ {
		ret[i] = next()
	}
	return ret
}

func split(s string) []string {
	ret := make([]string, len([]rune(s)))
	for i, v := range []rune(s) {
		ret[i] = string(v)
	}
	return ret
}

func PrintOut(src interface{}, joinner string) {
	switch reflect.TypeOf(src).Kind() {
	case reflect.Slice:
		s := reflect.ValueOf(src)
		for idx := 0; idx < s.Len(); idx++ {
			fmt.Fprintf(out, "%v", s.Index(idx))
			if idx < s.Len()-1 {
				fmt.Fprintf(out, "%s", joinner)
			} else {
				fmt.Fprintln(out)
			}
		}
	default:
		fmt.Fprintln(out, "fuck")
	}
}

// -*-*-*-*-*-*-*-*-
// * tool snippets *
// -*-*-*-*-*-*-*-*-
func duplicate2Int(base [][]int) (ret [][]int) {
	ret = make([][]int, len(base))
	for i, v := range base {
		ret[i] = append([]int{}, v...)
	}
	return
}

// -*-*-*-*-*-*-*-*-*-*-*-*-*-
// * Algorithms Utility Zone *
// -*-*-*-*-*-*-*-*-*-*-*-*-*-

// -*-*-*-*-*-*-*-
// * 1. nibutan  *
// -*-*-*-*-*-*-*-
func lower_bound(arr []int, target int) int {
	l, r := 0, len(arr)
	for l < r {
		mid := (l + r) / 2
		if arr[mid] < target {
			l = mid + 1
		} else {
			r = mid
		}
	}
	return l
}

func upper_bound(arr []int, target int) int {
	l, r := 0, len(arr)
	for l < r {
		mid := (l + r) / 2
		if target < arr[mid] {
			r = mid
		} else {
			l = mid + 1
		}
	}
	return l
}

// *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
// * math flavor typical theories *
// *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
func gcd(a, b int) int {
	if a > b {
		return gcd(b, a)
	}
	for a != 0 {
		a, b = b%a, a
	}
	return b
}

func pow(a, b int) (ret int) {
	if b == 0 {
		return 1
	}
	ret = a
	// 10^2 = 100ってことは10に10を1回掛けることだね
	// なので初期値を含めると上限b-1未満
	for i := 0; i < b-1; i++ {
		ret *= a
	}
	return
}

func powMod(n, m, mod int) (ret int) {
	ret = 1
	for m > 0 {
		if m&1 == 1 {
			ret *= n
			ret %= mod
		}
		n *= n
		n %= mod
		m >>= 1
	}
	return ret
}

package main

import (
	"fmt"
	"math"
	"strconv"
)

func main() {
	var t, n int
	// fmt.Scanf("%d", &t)
	fmt.Scanln(&t)
	for i := 0; i < t; i++ {
		// fmt.Scanf("%d", &n)
		fmt.Scanln(&n)
		ans := make([]int, 0)
		s := strconv.Itoa(n)
		for i, c := range s {
			if c != '0' {
				ans = append(ans, int(c-'0')*int(math.Pow10(len(s)-i-1)))
			}
		}
		fmt.Println(len(ans))
		for _, v := range ans {
			fmt.Printf("%d ", v)
		}
		fmt.Println()
	}
}

package main

import (
	"fmt"
)

func solve(buff string) {
	numbersCount := 0
	for i := 0; i < len(buff); i++ {
		if string(buff[i]) != "0" {
			numbersCount++
		}
	}
	fmt.Println(numbersCount)
	for i := len(buff) - 1; i >= 0; i-- {
		if string(buff[len(buff)-i-1]) == "0" {
			continue
		}
		output := string(buff[len(buff)-i-1])
		// fmt.Println("Output:", output)
		for j := 0; j < i; j++ {
			output = output + "0"
		}
		fmt.Print(output, " ")
	}
	fmt.Println()
}

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

package main

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

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

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

func main() {
	t, n := 0, 0
	scanf("%d\n", &t)
	for t > 0 {
		t--
		scanf("%d\n", &n)

		p := 1
		var a []int
		for n > 0 {
			if n % 10 > 0 {
				a = append(a, p * (n % 10))
			}
			n /= 10
			p *= 10
		}
		printf("%d\n", len(a))
		for _, v := range a {
			printf("%d ", v)
		}
		printf("\n")
	}
	writer.Flush()
}

package main

import (
	"fmt"
	"strings"
)

func main() {
	var t int
	fmt.Scan(&t)
	for ; t > 0; t-- {
		var n int
		fmt.Scan(&n)
		d := 1
		c := 0
		arr := []int{}
		for n > 0 {
			x := n % 10 * d
			if x > 0 {
				c++
				arr = append(arr, x)
			}
			n /= 10
			d *= 10
		}
		fmt.Println(c)
		fmt.Println(strings.Trim(fmt.Sprint(arr), "[]"))
	}
}

package main

import "fmt"

func main() {
	var t, n int
	fmt.Scan(&t)
	for i := 0; i < t; i++ {
		fmt.Scan(&n)
		var arr = make([]int, 0, 5)
		for div := 10; n != 0; div *= 10 {
			if n%div != 0 {
				arr = append(arr, n%div)
				n -= n % div
			}
		}
		fmt.Println(len(arr))
		for _, val := range arr {
			fmt.Printf("%v ", val)
		}
		fmt.Printf("\n")
	}
}

package main

import "fmt"

func main() {

	var t,i int
	fmt.Scan(&t)
	// fmt.Printf(" %d" ,t/10)
	i = 0
	for i<t {
		var n int
		fmt.Scan(&n)
		a := make([]int,0)
		x := 1
		for {
			y:=(n%10)
			if y!=0{
				a= append(a,y*x)
			}
			n = n/10
			if n<=0 {
				break
			}
			x*=10
		}
		fmt.Println(len(a))
		y:=len(a)
		for j:=0;j<y;j++{
			fmt.Printf("%d ",a[j])
		}
		// fmt.Println(len(a))
		i+=1
	}

}

package main

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

// https://codeforces.com/problemset/problem/1352/A
// A. Sum of Round Numbers
// time limit per test
// 1 second
// memory limit per test
// 256 megabytes
// input
// standard input
// output
// standard output

// A positive (strictly greater than zero) integer is called round if it is of the form d00...0. In other words, a positive integer is round if all its digits except the leftmost (most significant) are equal to zero. In particular, all numbers from 1
// to 9

// (inclusive) are round.

// For example, the following numbers are round: 4000
// , 1, 9, 800, 90. The following numbers are not round: 110, 707, 222, 1001

// .

// You are given a positive integer n
// (1≤n≤104). Represent the number n as a sum of round numbers using the minimum number of summands (addends). In other words, you need to represent the given number n

// as a sum of the least number of terms, each of which is a round number.
// Input

// The first line contains an integer t
// (1≤t≤104) — the number of test cases in the input. Then t

// test cases follow.

// Each test case is a line containing an integer n
// (1≤n≤104

// ).
// Output

// Print t
// answers to the test cases. Each answer must begin with an integer k — the minimum number of summands. Next, k terms must follow, each of which is a round number, and their sum is n. The terms can be printed in any order. If there are several answers, print any of them.

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

	var t int
	_, _ = fmt.Fscan(bufStdin, &t)

	for i := 0; i < t; i++ {
		var n int
		_, _ = fmt.Fscan(bufStdin, &n)

		decomposition := decomposeIntoRoundNumbers(n)

		_, _ = fmt.Fprintln(bufStdout, len(decomposition))
		for _, v := range decomposition {
			_, _ = fmt.Fprint(bufStdout, v, " ")
		}
		_, _ = fmt.Fprintln(bufStdout)
	}
}

func decomposeIntoRoundNumbers(n int) []int {
	var decomposition []int

	power := 10
	for n > 0 {
		digit := n % 10
		if digit != 0 {
			decomposition = append(decomposition, digit*(power/10))
		}

		power *= 10
		n /= 10
	}

	return decomposition
}

package main
import (
	"bufio"
	"fmt"
	"os"
)
func main() {
	r := bufio.NewReader(os.Stdin)
	w := bufio.NewWriter(os.Stdout)
	defer w.Flush()
	var t int
	fmt.Fscan(r, &t)
	for i := 0; i < t; i++ {
		var n int
		fmt.Fscan(r, &n)
		var a []int
		for j := 1; j <= n; j *= 10 {
			x := (n/j)%10
			if x != 0 {
				a = append(a, x * j)
			}
		}
		fmt.Fprintln(w, len(a))
		for _, x := range a {
			fmt.Fprintf(w, "%d ", x)
		}
		fmt.Fprintln(w)
	}
}

package main

import (
	"bytes"
	"fmt"
	"io/ioutil"
	"os"
)

// https://codeforces.com/problemset/problem/1352/A
// комментарии к решению
// Т.к. требуется оперировать цифрами, а не числами, то задействуем посимвольную обработку
// входного потока. Т.к. числа из входного потока <= 10000, то и их количество в выходной строке
// будет не больше 4, за что отвечает 1 символ, поэтому нам не требуется предварительно считать
// на сколько чисел нам необходимо разбить текущее, а можно просто инкрементировать символ '0'
// на позиции кол-ва чисел. Для примера по итерациям разбив 5009 будет выглядеть так:
// 0: 0\n
// 1: 1\n5000
// 2: 2\n5000 9
func taskSolution(a [][]byte) string {
	ans := []byte{'0', '\n'}
	num := a[0]
	nCountPos := 0
	for j := 0; j < len(num); j += 1 {
		if num[j] > '0' && num[j] <= '9' {
			ans[nCountPos] = ans[nCountPos] + byte(1)
			ans = append(ans, num[j])
			for k := j + 1; k < len(num) && num[k] >= '0' && num[k] <= '9'; k += 1 {
				ans = append(ans, byte('0'))
			}
			ans = append(ans, byte(' '))
		}
	}
	for i := 1; i < len(a); i += 1 {
		ans[len(ans)-1] = '\n'
		num = a[i]
		nCountPos = len(ans)
		ans = append(ans, []byte("0\n")...)
		for j := 0; j < len(num); j += 1 {
			if num[j] > '0' && num[j] <= '9' {
				ans[nCountPos] = ans[nCountPos] + byte(1)
				ans = append(ans, num[j])
				for k := j + 1; k < len(num) && num[k] >= '0' && num[k] <= '9'; k += 1 {
					ans = append(ans, byte('0'))
				}
				ans = append(ans, byte(' '))
			}
		}
	}
	return string(ans[:len(ans)-1])
}

func main() {
	var n int
	if _, err := fmt.Scan(&n); err != nil {
		panic(err)
	}

	inRaw, err := ioutil.ReadAll(os.Stdin)
	if err != nil {
		panic(err)
	}
	inRawArr := bytes.Split(bytes.TrimSpace(inRaw), []byte("\n"))

	fmt.Println(taskSolution(inRawArr))
}

package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout
	cnt := 0

	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
		cnt = 0
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)
	solve(scanner, writer)
	for i := 0; i < cnt; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}

	writer.Flush()
}

func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	t := getNextInt(scanner)
	for i := 0; i < t; i++ {
		k := getNextInt(scanner)
		nn := numbers(k)
		fmt.Fprintln(writer, len(nn))
		fmt.Fprintln(writer, ans(nn))
	}
}

func ans(nn []int) string {
	n := len(nn)
	ss := make([]string, n)
	for i := 0; i < n; i++ {
		ss[i] = fmt.Sprintf("%d", nn[i])
	}

	return strings.Join(ss, " ")
}
func numbers(x int) []int {
	nn := make([]int, 0)
	d := 1
	for x > 0 {
		if x%10 > 0 {
			nn = append(nn, d*(x%10))
		}
		x /= 10
		d *= 10
	}

	return nn
}

package main

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

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

func main() {
	scanner = bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	writer = bufio.NewWriter(os.Stdout)
	defer writer.Flush()

	n := nextInt()
	for i := 0; i < n; i++ {
		scanner.Scan()
		s := scanner.Text()
		cnt := 0
		var buf []int
		for i, val := range s {
			n := val-'0'
			if n == 0 {
				continue
			}
			cnt++
			buf = append(buf, int(n) * int(math.Pow(10, float64(len(s)-i-1))))
		}
		fmt.Fprintf(writer, "%d\n", cnt)
		ss := fmt.Sprintf("%v", buf)
		fmt.Fprintf(writer, "%s\n", strings.Trim(ss, "[]"))
	}
}

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

func printInts(a ...int) {
	for _, item := range a {
			fmt.Fprintf(writer, "%d ", item)
	}
	fmt.Fprintln(writer, "")
}

package main

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

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

type writerImpl struct {
	*bufio.Writer
}

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

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

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

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

type wordScannerImpl struct {
	*bufio.Scanner
}

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

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

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

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

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

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

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

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

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

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

func main() {
	defer writer.Flush()
	t := reader.NextInt64()
	for ; t > 0; t-- {
		n := reader.NextInt64()
		curr := int64(1)
		res := []int64{}
		for n > 0 {
			ans := (n % 10) * curr
			if ans != 0 {
				res = append(res, ans)
			}
			n /= 10
			curr *= 10
		}
		writer.Printf("%d\n", len(res))
		for _, r := range res {
			writer.Printf("%d ", r)
		}
		writer.Printf("\n")
	}
}

package main

import (
	"container/list"
	"fmt"
)

func main(){
	var t int
	fmt.Scanf("%d\n",&t)
		for i:=0;i<t;i++{
		var n int
		fmt.Scanf("%d\n",&n)
		power := 1
		l := list.New()
		for n > 0{
			if n % 0xa > 0{
				l.PushBack((n%0xa)*power)
			}
			n /=0xa
			power *=0xa
		}
		fmt.Println(l.Len())
		for e := l.Front(); e != nil; e = e.Next(){
			fmt.Printf("%d ",e.Value.(int))
		}
		fmt.Println()
	}
}

package main

import (
	"fmt"
)

func main(){
	var t int
	fmt.Scanf("%d\n",&t)
		for i:=0;i<t;i++{
		var n int
		fmt.Scanf("%d\n",&n)
		power := 1
		vector := []int{}
		for n > 0{
			if n % 0xa > 0{
				vector = append(vector,(n%0xa)*power)
			}
			n /=0xa
			power *=0xa
		}
		fmt.Println(len(vector))
		for v := 0; v < len(vector); v++ {
			fmt.Printf("%d ",vector[v])
		}
		fmt.Println()
	}
}

 package main

 import (
         "fmt"
 )

 func main() {

         t := 0
         fmt.Scanf("%d\n", &t)
         for i := 0; i < t; i++ {
             var a,b int
             fmt.Scanf("%d %d\n", &a,&b)
             fmt.Println(a+b)

        }
 }

package main

import (
	"fmt"
)
func solve() {
	var n int
	fmt.Scanf("%d", &n);
	var k int = 1
	var ans[] int

	for n != 0 {
		var val int = n%10
		val *=k
		k*=10
		if val != 0 {
			ans = append(ans, val)
		}
		n /= 10
	}
	fmt.Printf("%d\n", len(ans))
	for _,v := range ans {
		fmt.Printf("%d ", v)
	}
	fmt.Printf("\n")
}
func main() {
	var t int
	fmt.Scanf("%d", &t)
	for i := 1; i <= t; i++ {
		solve()
	}
}

package main

import "fmt"

func main() {
	var t int
	fmt.Scanf("%d\n", &t)
	for i := 0; i < t; i++ {
		var num int
		fmt.Scanf("%d\n", &num)
		var ans []int
		val := 1
		for num > 0 {
			digit := (num % 10) * val
			if digit > 0 {
				ans = append(ans, digit)
			}
			num /= 10
			val *= 10
		}
		fmt.Println(len(ans))
		fmt.Printf("%d", ans[0])
		for _, x := range ans[1:] {
			fmt.Printf(" %d", x)
		}
	}

}

package main

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

func solve() {
	t := readInt()
	for i := 0; i < t; i++ {
		n := readInt()
		nOrig := n
		m := 10
		a := make([]int, 0)
		for m < n {
			rest := n % m
			if rest > 0 {
				a = append(a, rest)
			}
			n -= rest
			m *= 10
		}
		if n > 0 {
			a = append(a, n)
		}
		fmt.Println(nOrig, len(a))
		for _, i := range a {
			fmt.Println(i)
		}
	}
}

var scanner *bufio.Scanner

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

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

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

// IO

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

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

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

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

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

package main

import (
	"fmt"
	"math"
	"strconv"
)

func main() {
	var t, n int
	fmt.Scanf("%d", &t)
	for i := 0; i < t; i++ {
		fmt.Scanf("%d", &n)
		ans := make([]int, 0)
		s := strconv.Itoa(n)
		for i, c := range s {
			if c != '0' {
				ans = append(ans, int(c-'0')*int(math.Pow10(len(s)-i-1)))
			}
		}
		fmt.Println(len(ans))
		for _, v := range ans {
			fmt.Printf("%d ", v)
		}
		fmt.Println()
	}
}

package main

import (
	"bytes"
	"fmt"
	"io/ioutil"
	"os"
)

// https://codeforces.com/problemset/problem/1352/A
// комментарии к решению
// Т.к. требуется оперировать цифрами, а не числами, то задействуем посимвольную обработку
// входного потока. Т.к. числа из входного потока <= 10000, то и их количество в выходной строке
// будет не больше 4, за что отвечает 1 символ, поэтому нам не требуется предварительно считать
// на сколько чисел нам необходимо разбить текущее, а можно просто инкрементировать символ '0'
// на позиции кол-ва чисел. Для примера по итерациям разбив 5009 будет выглядеть так:
// 0: 0\n
// 1: 1\n5000
// 2: 2\n5000 9
func taskSolution(a [][]byte) string {
	ans := []byte{'0', '\n'}
	num := a[0]
	nCountPos := 0
	for j := 0; j < len(num); j += 1 {
		if num[j] != byte('0') {
			ans[nCountPos] = ans[nCountPos] + byte(1)
			ans = append(ans, num[j])
			for k := j + 1; k < len(num) && num[k] >= '0' && num[k] <= '9'; k += 1 {
				ans = append(ans, byte('0'))
			}
			ans = append(ans, byte(' '))
		}
	}
	for i := 1; i < len(a); i += 1 {
		ans[len(ans)-1] = '\n'
		num = a[i]
		nCountPos = len(ans)
		ans = append(ans, []byte("0\n")...)
		for j := 0; j < len(num); j += 1 {
			if num[j] != byte('0') {
				ans[nCountPos] = ans[nCountPos] + byte(1)
				ans = append(ans, num[j])
				for k := j + 1; k < len(num) && num[k] >= '0' && num[k] <= '9'; k += 1 {
					ans = append(ans, byte('0'))
				}
				ans = append(ans, byte(' '))
			}
		}
	}
	return string(ans[:len(ans)-1])
}

func main() {
	var n int
	if _, err := fmt.Scan(&n); err != nil {
		panic(err)
	}

	inRaw, err := ioutil.ReadAll(os.Stdin)
	if err != nil {
		panic(err)
	}
	inRawArr := bytes.Split(bytes.TrimSpace(inRaw), []byte("\n"))

	fmt.Println(taskSolution(inRawArr))
}

package main

import (
	"bytes"
	"fmt"
	"io/ioutil"
	"os"
)

// https://codeforces.com/problemset/problem/1352/A
// комментарии к решению
// Т.к. требуется оперировать цифрами, а не числами, то задействуем посимвольную обработку
// входного потока. Т.к. числа из входного потока <= 10000, то и их количество в выходной строке
// будет не больше 4, за что отвечает 1 символ, поэтому нам не требуется предварительно считать
// на сколько чисел нам необходимо разбить текущее, а можно просто инкрементировать символ '0'
// на позиции кол-ва чисел. Для примера по итерациям разбив 5009 будет выглядеть так:
// 0: 0\n
// 1: 1\n5000
// 2: 2\n5000 9
func taskSolution(a [][]byte) string {
	ans := []byte{'0', '\n'}
	number := a[0]
	nCountPos := 0
	for j := 0; j < len(number); j += 1 {
		if number[j] != byte('0') {
			ans[nCountPos] = ans[nCountPos] + byte(1)
			ans = append(ans, number[j])
			for k := j + 1; k < len(number); k += 1 {
				ans = append(ans, byte('0'))
			}
			ans = append(ans, byte(' '))
		}
	}
	for i := 1; i < len(a); i += 1 {
		ans[len(ans)-1] = '\n'
		number = a[i]
		nCountPos = len(ans)
		ans = append(ans, []byte("0\n")...)
		for j := 0; j < len(number); j += 1 {
			if number[j] != byte('0') {
				ans[nCountPos] = ans[nCountPos] + byte(1)
				ans = append(ans, number[j])
				for k := j + 1; k < len(number); k += 1 {
					ans = append(ans, byte('0'))
				}
				ans = append(ans, byte(' '))
			}
		}
	}
	return string(ans[:len(ans)-1])
}

func main() {
	var n int
	if _, err := fmt.Scan(&n); err != nil {
		panic(err)
	}

	inRaw, err := ioutil.ReadAll(os.Stdin)
	if err != nil {
		panic(err)
	}
	inRawArr := bytes.Split(bytes.TrimSpace(inRaw), []byte("\n"))

	fmt.Println(taskSolution(inRawArr))
}


Nikephoros and Polycarpus play rock-paper-scissors. The loser gets pinched (not too severely!).Let us remind you the rules of this game. Rock-paper-scissors is played by two players. In each round the players choose one of three items independently from each other. They show the items with their hands: a rock, scissors or paper. The winner is determined by the following rules: the rock beats the scissors, the scissors beat the paper and the paper beats the rock. If the players choose the same item, the round finishes with a draw.Nikephoros and Polycarpus have played n rounds. In each round the winner gave the loser a friendly pinch and the loser ended up with a fresh and new red spot on his body. If the round finished in a draw, the players did nothing and just played on.Nikephoros turned out to have worked out the following strategy: before the game began, he chose some sequence of items A = (a1, a2, ..., am), and then he cyclically showed the items from this sequence, starting from the first one. Cyclically means that Nikephoros shows signs in the following order: a1, a2, ..., am, a1, a2, ..., am, a1, ... and so on. Polycarpus had a similar strategy, only he had his own sequence of items B = (b1, b2, ..., bk).Determine the number of red spots on both players after they've played n rounds of the game. You can consider that when the game began, the boys had no red spots on them.

The first line contains integer n (1 ≤ n ≤ 2·109) — the number of the game's rounds. The second line contains sequence A as a string of m characters and the third line contains sequence B as a string of k characters (1 ≤ m, k ≤ 1000). The given lines only contain characters "R", "S" and "P". Character "R" stands for the rock, character "S" represents the scissors and "P" represents the paper.

Print two space-separated integers: the numbers of red spots Nikephoros and Polycarpus have.

NoteIn the first sample the game went like this:  R - R. Draw.  P - S. Nikephoros loses.  S - P. Polycarpus loses.  R - P. Nikephoros loses.  P - R. Polycarpus loses.  S - S. Draw.  R - P. Nikephoros loses. Thus, in total Nikephoros has 3 losses (and 3 red spots), and Polycarpus only has 2.

package main

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

var reader SReader

// a beat b return 1
// a draw b return 0
// b beat a return -1
func beat(a, b byte) int {
	if a == b {
		return 0
	} else {
		if (a == 'R' && b == 'S') || (a == 'S' && b == 'P') || (a == 'P' && b == 'R') {
			return 1
		} else {
			return -1
		}
	}
}

func main() {
    reader.Init()
	n := int(reader.ReadInt())
	s1 := reader.ReadStr()
	s2 := reader.ReadStr()

	n1 := len(s1)
	n2 := len(s2)
	var bigGcd big.Int
	big1 := big.NewInt(int64(n1))
	big2 := big.NewInt(int64(n2))
	bigGcd.GCD(nil, nil, big1, big2)
	nGcd := int(bigGcd.Int64())
	nLcm := n1 * n2 / nGcd

	//fmt.Println(n, s1, s2)
	//fmt.Println(nGcd, nLcm)

	nSum1 := 0
	nSum2 := 0
	for i, j, k := 0, 0, 0; k < nLcm; k++ {
		r := beat(s1[i], s2[j])
		if r > 0 {
			nSum2++;
		} else if r < 0 {
			nSum1++;
		}
		i = (i + 1) % n1
		j = (j + 1) % n2
	}

	// multiple
	m := n / nLcm
	l := n % nLcm
	nSum1 *= m
	nSum2 *= m
	for i, j, k := 0, 0, 0; k < l; k++ {
		r := beat(s1[i], s2[j])
		if r > 0 {
			nSum2++;
		} else if r < 0 {
			nSum1++;
		}
		i = (i + 1) % n1
		j = (j + 1) % n2
	}

	fmt.Println(nSum1, nSum2)
}

// reader
type SReader struct {
    file *os.File
    scanner *bufio.Scanner
}

func (this *SReader) Init() {
    this.file = os.Stdin
    this.scanner = bufio.NewScanner(this.file)
    this.scanner.Split(bufio.ScanWords)
}

func (this *SReader) ReadInt() int32 {
    this.scanner.Scan()
    n, err:= strconv.ParseInt(this.scanner.Text(), 10, 0)
    if err != nil {
        panic(err)
    }
    return int32(n)
}

func (this *SReader) ReadStr() string {
    this.scanner.Scan()
    return this.scanner.Text()
}

package main

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

var reader SReader

// a beat b return 1
// a draw b return 0
// b beat a return -1
func beat(a, b byte) int {
	if a == b {
		return 0
	} else {
		if (a == 'R' && b == 'S') || (a == 'S' && b == 'P') || (a == 'P' && b == 'R') {
			return 1
		} else {
			return -1
		}
	}
}

func main() {
    reader.Init()
	n := reader.ReadInt()
	s1 := reader.ReadStr()
	s2 := reader.ReadStr()

	n1 := int32(len(s1))
	n2 := int32(len(s2))
	nLcm,_ := Lcm(n1, n2)

	nSum1 := int32(0)
	nSum2 := int32(0)
	for i,j,k := int32(0),int32(0),int32(0); k < nLcm; k++ {
		r := beat(s1[i], s2[j])
		if r > 0 {
			nSum2++;
		} else if r < 0 {
			nSum1++;
		}
		i = (i + 1) % n1
		j = (j + 1) % n2
	}

	// multiple
	m := n / nLcm
	l := n % nLcm
	nSum1 *= m
	nSum2 *= m
	for i,j,k := int32(0),int32(0),int32(0); k < l; k++ {
		r := beat(s1[i], s2[j])
		if r > 0 {
			nSum2++;
		} else if r < 0 {
			nSum1++;
		}
		i = (i + 1) % n1
		j = (j + 1) % n2
	}

	fmt.Println(nSum1, nSum2)
}

// reader
type SReader struct {
    file *os.File
    scanner *bufio.Scanner
}

func (this *SReader) Init() {
    this.file = os.Stdin
    this.scanner = bufio.NewScanner(this.file)
    this.scanner.Split(bufio.ScanWords)
}

func (this *SReader) ReadInt() int32 {
    this.scanner.Scan()
    n, err:= strconv.ParseInt(this.scanner.Text(), 10, 0)
    if err != nil {
        panic(err)
    }
    return int32(n)
}

func (this *SReader) ReadStr() string {
    this.scanner.Scan()
    return this.scanner.Text()
}

func Gcd(a, b int32) int32 {
    var c2 big.Int
	a2 := big.NewInt(int64(a))
	b2 := big.NewInt(int64(b))
    c2.GCD(nil, nil, a2, b2)
	return int32(c2.Int64())
}

// second is gcd
func Lcm(a, b int32) (int32, int32) {
    c := Gcd(a, b)
    return a * b / c, c
}


Team Red and Team Blue competed in a competitive FPS. Their match was streamed around the world. They played a series of $$$n$$$ matches.In the end, it turned out Team Red won $$$r$$$ times and Team Blue won $$$b$$$ times. Team Blue was less skilled than Team Red, so $$$b$$$ was strictly less than $$$r$$$.You missed the stream since you overslept, but you think that the match must have been neck and neck since so many people watched it. So you imagine a string of length $$$n$$$ where the $$$i$$$-th character denotes who won the $$$i$$$-th match  — it is R if Team Red won or B if Team Blue won. You imagine the string was such that the maximum number of times a team won in a row was as small as possible. For example, in the series of matches RBBRRRB, Team Red won $$$3$$$ times in a row, which is the maximum.You must find a string satisfying the above conditions. If there are multiple answers, print any.

The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)  — the number of test cases. Each test case has a single line containing three integers $$$n$$$, $$$r$$$, and $$$b$$$ ($$$3 \leq n \leq 100$$$; $$$1 \leq b < r \leq n$$$, $$$r+b=n$$$).

For each test case, output a single line containing a string satisfying the given conditions. If there are multiple answers, print any.

RBR
RRBRBRBRBR
RBRBRBRBRBR
RRRRRBRRRR
RRRBRRRBRR
RRRBRRRBRRR

NoteThe first test case of the first example gives the optimal answer for the example in the statement. The maximum number of times a team wins in a row in RBRBRBR is $$$1$$$. We cannot minimize it any further.The answer for the second test case of the second example is RRBRBRBRBR. The maximum number of times a team wins in a row is $$$2$$$, given by RR at the beginning. We cannot minimize the answer any further.

package main

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

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

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

	var T int
	var n int
	var x int
	var y int

	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &n, &x, &y)
		ans := []byte{}
		t := x / (y + 1)
		flag := false
		if t*(y+1) != x {
			flag = true
			t++
		}
		do := y - (x - (x/(y+1))*(y+1))
		for ; y > 0; y-- {
			if flag && y == do {
				t--
			}
			for i := 0; i < t && x > 0; i++ {
				ans = append(ans, 'R')
				x--
			}
			ans = append(ans, 'B')
		}
		for ; x > 0; x-- {
			ans = append(ans, 'R')
		}

		Fprintln(out, string(ans))
	}
}

package main

import (
	"bufio"
	"bytes"
	"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 n, r, b int
		fmt.Fscan(in, &n, &r, &b)

		max := r / (b + 1)
		var x, y int
		rem := r % (b + 1)
		var buf bytes.Buffer
		for x < r {
			for i := 0; i < max; i++ {
				buf.WriteRune('R')
				x++
			}

			if rem > 0 {
				buf.WriteRune('R')
				x++
				rem--
			}

			if y < b {
				buf.WriteRune('B')
				y++
			}
		}
		fmt.Fprintln(out, buf.String())
	}
}

package main

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

/*
3
7 6 1
10 8 3
15 8 7
---
RRRBRRR
RRBRRBRRBR
==========
1
10 6 4
---
RRBRRBRRBB
=======
24
3 2 1
4 3 1
5 3 2
6 5 1
6 4 2
7 6 1
7 5 2
7 4 3
8 7 1
8 6 2
8 5 3
9 8 1
9 7 2
9 6 3
9 5 4
10 9 1
10 8 2
10 7 3
10 6 4
11 10 1
11 9 2
11 8 3
11 7 4
11 6 5
==========
1
20 12 8
*/

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

	segs := make([]int, b+1)

	for i := 0; i < r; i++ {
		j := i % (b + 1)
		segs[j]++
	}

	ans := make([]rune, 0)

	for i, cnt := range segs {
		for j := 0; j < cnt; j++ {
			ans = append(ans, 'R')
		}

		if i != len(segs)-1 {
			ans = append(ans, 'B')
		}
	}

	fmt.Fprintln(writer, string(ans))
}

//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 abs(num int) int {
	if num < 0 {
		return -num
	}
	return num
}

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

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

	for i := 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 GoUnhandledErrorResult
func factorize(num int) []int {
	factors := []int{1}

	sqrtA := int(math.Sqrt(float64(num)))

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

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

	return factors
}

package main

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

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

	for ii := 0; ii < t; ii++ {
		var n, r, b int
		fmt.Fscan(in, &n, &r, &b)
		var ans = make([]int, b+1)
		for r > 0 {
			for i := 0; i < b+1; i++ {
				ans[i]++
				r--
				if r == 0 {
					break
				}
			}
		}
		sb := strings.Builder{}
		for i := 0; i < len(ans); i++ {
			for j := 0; j < ans[i]; j++ {
				sb.WriteByte('R')
			}
			if i != len(ans)-1 {
				sb.WriteByte('B')
			}
		}
		fmt.Fprintln(out, sb.String())
	}

}

//rrbrrbrrbrrbrrbrrbrrbrrb

package main

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

func main_div2_782_A() {
	_in, _out := os.Stdin, os.Stdout
	in, out := bufio.NewReader(_in), bufio.NewWriter(_out)
	defer out.Flush()
	var cas int = 1
	Fscan(in, &cas)
	var sol func()
	sol = func() {
		var n, r, b int
		Fscan(in, &n, &r, &b)
		if r == b {
			for i := 0; i < n; i++ {
				if i&1 == 0 {
					Fprint(out, "R")
				} else {
					Fprint(out, "B")
				}
			}
		} else if r > b {
			x := r / (b + 1)
			y := r % (b + 1)

			for i := 0; i < b; i++ {
				for j := 0; j < x; j++ {
					Fprint(out, "R")
				}
				if y > 0 {
					Fprint(out, "R")
					y--
				}
				r -= x
				Fprint(out, "B")
			}
			for i := 0; i < x; i++ {
				Fprint(out, "R")
			}
			r -= x
		} else {
			x := b / (r + 1)
			y := b % (r + 1)
			for i := 0; i < r; i++ {
				for j := 0; j < x; j++ {
					Fprint(out, "B")
				}
				if y > 0 {
					Fprint(out, "B")
					y--
				}
				b -= x
				Fprint(out, "R")
			}
			for i := 0; i < b; i++ {
				Fprint(out, "B")
			}
		}
		Fprintln(out)
	}
	for i := 0; i < cas; i++ {
		sol()
	}
}

func main() {
	main_div2_782_A()
}

package main

import "fmt"

func main() {
	var t, n, r, b, c, rc int
	var ats string
    fmt.Scanf("%d\n", &t)

	for i := 0; i < t; i++ {
		fmt.Scanf("%d %d %d\n", &n, &r, &b)

		c = r / (b+1)
		rc = r % (b+1)
		r -= c * b

		ats = ""
		for z := 0; z < c; z++ {
			ats += "R"
		}
		if (rc > 0) {
			ats += "R"
			rc--
		}

		for j := 0; j < b; j++ {
			ats += "B"
			for z := 0; z < c; z++ {
				ats += "R"
			}
			if (rc > 0) {
				ats += "R"
				rc--
			}
		}

		fmt.Println(ats);
	}
}

package main

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

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

	countLineStr, _, _ := reader.ReadLine()
	countLine, _ := strconv.ParseInt(string(countLineStr), 10, 64)

	mainStr := ""

	for i := 0; i < int(countLine); i++ {
		arrStr, _, _ := reader.ReadLine()
		arrSplitedStr := strings.Split(string(arrStr), " ")

		var arr []int
		for i := 0; i < len(arrSplitedStr); i++ {
			num, _ := strconv.ParseInt(arrSplitedStr[i], 10, 64)
			arr = append(arr, int(num))
		}

		_, r, b := arr[0], arr[1], arr[2]

		var places [100]int

		var i int = 0
		for i < r {
			idx := i % (b + 1)
			places[idx] += 1
			i++
		}

		str := ""
		for i := 0; i < (b + 1); i++ {
			str += strings.Repeat("R", int(places[i]))
			if i+1 != (b + 1) {
				str += "B"
			}
		}

		if i+1 != int(countLine) {
			mainStr += str + "\n"
		} else {
			mainStr += str
		}

	}

	fmt.Println(mainStr)
}

package main

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

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

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

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

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

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

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

func main() {
	defer writer.Flush()
	for t := _int(); t > 0; t-- {
		n := _int()
		r := _int()
		b := _int()
		printf("%s\n", sol(n, r, b))
	}
}

func sol(n, r, b int) string {
	ret := ""
	if r == b {
		for i := 0; i < r; i++ {
			ret += "RB"
		}
		return ret
	}
	gt := "R"
	lt := "B"
	if b > r {
		gt, lt = lt, gt
		r, b = b, r // make r gt
	}
	d := (r-1)/(b+1) + 1
	m := (r-1)%(b+1) + 1
	for b > 0 {
		if m > 0 {
			for i := 0; i < d; i++ {
				ret += gt
				r--
			}
			m--
		} else {
			for i := 0; i < d-1; i++ {
				ret += gt
				r--
			}
		}
		ret += lt
		b--
	}
	for r > 0 {
		ret += gt
		r--
	}
	return ret
}

package main

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

const (
	INF = 3e5 + 10
	L0  = int64(0)
	L1  = int64(1)
)

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

	var t int
	Fscan(in, &t)

	for k := 0; k < t; k++ {
		var n, r, b int
		Fscan(in, &n, &r, &b)

		ans := ""
		leftR := r
		leftB := b

		for leftR > 0 || leftB > 0 {
			x := leftR / (leftB + 1)
			ans += strings.Repeat("R", x)
			leftR -= x
			if leftB > 0 {
				ans += "B"
				leftB -= 1
			}
		}
		Fprintln(out, ans)
	}

}

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

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

package main

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

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

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

	var T int
	var n int
	var x int
	var y int

	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &n, &x, &y)
		ans := []byte{}
		t := x / (y + 1)
		if t*(y+1) != x {
			t++
		}
		for ; y > 0; y-- {
			if t*(y+1) < x {
				t--
			}
			for i := 0; i < t && x > 0; i++ {
				ans = append(ans, 'R')
				x--
			}
			ans = append(ans, 'B')
		}
		for ; x > 0; x-- {
			ans = append(ans, 'R')
		}

		Fprintln(out, string(ans))
	}
}

package main

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

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

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

	var T int
	var n int
	var x int
	var y int

	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &n, &x, &y)
		ans := []byte{}
		t := x / (y + 1)
		if t*(y+1) != x {
			t++
		}
		for ; y > 0; y-- {
			if x / (y+1) < t {
				t--
			}
			for i := 0; i < t && x > 0; i++ {
				ans = append(ans, 'R')
				x--
			}
			ans = append(ans, 'B')
		}
		for ; x > 0; x-- {
			ans = append(ans, 'R')
		}

		Fprintln(out, string(ans))
	}
}

package main

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

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

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

	var T int
	var n int
	var x int
	var y int

	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &n, &x, &y)
		ans := []byte{}
		t := x / (y + 1)
		if t*(y+1) != x {
			t++
		}
		for ; y > 0; y-- {
			if x / y < t {
				t--
			}
			for i := 0; i < t && x > 0; i++ {
				ans = append(ans, 'R')
				x--
			}
			ans = append(ans, 'B')
		}
		for ; x > 0; x-- {
			ans = append(ans, 'R')
		}

		Fprintln(out, string(ans))
	}
}

package main

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

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

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

	var T int
	var n int
	var x int
	var y int

	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &n, &x, &y)
		ans := []byte{}
		t := x / (y + 1)
		if t*(y+1) != x {
			t++
		}
		for ; y > 0; y-- {
			for i := 0; i < t && x > 0; i++ {
				ans = append(ans, 'R')
				x--
			}
			ans = append(ans, 'B')
		}
		for ; x > 0; x-- {
			ans = append(ans, 'R')
		}

		Fprintln(out, string(ans))
	}
}

package main

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

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

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

	var T int
	var n int
	var x int
	var y int

	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &n, &x, &y)
		ans := []byte{}
		t := x / (y + 1)
		if t * (y+1) != x {
			t++
		}
		for ; y > 0; y-- {
			for i := 0; i < t && i < x; i++ {
				ans = append(ans, 'R')
			}
			ans = append(ans, 'B')
			x -= t
		}
		for ; x > 0; x-- {
			ans = append(ans, 'R')
		}

		Fprintln(out, string(ans))
	}
}

package main

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

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

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

	var T int
	var n int
	var x int
	var y int

	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &n, &x, &y)
		ans := []byte{}
		t := x / (y + 1)
		if x%(y+1) != 0 {
			t++
		}
		for ; y > 0; y-- {
			for i := 0; i < t && i < x; i++ {
				ans = append(ans, 'R')
			}
			ans = append(ans, 'B')
			x -= t
		}
		for ; x > 0; x-- {
			ans = append(ans, 'R')
		}

		Fprintln(out, string(ans))
	}
}

package main

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

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

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

	var T int
	var n int
	var x int
	var y int

	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &n, &x, &y)
		ans := []byte{}
		t := x / (y + 1)
		if x%(y+1) != 0 {
			t++
		}
		for ; y > 0; y-- {
			for i := 0; i < t; i++ {
				ans = append(ans, 'R')
			}
			ans = append(ans, 'B')
		}
		for x %= t ; x > 0; x-- {
			ans = append(ans, 'R')
		}

		Fprintln(out, string(ans))
	}
}

package main

import (
	"bufio"
	"bytes"
	"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, r, b int
		fmt.Fscan(in, &n, &r, &b)

		max := int(math.Ceil(float64(r) / float64(b+1)))
		gen := func(n, m int) string {
			var buf bytes.Buffer
			for n > 0 || m > 0 {
				for i := 0; i < max; i++ {
					if n > 0 {
						buf.WriteRune('R')
						n--
					}
				}

				if m > 0 {
					buf.WriteRune('B')
					m--

				}
			}
			return buf.String()
		}

		s := gen(r, b)
		var c int
		for i := len(s) - 1; i >= 0; i-- {
			if s[i] == 'B' {
				break
			}
			c++
		}

		if c > max {
			max++
			s = gen(r, b)
		}
		fmt.Fprintln(out, s)
	}
}

package main

import (
	"bufio"
	"bytes"
	"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, r, b int
		fmt.Fscan(in, &n, &r, &b)

		max := int(math.Ceil(float64(r) / float64(b+1)))
		gen := func(n, m int) string {
			var buf bytes.Buffer
			for n > 0 || m > 0 {
				for i := 0; i < max; i++ {
					if n > 0 {
						buf.WriteRune('R')
						n--
					}
				}

				if m > 0 {
					buf.WriteRune('B')
					m--

				}
			}
			return buf.String()
		}

		s := gen(r, b)
		var c int
		for i := len(s) - 1; i >= 0; i-- {
			if s[i] == 'B' {
				break
			}
			c++
		}

		if c > max {
			max--
			s = gen(r, b)
		}
		fmt.Fprintln(out, s)
	}
}

package main

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

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, r, b int
		fmt.Fscan(in, &n, &r, &b)

		max := int(math.Ceil(float64(r) / float64(b+1)))
		gen := func(n, m int) string {
			var buf bytes.Buffer
			for n > 0 || m > 0 {
				for i := 0; i < max; i++ {
					if n > 0 {
						buf.WriteRune('R')
						n--
					}
				}

				if m > 0 {
					buf.WriteRune('B')
					m--

				}
			}
			return buf.String()
		}

		s := gen(r, b)
		if strings.HasSuffix(s, "B") {
			max--
			s = gen(r, b)
		}

		fmt.Fprintln(out, s)
	}
}

package main

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

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, r, b int
		fmt.Fscan(in, &n, &r, &b)

		max := int(math.Ceil(float64(r) / float64(b+1)))
		gen := func(n, m int) string {
			var buf bytes.Buffer
			for n > 0 || m > 0 {
				for i := 0; i < max; i++ {
					if n > 0 {
						buf.WriteRune('R')
						n--
					}
				}

				if m > 0 {
					buf.WriteRune('B')
					m--

				}
			}
			return buf.String()
		}

		s := gen(r, b)
		if strings.HasSuffix(s, "BB") {
			max--
			s = gen(r, b)
		}

		fmt.Fprintln(out, s)
	}
}

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, r, b int
		fmt.Fscan(in, &n, &r, &b)

		max := int(math.Ceil(float64(r) / float64(b+1)))
		for r > 0 || b > 0 {
			for i := 0; i < max; i++ {
				if r > 0 {
					fmt.Fprint(out, "R")
					r--
				}
			}

			if b > 0 {
				fmt.Fprint(out, "B")
				b--

			}
		}
		fmt.Fprintln(out)
	}
}

package main

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

/*
3
7 6 1
10 8 3
15 8 7
---
RRRBRRR
RRBRRBRRBR
==========
1
10 6 4
---
RRBRRBRRBB
---

*/

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

	ans := make([]rune, n)

	for i := range ans {
		ans[i] = 'R'
	}

	d := n / (b + 1)

	for i := d; i < n; i += d + 1 {
		ans[i] = 'B'
		b--
	}

	if b == 1 {
		ans[0] = 'B'
	}

	if b == 2 {
		ans[1] = 'B'
	}

	fmt.Fprintln(writer, string(ans))
}

//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 abs(num int) int {
	if num < 0 {
		return -num
	}
	return num
}

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

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

	for i := 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 GoUnhandledErrorResult
func factorize(num int) []int {
	factors := []int{1}

	sqrtA := int(math.Sqrt(float64(num)))

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

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

	return factors
}

package main

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

/*
2
7 6 1
10 8 3
---
RRRBRRR
RRBRRBRRBR
==========
1
10 6 4
---
RRBRRBRRBB
---

*/

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

	ans := make([]rune, n)

	for i := range ans {
		ans[i] = 'R'
	}

	d := n / (b + 1)

	for i := d; i < n; i += d + 1 {
		ans[i] = 'B'
		b--
	}

	if b == 1 {
		ans[0] = 'B'
	}

	if b == 2 {
		ans[0] = 'B'
	}

	fmt.Fprintln(writer, string(ans))
}

//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 abs(num int) int {
	if num < 0 {
		return -num
	}
	return num
}

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

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

	for i := 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 GoUnhandledErrorResult
func factorize(num int) []int {
	factors := []int{1}

	sqrtA := int(math.Sqrt(float64(num)))

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

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

	return factors
}

package main

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

/*
2
7 6 1
10 8 3
---
RRRBRRR
RRBRRBRRBR
==========
1
10 6 4
---
RRBRRBRRBB
---

*/

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

	ans := make([]rune, n)

	for i := range ans {
		ans[i] = 'R'
	}

	d := n / (b + 1)

	for i := d; i < n; i += d + 1 {
		ans[i] = 'B'
		b--
	}

	if b > 0 {
		ans[0] = 'B'
	}

	fmt.Fprintln(writer, string(ans))
}

//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 abs(num int) int {
	if num < 0 {
		return -num
	}
	return num
}

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

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

	for i := 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 GoUnhandledErrorResult
func factorize(num int) []int {
	factors := []int{1}

	sqrtA := int(math.Sqrt(float64(num)))

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

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

	return factors
}

package main

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

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

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

		each := 1
		for r > each*(b+1) {
			each++
		}
		sb := strings.Builder{}
		for r > 0 || b > 0 {
			for i := 0; i < each && r > 0; i++ {
				sb.WriteByte('R')
				r--
			}
			if b > 0 {
				b--
				sb.WriteByte('B')
			}
		}
		fmt.Fprintln(out, sb.String())
	}

}

package main

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

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

	for ii := 0; ii < t; ii++ {
		var n, r, b int
		fmt.Fscan(in, &n, &r, &b)
		each := 1
		for each*(b+1) < r {
			each++
		}
		sb := strings.Builder{}
		for r > 0 {
			for i := 0; i < each && r > 0; i++ {
				sb.WriteByte('R')
				r--
			}
			if b > 0 {
				b--
				sb.WriteByte('B')
			}
		}
		for b > 0 {
			b--
			sb.WriteByte('B')
		}
		fmt.Fprintln(out, sb.String())
	}

}

package main

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

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

	for ii := 0; ii < t; ii++ {
		var n, r, b int
		fmt.Fscan(in, &n, &r, &b)
		each := 1
		for each*(b+1) < r {
			each++
		}
		sb := strings.Builder{}
		for r > 0 {
			for i := 0; i < each && r > 0; i++ {
				sb.WriteByte('R')
				r--
			}
			if b > 0 {
				b--
				sb.WriteByte('B')
			}

		}
		fmt.Fprintln(out, sb.String())
	}

}

package main

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

func main_div2_782_A() {
	_in, _out := os.Stdin, os.Stdout
	in, out := bufio.NewReader(_in), bufio.NewWriter(_out)
	defer out.Flush()
	var cas int = 1
	Fscan(in, &cas)
	var sol func()
	sol = func() {
		var n, r, b int
		Fscan(in, &n, &r, &b)
		if r == b {
			for i := 0; i < n; i++ {
				if i&1 == 0 {
					Fprint(out,"R")
				} else {
					Fprint(out, "B")
				}
			}
		} else if r > b {
			x := r / (b + 1)
			for i := 0; i < b; i++ {
				for j := 0; j < x; j++ {
					Fprint(out, "R")
				}
				r -= x
				Fprint(out, "B")
			}
			for i := 0; i < r; i++ {
				Fprint(out, "R")
			}
		} else {
			x := b / (r + 1)
			for i := 0; i < r; i++ {
				for j := 0; j < x; j++ {
					Fprint(out, "B")
				}
				b -= x
				Fprint(out, "R")
			}
			for i := 0; i < b; i++ {
				Fprint(out, "B")
			}
		}
		Fprintln(out)
	}
	for i := 0; i < cas; i++ {
		sol()
	}
}

func main() {
	main_div2_782_A()
}