package main

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

func readLine() string {
	s, err := in.ReadString('\n')
	if err != nil {
		panic(err)
	}
	s = strings.ReplaceAll(s, "\n", "")
	s = strings.ReplaceAll(s, "\r", "")
	return s
}

func readLines(n int) []string {
	res := make([]string, n)
	for i := 0; i < n; i++ {
		res[i] = readLine()
	}
	return res
}

func readInt() int {
	n, err := strconv.ParseInt(readLine(), 10, 32)
	if err != nil {
		panic(err)
	}
	return int(n)
}

func readInt2() (int, int) {
	as := readInts(2)
	return as[0], as[1]
}

func readInt3() (int, int, int) {
	as := readInts(3)
	return as[0], as[1], as[2]
}

func readUint() uint64 {
	n, err := strconv.ParseUint(readLine(), 10, 64)
	if err != nil {
		panic(err)
	}
	return n
}

func readInts(n int) []int {
	s := readLine()
	as := strings.SplitN(s, " ", n)
	if len(as) != n {
		panic("invalid len")
	}
	arr := make([]int, n)
	for k, a := range as {
		x, _ := strconv.ParseInt(a, 10, 64)
		arr[k] = int(x)
	}
	return arr
}

func readStrings(n int) []string {
	s := readLine()
	as := strings.SplitN(s, " ", n)
	if len(as) != n {
		panic("invalid len")
	}
	return as
}

func arr(n, m int) [][]int {
	a := make([][]int, n)
	for i := 0; i < n; i++ {
		a[i] = make([]int, m)
	}
	return a
}

var in = bufio.NewReader(os.Stdin)
var winner [2][1 << 20]int

func main() {
	var t, n, i, record, l int
	fmt.Scan(&t)
	for ; t != 0; t-- {
		fmt.Scan(&n)
		l = 1 << n
		for i = 1; i <= l; i++ {
			winner[0][i] = i
		}
		last, cur, lastLen, curLen := 0, 1, l, 0
		for lastLen > 2 {
			for i = 1; i <= lastLen; i += 4 {
				curLen++
				fmt.Printf("? %d %d\n", winner[last][i], winner[last][i+2])
				fmt.Scan(&record)
				if record == 0 {
					fmt.Printf("? %d %d\n", winner[last][i+1], winner[last][i+3])
					fmt.Scan(&record)
					if record == 1 {
						winner[cur][curLen] = winner[last][i+1]
					} else {
						winner[cur][curLen] = winner[last][i+3]
					}
				} else if record == 1 {
					fmt.Printf("? %d %d\n", winner[last][i], winner[last][i+3])
					fmt.Scan(&record)
					if record == 1 {
						winner[cur][curLen] = winner[last][i]
					} else {
						winner[cur][curLen] = winner[last][i+3]
					}
				} else {
					fmt.Printf("? %d %d\n", winner[last][i+1], winner[last][i+2])
					fmt.Scan(&record)
					if record == 1 {
						winner[cur][curLen] = winner[last][i+1]
					} else {
						winner[cur][curLen] = winner[last][i+2]
					}
				}
			}
			last, cur, lastLen, curLen = cur, last, curLen, 0
		}
		if lastLen == 2 {
			fmt.Printf("? %d %d\n", winner[last][1], winner[last][2])
			fmt.Scan(&record)
			if record == 1 {
				fmt.Printf("! %d\n", winner[last][1])
			} else {
				fmt.Printf("! %d\n", winner[last][2])
			}
		} else {
			fmt.Printf("! %d\n", winner[last][1])
		}

	}
}

package main

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

func readLine() string {
	s, err := in.ReadString('\n')
	if err != nil {
		panic(err)
	}
	s = strings.ReplaceAll(s, "\n", "")
	s = strings.ReplaceAll(s, "\r", "")
	return s
}

func readLines(n int) []string {
	res := make([]string, n)
	for i := 0; i < n; i++ {
		res[i] = readLine()
	}
	return res
}

func readInt() int {
	n, err := strconv.ParseInt(readLine(), 10, 32)
	if err != nil {
		panic(err)
	}
	return int(n)
}

func readInt2() (int, int) {
	as := readInts(2)
	return as[0], as[1]
}

func readInt3() (int, int, int) {
	as := readInts(3)
	return as[0], as[1], as[2]
}

func readUint() uint64 {
	n, err := strconv.ParseUint(readLine(), 10, 64)
	if err != nil {
		panic(err)
	}
	return n
}

func readInts(n int) []int {
	s := readLine()
	as := strings.SplitN(s, " ", n)
	if len(as) != n {
		panic("invalid len")
	}
	arr := make([]int, n)
	for k, a := range as {
		x, _ := strconv.ParseInt(a, 10, 64)
		arr[k] = int(x)
	}
	return arr
}

func readStrings(n int) []string {
	s := readLine()
	as := strings.SplitN(s, " ", n)
	if len(as) != n {
		panic("invalid len")
	}
	return as
}

func arr(n, m int) [][]int {
	a := make([][]int, n)
	for i := 0; i < n; i++ {
		a[i] = make([]int, m)
	}
	return a
}

var in = bufio.NewReader(os.Stdin)
var winner [2][1 << 20]int

func main() {
	var t, n, i, record, l int
	t = readInt()
	for ; t != 0; t-- {
		n = readInt()
		l = 1 << n
		for i = 1; i <= l; i++ {
			winner[0][i] = i
		}
		last, cur, lastLen, curLen := 0, 1, l, 0
		for lastLen > 2 {
			for i = 1; i <= lastLen; i += 4 {
				curLen++
				fmt.Printf("? %d %d\n", winner[last][i], winner[last][i+2])
				record = readInt()
				if record == 0 {
					fmt.Printf("? %d %d\n", winner[last][i+1], winner[last][i+3])
					record = readInt()
					if record == 1 {
						winner[cur][curLen] = winner[last][i+1]
					} else {
						winner[cur][curLen] = winner[last][i+3]
					}
				} else if record == 1 {
					fmt.Printf("? %d %d\n", winner[last][i], winner[last][i+3])
					record = readInt()
					if record == 1 {
						winner[cur][curLen] = winner[last][i]
					} else {
						winner[cur][curLen] = winner[last][i+3]
					}
				} else {
					fmt.Printf("? %d %d\n", winner[last][i+1], winner[last][i+2])
					record = readInt()
					if record == 1 {
						winner[cur][curLen] = winner[last][i+1]
					} else {
						winner[cur][curLen] = winner[last][i+2]
					}
				}
			}
			last, cur, lastLen, curLen = cur, last, curLen, 0
		}
		if lastLen == 2 {
			fmt.Printf("? %d %d\n", winner[last][1], winner[last][2])
			record = readInt()
			if record == 1 {
				fmt.Printf("! %d\n", winner[last][1])
			} else {
				fmt.Printf("! %d\n", winner[last][2])
			}
		} else {
			fmt.Printf("! %d\n", winner[last][1])
		}

	}
}

package main

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

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

	ask := func(a, b int) int {
		fmt.Printf("? %d %d\n", a, b)
		return readNum(reader)
	}

	tc := readNum(reader)

	for tc > 0 {
		tc--

		n := readNum(reader)

		res := solve(n, ask)

		fmt.Printf("! %d\n", res)
	}

}

func readString(reader *bufio.Reader) string {
	s, _ := reader.ReadString('\n')
	for i := 0; i < len(s); i++ {
		if s[i] == '\n' || s[i] == '\r' {
			return s[:i]
		}
	}
	return s
}

func normalize(s string) string {

	for i := len(s); i > 0; i-- {
		if s[i-1] >= 'a' && s[i-1] <= 'z' {
			return s[:i]
		}
	}
	return ""
}

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

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

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

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

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

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

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

	return i
}

func solve(n int, ask func(int, int) int) int {
	arr := make([]int, 1<<n)

	for i := 0; i < len(arr); i++ {
		arr[i] = i + 1
	}

	m := len(arr)

	for m >= 4 {
		var j int
		for i := 0; i < m; i += 4 {
			a, b, c, d := arr[i], arr[i+1], arr[i+2], arr[i+3]
			x := ask(a, c)
			if x == 1 {
				// a win, b & c won't win
				x = ask(a, d)
				if x == 1 {
					arr[j] = a
				} else {
					// x == 2
					arr[j] = d
				}
			} else if x == 2 {
				// c win, then a & d won't win
				x = ask(b, c)
				if x == 1 {
					arr[j] = b
				} else {
					arr[j] = c
				}
			} else {
				// x == 0,
				x = ask(b, d)
				if x == 1 {
					arr[j] = b
				} else {
					arr[j] = d
				}
			}

			j++
		}
		m = j
	}
	if m == 2 {
		x := ask(arr[0], arr[1])
		if x == 2 {
			arr[0] = arr[1]
		}
	}
	return arr[0]
}

package main

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

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

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

func rw(r io.Reader, w io.Writer) {
	var t int
	fmt.Fscan(r, &t)
	for ti := 0; ti < t; ti++ {
		var n int
		fmt.Fscan(r, &n)
		ask := do(n)
		for {
			w1, w2, w3 := ask()
			fmt.Fprint(w, w2)
			for _, v := range w3 {
				fmt.Fprint(w, " ", v)
			}
			fmt.Fprintln(w)
			if w, ok := w.(flush); ok {
				w.Flush()
			}
			ans, ok := w1.(fans)
			if !ok {
				break
			}
			var k int
			fmt.Fscan(r, &k)
			w1 = ans(k)
			ask, ok = w1.(fask)
			if !ok {
				break
			}
		}
	}
}

type fask = func() (interface{}, string, []int)
type fans = func(k int) interface{}
type flush interface{ Flush() error }

func do(n int) fask {
	var ask, ask2, ask4 fask
	var ans fans
	a := make([]int, 1<<n)
	for i := range a {
		a[i] = i + 1
	}
	b := []int{}
	ask = func() (interface{}, string, []int) {
		if len(a) >= 4 {
			b, a = a[:4], a[4:]
			return ask4()
		} else if len(a) >= 2 {
			b, a = a[:2], a[2:]
			return ask2()
		}
		return nil, "!", a
	}
	ans = func(k int) interface{} {
		a = append(a, b[k-1])
		return ask
	}
	ask2 = func() (interface{}, string, []int) {
		return ans, "?", b[:2]
	}
	ask4 = func() (interface{}, string, []int) {
		b[1], b[2] = b[2], b[1]
		return func(k int) interface{} {
			switch k {
			case 0:
				b = b[2:]
			case 1: // b[0]>b[1]
				b[1] = b[3]
			case 2: // b[0]<b[1]
				b[0] = b[2]
			}
			return ask2
		}, "?", b[:2]
	}
	return ask
}

package main

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

func init() {}

func req(i, j int) int {
	fmt.Fprintf(out, "? %d %d\n", i, j)
	flush()
	return get()
}

func ans(i int) {
	fmt.Fprintf(out, "! %d\n", i)
	flush()
}

func solve() {
	n := get()
	n = 1 << n
	a := ints(n, 0)
	for i := 0; i < n; i++ {
		a[i] = i + 1
	}
	d := 1
	for n > 1 {
		if n == 2 {
			x := req(a[0], a[d])
			if x == 2 {
				a[0] = a[d]
			}
			break
		}
		for i := 0; i < n; i += 4 {
			x := req(a[d*i], a[d*(i+2)])
			if x == 0 {
				x = req(a[d*(i+1)], a[d*(i+3)])
				if x == 1 {
					a[i*d] = a[d*(i+1)]
				} else {
					a[i*d] = a[d*(i+3)]
				}
				continue
			}
			if x == 1 {
				x = req(a[d*i], a[d*(i+3)])
				if x == 2 {
					a[d*i] = a[d*(i+3)]
				}
				continue
			}
			x = req(a[d*(i+1)], a[d*(i+2)])
			if x == 1 {
				a[d*i] = a[d*(i+1)]
			} else {
				a[d*i] = a[d*(i+2)]
			}
		}
		d *= 4
		n /= 4
	}
	ans(a[0])
}

const (
	once       = false
	useBuf     = false
	maxBufSize = 10_000_000
	YES        = "YES"
	NO         = "NO"
)

var (
	splitFunc = bufio.ScanWords
)

func main() {
	in = bufio.NewScanner(bufio.NewReader(os.Stdin))
	in.Split(splitFunc)
	if useBuf {
		in.Buffer(make([]byte, maxBufSize), maxBufSize)
	}

	out = bufio.NewWriter(os.Stdout)
	defer flush()

	if once {
		solve()
		return
	}

	for t := get(); t > 0; t-- {
		solve()
	}
}

var (
	in  *bufio.Scanner
	out *bufio.Writer
)

func get() int {
	x, _ := strconv.Atoi(gets())
	return x
}

func geta(n int) []int {
	a := make([]int, n)
	for i := range a {
		a[i] = get()
	}
	return a
}

func geta1(n int) []int {
	a := make([]int, n)
	for i := range a {
		a[i] = get() - 1
	}
	return a
}

func get64() int64 {
	x, _ := strconv.ParseInt(gets(), 10, 64)
	return x
}

func get64a(n int) []int64 {
	a := make([]int64, n)
	for i := range a {
		a[i] = get64()
	}
	return a
}

func get64a1(n int) []int64 {
	a := make([]int64, n)
	for i := range a {
		a[i] = get64() - 1
	}
	return a
}

func getf() float64 {
	x, _ := strconv.ParseFloat(gets(), 64)
	return x
}

func getfa(n int) []float64 {
	a := make([]float64, n)
	for i := range a {
		a[i] = getf()
	}
	return a
}

func gets() string {
	scan()
	return in.Text()
}

func scanN(n int) {
	for n > 0 {
		scan()
		n--
	}
}

func scan() {
	in.Scan()
}

func putc(c rune) {
	out.WriteRune(c)
}

func line() {
	putc('\n')
}

func space() {
	putc(' ')
}

func put(x int) {
	out.WriteString(strconv.Itoa(x))
}

func putln(i int) {
	put(i)
	line()
}

func puta(a []int) {
	for _, v := range a {
		put(v)
		space()
	}
	line()
}

func put64(x int64) {
	out.WriteString(strconv.FormatInt(x, 10))
}

func put64ln(x int64) {
	put64(x)
	line()
}

func put64a(a []int64) {
	for _, v := range a {
		put64(v)
		space()
	}
	line()
}

func flush() {
	out.Flush()
}

func puts(s string) {
	out.WriteString(s)
}

func putsln(s string) {
	puts(s)
	line()
}

func yn(y bool) {
	if y {
		yes()
		return
	}
	no()
}

func yes() {
	puts(YES)
	line()
}

func no() {
	puts(NO)
	line()
}

func putf(x float64) {
	out.WriteString(strconv.FormatFloat(x, 'f', -1, 64))
}

func putfln(x float64) {
	putf(x)
	line()
}

func putfa(a []float64) {
	for _, v := range a {
		putf(v)
		space()
	}
	line()
}

type IntTp interface {
	int | int64
}

type Tp interface {
	IntTp | float64
}

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

func fabs(x float64) float64 {
	return math.Abs(x)
}

func max1[T Tp](x T, y T) T {
	if x > y {
		return x
	}
	return y
}

func max[T Tp](xs ...T) T {
	r := xs[0]
	for _, x := range xs[1:] {
		r = max1(r, x)
	}
	return r
}

func maxa[T Tp](a []T) (i int, val T) {
	i, val = 0, a[0]
	for j := 1; j < len(a); j++ {
		if a[j] <= val {
			continue
		}
		i = j
		val = a[j]
	}
	return
}

func min1[T Tp](x T, y T) T {
	if x < y {
		return x
	}
	return y
}

func min[T Tp](xs ...T) T {
	r := xs[0]
	for _, x := range xs[1:] {
		r = min1(r, x)
	}
	return r
}

func mina[T Tp](a []T) (i int, val T) {
	i, val = 0, a[0]
	for j := 1; j < len(a); j++ {
		if a[j] >= val {
			continue
		}
		i = j
		val = a[j]
	}
	return
}

func L(i int) int64 {
	return int64(i)
}

func F(i int) float64 {
	return float64(i)
}

func ints(n int, val int) (a []int) {
	a = make([]int, n)
	if val == 0 {
		return
	}
	for i := range a {
		a[i] = val
	}
	return
}

func int64s(n int, val int64) (a []int64) {
	a = make([]int64, n)
	if val == 0 {
		return
	}
	for i := range a {
		a[i] = val
	}
	return
}

func floats(n int, val float64) (a []float64) {
	a = make([]float64, n)
	if val == 0 {
		return
	}
	for i := range a {
		a[i] = val
	}
	return
}

const heapBase = 4

func children(i int) (int, int) {
	start := heapBase * i
	return start + 1, start + (1 + heapBase)
}

func parent(i int) int {
	return (i - 1) / heapBase
}

package main

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

func readLine() string {
	s, err := in.ReadString('\n')
	if err != nil {
		panic(err)
	}
	s = strings.ReplaceAll(s, "\n", "")
	s = strings.ReplaceAll(s, "\r", "")
	return s
}

func readLines(n int) []string {
	res := make([]string, n)
	for i := 0; i < n; i++ {
		res[i] = readLine()
	}
	return res
}

func readInt() int {
	n, err := strconv.ParseInt(readLine(), 10, 32)
	if err != nil {
		panic(err)
	}
	return int(n)
}

func readInt2() (int, int) {
	as := readInts(2)
	return as[0], as[1]
}

func readInt3() (int, int, int) {
	as := readInts(3)
	return as[0], as[1], as[2]
}

func readUint() uint64 {
	n, err := strconv.ParseUint(readLine(), 10, 64)
	if err != nil {
		panic(err)
	}
	return n
}

func readInts(n int) []int {
	s := readLine()
	as := strings.SplitN(s, " ", n)
	if len(as) != n {
		panic("invalid len")
	}
	arr := make([]int, n)
	for k, a := range as {
		x, _ := strconv.ParseInt(a, 10, 64)
		arr[k] = int(x)
	}
	return arr
}

func readStrings(n int) []string {
	s := readLine()
	as := strings.SplitN(s, " ", n)
	if len(as) != n {
		panic("invalid len")
	}
	return as
}

func arr(n, m int) [][]int {
	a := make([][]int, n)
	for i := 0; i < n; i++ {
		a[i] = make([]int, m)
	}
	return a
}

var in = bufio.NewReader(os.Stdin)

func main() {
	t := readInt()
	for i := 0; i < t; i++ {
		n := readInt()
		cur := 1 << n
		a := make([]int, cur)
		for j := range a {
			a[j] = j + 1
		}
		for cur >= 4 {
			for j := 0; j < cur; j += 4 {
				fmt.Printf("? %d %d\n", a[j], a[j+3])
				ans := readLine()
				if ans == "1" {
					fmt.Printf("? %d %d\n", a[j], a[j+2])
					ans = readLine()
					if ans == "1" {
						a[j/4] = a[j]
					} else {
						a[j/4] = a[j+2]
					}
				} else if ans == "0" {
					fmt.Printf("? %d %d\n", a[j+1], a[j+2])
					ans = readLine()
					if ans == "1" {
						a[j/4] = a[j+1]
					} else {
						a[j/4] = a[j+2]
					}
				} else {
					fmt.Printf("? %d %d\n", a[j+1], a[j+3])
					ans = readLine()
					if ans == "1" {
						a[j/4] = a[j+1]
					} else {
						a[j/4] = a[j+3]
					}
				}
			}
			cur /= 4
		}
		if cur == 1 {
			fmt.Printf("! %d\n", a[0])
		} else {
			fmt.Printf("? %d %d\n", a[0], a[1])
			ans := readLine()
			if ans == "1" {
				fmt.Printf("! %d\n", a[0])
			} else {
				fmt.Printf("! %d\n", a[1])
			}
		}
	}
}

package main

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

func readLine() string {
	s, err := in.ReadString('\n')
	if err != nil {
		panic(err)
	}
	s = strings.ReplaceAll(s, "\n", "")
	s = strings.ReplaceAll(s, "\r", "")
	return s
}

func readLines(n int) []string {
	res := make([]string, n)
	for i := 0; i < n; i++ {
		res[i] = readLine()
	}
	return res
}

func readInt() int {
	n, err := strconv.ParseInt(readLine(), 10, 32)
	if err != nil {
		panic(err)
	}
	return int(n)
}

func readInt2() (int, int) {
	as := readInts(2)
	return as[0], as[1]
}

func readInt3() (int, int, int) {
	as := readInts(3)
	return as[0], as[1], as[2]
}

func readUint() uint64 {
	n, err := strconv.ParseUint(readLine(), 10, 64)
	if err != nil {
		panic(err)
	}
	return n
}

func readInts(n int) []int {
	s := readLine()
	as := strings.SplitN(s, " ", n)
	if len(as) != n {
		panic("invalid len")
	}
	arr := make([]int, n)
	for k, a := range as {
		x, _ := strconv.ParseInt(a, 10, 64)
		arr[k] = int(x)
	}
	return arr
}

func readStrings(n int) []string {
	s := readLine()
	as := strings.SplitN(s, " ", n)
	if len(as) != n {
		panic("invalid len")
	}
	return as
}

func arr(n, m int) [][]int {
	a := make([][]int, n)
	for i := 0; i < n; i++ {
		a[i] = make([]int, m)
	}
	return a
}

var in = bufio.NewReader(os.Stdin)
var winner [2][1 << 20]int

func main() {
	var t, n, i, record, l int
	t = readInt()
	for ; t != 0; t-- {
		n = readInt()
		l = 1 << n
		for i = 1; i <= l; i++ {
			winner[0][i] = i
		}
		last, cur, lastLen, curLen := 0, 1, l, 0
		for lastLen > 1 {
			for i = 1; i <= lastLen; i += 4 {
				curLen++
				fmt.Printf("? %d %d\n", winner[last][i], winner[last][i+2])
				record = readInt()
				if record == 0 {
					fmt.Printf("? %d %d\n", winner[last][i+1], winner[last][i+3])
					record = readInt()
					if record == 1 {
						winner[cur][curLen] = winner[last][i+1]
					} else {
						winner[cur][curLen] = winner[last][i+3]
					}
				} else if record == 1 {
					fmt.Printf("? %d %d\n", winner[last][i], winner[last][i+3])
					record = readInt()
					if record == 1 {
						winner[cur][curLen] = winner[last][i]
					} else {
						winner[cur][curLen] = winner[last][i+3]
					}
				} else {
					fmt.Printf("? %d %d\n", winner[last][i+1], winner[last][i+2])
					record = readInt()
					if record == 1 {
						winner[cur][curLen] = winner[last][i+1]
					} else {
						winner[cur][curLen] = winner[last][i+2]
					}
				}
			}
			last, cur, lastLen, curLen = cur, last, curLen, 0
		}
		fmt.Printf("! %d\n", winner[last][1])
	}
}

package main

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

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

	ask := func(a, b int) int {
		fmt.Printf("? %d %d\n", a, b)
		return readNum(reader)
	}

	tc := readNum(reader)

	for tc > 0 {
		tc--

		n := readNum(reader)

		res := solve(n, ask)

		fmt.Printf("! %d\b", res)
	}

}

func readString(reader *bufio.Reader) string {
	s, _ := reader.ReadString('\n')
	for i := 0; i < len(s); i++ {
		if s[i] == '\n' || s[i] == '\r' {
			return s[:i]
		}
	}
	return s
}

func normalize(s string) string {

	for i := len(s); i > 0; i-- {
		if s[i-1] >= 'a' && s[i-1] <= 'z' {
			return s[:i]
		}
	}
	return ""
}

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

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

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

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

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

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

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

	return i
}

func solve(n int, ask func(int, int) int) int {
	arr := make([]int, 1<<n)

	for i := 0; i < len(arr); i++ {
		arr[i] = i + 1
	}

	m := len(arr)

	for m >= 4 {
		var j int
		for i := 0; i < m; i += 4 {
			a, b, c, d := arr[i], arr[i+1], arr[i+2], arr[i+3]
			x := ask(a, c)
			if x == 1 {
				// a win, b & c won't win
				x = ask(a, d)
				if x == 1 {
					arr[j] = a
				} else {
					// x == 2
					arr[j] = d
				}
			} else if x == 2 {
				// c win, then a & d won't win
				x = ask(b, c)
				if x == 1 {
					arr[j] = b
				} else {
					arr[j] = c
				}
			} else {
				// x == 0,
				x = ask(b, d)
				if x == 1 {
					arr[j] = b
				} else {
					arr[j] = d
				}
			}

			j++
		}
		m = j
	}
	if m == 2 {
		x := ask(arr[0], arr[1])
		if x == 2 {
			arr[0] = arr[1]
		}
	}
	return arr[0]
}

package main

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

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

	ask := func(a, b int) int {
		fmt.Printf("? %d %d\n", a, b)
		return readNum(reader)
	}

	tc := readNum(reader)

	for tc > 0 {
		tc--

		n := readNum(reader)

		res := solve(n, ask)

		fmt.Printf("! %d\b", res)
	}

}

func readString(reader *bufio.Reader) string {
	s, _ := reader.ReadString('\n')
	for i := 0; i < len(s); i++ {
		if s[i] == '\n' || s[i] == '\r' {
			return s[:i]
		}
	}
	return s
}

func normalize(s string) string {

	for i := len(s); i > 0; i-- {
		if s[i-1] >= 'a' && s[i-1] <= 'z' {
			return s[:i]
		}
	}
	return ""
}

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

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

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

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

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

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

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

	return i
}

func solve(n int, ask func(int, int) int) int {
	arr := make([]int, 1<<n)

	for i := 0; i < len(arr); i++ {
		arr[i] = i + 1
	}

	for n > 1 {
		var j int
		for i := 0; i < (1 << n); i += 4 {
			a, b, c, d := arr[i], arr[i+1], arr[i+2], arr[i+3]
			x := ask(a, c)
			if x == 1 {
				// a win, b & c won't win
				x = ask(a, d)
				if x == 1 {
					arr[j] = a
				} else {
					// x == 2
					arr[j] = d
				}
			} else if x == 2 {
				// c win, then a & d won't win
				x = ask(b, c)
				if x == 1 {
					arr[j] = b
				} else {
					arr[j] = c
				}
			} else {
				// x == 0,
				x = ask(b, d)
				if x == 1 {
					arr[j] = b
				} else {
					arr[j] = d
				}
			}

			j++
		}
		n -= 2
	}
	if n == 1 {
		x := ask(arr[0], arr[1])
		if x == 2 {
			arr[0] = arr[1]
		}
	}
	return arr[0]
}


package main

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

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

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

func init() {
	const maxCapacity = 300050
	buf := make([]byte, maxCapacity)
	scanner.Buffer(buf, maxCapacity)
    scanner.Split(bufio.ScanWords)
}

func main() {
	defer writer.Flush()

	n := ReadInt()

	scanner.Scan()
	bla := scanner.Text()
	str := []byte(bla)

	var um, zero, dois int

	for _, elem := range str {
		if elem == '0' {
			zero++
		} else if elem == '1' {
			um++
		} else {
			dois++
		}
	}

	qt := n/3

	if zero < qt {
	    for i := 0; i < n; i++ {
	        if str[i] == '2' && dois > qt {
	            str[i] = '0'
	            dois--
	            zero++
	        }
	        if zero == qt {
	            break
	        }
	    }
	}

	if zero < qt {
	    for i := 0; i < n; i++ {
	        if str[i] == '1' && um > qt {
	            str[i] = '0'
	            um--
	            zero++
	        }
	        if zero == qt {
	            break
	        }
	    }
	}

	if um < qt {
        for i := 0; i < n; i++ {
            if str[i] == '2' && dois > qt {
                str[i] = '1'
                dois--
                um++
            }

            if um == qt {
                break
            }
        }
    }

    cont0 := 0

    if um < qt {
        for i := 0; i < n; i++ {
            if str[i] == '0' && cont0 >= qt {
                str[i] = '1'
                zero--
                um++
            }

            if str[i] == '0' {
            	cont0++
            }

            if um == qt {
                break
            }
        }
    }

    if dois < qt {
        for i := n-1; i >= 0; i-- {
            if str[i] == '1' && um > qt {
                str[i] = '2'
                um--
                dois++
            } else if str[i] == '0' && zero > qt {
                str[i] = '2'
                zero--
                dois++
            }

            if dois == qt {
                break
            }
        }
    }

    writer.WriteString(string(str))

}

package main

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

func main() {
	buf := bufio.NewReader(os.Stdin)
	var n int
	var str []byte
	fmt.Fscanf(buf, "%d\n", &n)
	fmt.Fscanf(buf, "%s\n", &str)
	cnt := make([]int,3)
	for i:= 0;i < n;i++{
		cnt[str[i]-byte('0')]++
	}
	cnt[0] -= n/3
	cnt[1] -= n/3
	cnt[2] -= n/3
	for i:= 0;i < n;i++{
		tmp := str[i]-byte('0')
		if cnt[tmp] > 0{
			for j := 0;j < int(tmp);j++{
				if cnt[j] < 0{
					str[i] = byte('0')+byte(j)
					cnt[j]++
					cnt[tmp]--
					break
				}
			}
		}
	}
//	fmt.Printf("%s\n", str)
	for i:= n-1;i >= 0;i--{
		tmp := str[i]-byte('0')
		if cnt[tmp] > 0{
			for j := 2;j > int(tmp);j--{
				if cnt[j] < 0{
					str[i] = byte('0')+byte(j)
					cnt[j]++
					cnt[tmp]--
					break
				}
			}
		}
	}
	fmt.Printf("%s\n", str)
}

package main

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

func main() {
	start := time.Now()
	defer func() {
		run := time.Since(start)
		_ = run
		// fmt.Println("Run in", run)
	}()

	var stdin *bufio.Reader
	// LOCAL
	f, _ := os.Open("input.txt")
	stdin = bufio.NewReader(f)

	// ONLINE JUDGE
	stdin = bufio.NewReader(os.Stdin)

	var n int
	var s []byte
	var cnt = []int{0, 0, 0}
	fmt.Fscanln(stdin, &n)
	fmt.Fscanln(stdin, &s)

	var l = len(s)
	for i := 0; i < l; i++ {
		cnt[s[i]-'0']++
	}

	for i := l - 1; i >= 0 && cnt[0] > n/3; i-- {
		if s[i] == '0' {
			cnt[0]--
			if cnt[2] < n/3 {
				s[i] = 50
				cnt[2]++
			} else {
				s[i] = 49
				cnt[1]++
			}
		}
	}
	for i := 0; i < l && cnt[1] > n/3 && cnt[0] < n/3; i++ {
		if s[i] == '1' {
			cnt[1]--
			s[i] = 48
			cnt[0]++
		}
	}
	for i := l - 1; i >= 0 && cnt[1] > n/3 && cnt[2] < n/3; i-- {
		if s[i] == '1' {
			cnt[1]--
			s[i] = 50
			cnt[2]++
		}
	}
	for i := 0; i < l && cnt[2] > n/3; i++ {
		if s[i] == '2' {
			cnt[2]--
			if cnt[0] < n/3 {
				cnt[0]++
				s[i] = 48
			} else {
				cnt[1]++
				s[i] = 49
			}
		}
	}

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

package main

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

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

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

func main() {
	defer writer.Flush()

	const maxCapacity = 300050
	buf := make([]byte, maxCapacity)
	scanner.Buffer(buf, maxCapacity)

    scanner.Split(bufio.ScanWords)

	n := ReadInt()

	scanner.Scan()
	bla := scanner.Text()
	str := []byte(bla)

	var um, zero, dois int

	for _, elem := range str {
		if elem == '0' {
			zero++
		} else if elem == '1' {
			um++
		} else {
			dois++
		}
	}

	qt := n/3

	if zero < qt {
	    for i := 0; i < n; i++ {
	        if str[i] == '2' && dois > qt {
	            str[i] = '0'
	            dois--
	            zero++
	        }
	        if zero == qt {
	            break
	        }
	    }
	}

	if zero < qt {
	    for i := 0; i < n; i++ {
	        if str[i] == '1' && um > qt {
	            str[i] = '0'
	            um--
	            zero++
	        }
	        if zero == qt {
	            break
	        }
	    }
	}

	if um < qt {
        for i := 0; i < n; i++ {
            if str[i] == '2' && dois > qt {
                str[i] = '1'
                dois--
                um++
            }

            if um == qt {
                break
            }
        }
    }

    cont0 := 0

    if um < qt {
        for i := 0; i < n; i++ {
            if str[i] == '0' && cont0 >= qt {
                str[i] = '1'
                zero--
                um++
            }

            if str[i] == '0' {
            	cont0++
            }

            if um == qt {
                break
            }
        }
    }

    if dois < qt {
        for i := n-1; i >= 0; i-- {
            if str[i] == '1' && um > qt {
                str[i] = '2'
                um--
                dois++
            } else if str[i] == '0' && zero > qt {
                str[i] = '2'
                zero--
                dois++
            }

            if dois == qt {
                break
            }
        }
    }

    writer.WriteString(string(str))

}

package main

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

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

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

func main() {
	defer writer.Flush()

	const maxCapacity = 300050
	buf := make([]byte, maxCapacity)
	scanner.Buffer(buf, maxCapacity)

    scanner.Split(bufio.ScanWords)

	n := ReadInt()

	scanner.Scan()
	bla := scanner.Text()
	str := []byte(bla)

	if n == 300000 {
		fmt.Println(len(bla))
	}

	var um, zero, dois int

	for _, elem := range str {
		if elem == '0' {
			zero++
		} else if elem == '1' {
			um++
		} else {
			dois++
		}
	}

	qt := n/3

	if zero < qt {
	    for i := 0; i < n; i++ {
	        if str[i] == '2' && dois > qt {
	            str[i] = '0'
	            dois--
	            zero++
	        }
	        if zero == qt {
	            break
	        }
	    }
	}

	if n == 300000 {
		fmt.Println("oi")
	}

	if zero < qt {
	    for i := 0; i < n; i++ {
	        if str[i] == '1' && um > qt {
	            str[i] = '0'
	            um--
	            zero++
	        }
	        if zero == qt {
	            break
	        }
	    }
	}

	if n == 300000 {
		fmt.Println("oi")
	}

	if um < qt {
        for i := 0; i < n; i++ {
            if str[i] == '2' && dois > qt {
                str[i] = '1'
                dois--
                um++
            }

            if um == qt {
                break
            }
        }
    }

    if n == 300000 {
		fmt.Println("oi")
	}

    cont0 := 0

    if um < qt {
        for i := 0; i < n; i++ {
            if str[i] == '0' && cont0 >= qt {
                str[i] = '1'
                zero--
                um++
            }

            if str[i] == '0' {
            	cont0++
            }

            if um == qt {
                break
            }
        }
    }

    if n == 300000 {
		fmt.Println("oi")
	}

    if dois < qt {
        for i := n-1; i >= 0; i-- {
            if str[i] == '1' && um > qt {
                str[i] = '2'
                um--
                dois++
            } else if str[i] == '0' && zero > qt {
                str[i] = '2'
                zero--
                dois++
            }

            if dois == qt {
                break
            }
        }
    }

    if n == 300000 {
		fmt.Println("oi")
	}

    writer.WriteString(string(str))

}

package main

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

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

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

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

    n := ReadInt()

    qt := n/int(3)

    scanner.Scan()
    str := scanner.Text()

    resp := make([]string, n)
    for i, elem := range str {
    	resp[i] = string(elem)
    }

    var zero, um, dois int

    for i := 0; i < n; i++ {
    	if resp[i] == "0" {
    		zero++
    	} else if resp[i] == "1" {
    		um++
    	} else{
    		dois++
    	}
    }

    if zero < qt {
    	for i := 0; i < n; i++ {
    		if resp[i] == "2" && dois > qt {
				resp[i] = "0"
				dois--
				zero++
    		} else if resp[i] == "1" && um > qt {
    			resp[i] = "0"
    			um--
    			zero++
    		}

    		if zero == qt {
    			break
    		}
    	}
    }

    cont0 := 0

    if um < qt {
    	for i := 0; i < n; i++ {
    		if resp[i] == "2" && dois > qt {
				resp[i] = "1"
				dois--
				um++
    		} else if resp[i] == "0" && cont0 >= qt {
    			resp[i] = "1"
    			zero--
    			um++
    		}

    		if resp[i] == "0" {
    			cont0++
    		}

    		if um == qt {
    			break
    		}
    	}
    }

    if dois < qt {
    	for i := n-1; i >= 0; i-- {
    		if resp[i] == "1" && um > qt {
    			resp[i] = "2"
    			um--
    			dois++
    		} else if resp[i] == "0" && zero > qt {
    			resp[i] = "2"
    			zero--
    			dois++
    		}

    		if dois == qt {
    			break
    		}
    	}
    }

    ans := ""

    for _, elem := range resp {
    	ans += elem
    }

    writer.WriteString(ans)
}


package main

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

var st []int64

func init() {
	for i := 9; i >= 0; i-- {
		st = append(st, int64(math.Pow(10, float64(i))))
	}
}

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

	val, _ := strconv.Atoi(scanner.Text())

	for i := 0; i < val; i++ {
		scanner.Scan()
		m, _ := strconv.ParseInt(scanner.Text(), 10, 64)

		for _, k := range st {
			if d := m - k; d >= 0 && d < m {
				fmt.Println(d)
				break
			}
		}
	}
}

package main

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

func solve(in io.Reader, out io.Writer) {
	var n int
	fmt.Fscan(in, &n)
	base := int(math.Log10(float64(n)))
	ans := n - int(math.Pow10(base))
	fmt.Fprintln(out, ans)
}

func main() {
	in := bufio.NewReader(os.Stdin)
	var t int
	fmt.Fscan(in, &t)
	for t > 0 {
		solve(in, os.Stdout)
		t--
	}
}

package main

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

func solve(out io.Writer) {
	in := bufio.NewReader(os.Stdin)
	var t int
	fmt.Fscan(in, &t)
	for i := 0; i < t; i++ {
		var n int
		fmt.Fscan(in, &n)
		base := int(math.Log10(float64(n)))
		ans := n - int(math.Pow10(base))
		fmt.Fprintln(out, ans)
	}
}

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

package main

import (
	"fmt"
	"math"
)

func solve() {
	var n int
	fmt.Scanf("%d\n", &n)
	base := int(math.Log10(float64(n)))
	fmt.Printf("%d\n", n-int(math.Pow10(base)))
}

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

package main

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

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

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

	var T int
	var x int

	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &x)
		for i := 1; i <= int(1E9); i *= 10 {
			if x >= i && x < i*10 {
				Fprintln(out, x-i)
			}
		}
	}
}

package main

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

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

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

  var p int64 = 1
  for ; n > 0 ;{
    n /= 10
    p *= 10
  }
  // printf("%d %s\n",p,reflect.TypeOf(p))
  return p / 10
}
func solve() {
	var n int64
	scan(&n)
  printf("%d\n",n-power(n))
}
func main() {
	defer out.Flush()
	n := 0
	scan(&n)
	for i := 0; i < n; i++ {
		solve()
	}
}

package main

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

func run(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	// 读入一行数据
	// s, _ := in.ReadString('\n')
	out := bufio.NewWriter(_w)
	defer out.Flush()
	solve := func(t int) {
		var n int
		fmt.Fscan(in, &n)
		var res [] int
		for i := 0; i <= 9; i++{
			if res == nil{
				res = append(res, 1)
			}else{
				res = append(res, res[len(res)-1]*10)
			}
		}
		for j := 9; j >= 0; j--{
			if n >= res[j] {
				fmt.Fprintln(out, n - res[j])
				return
			}
		}
	}

	var t int
	fmt.Fscan(in, &t)
	for i := 0; i < t; i++{
		solve(t)
	}
}
func main() {
	run(os.Stdin, os.Stdout)
}

package main

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

var (
	_r = bufio.NewReader(os.Stdin)
	_w = bufio.NewWriter(os.Stdout)
)

type Tint interface {
	int | int32 | int64
}

func min[T Tint](x, y T) T {
	if x <= y {
		return x
	}
	return y
}
func max[T Tint](x, y T) T {
	if x >= y {
		return x
	}
	return y
}
func main() {
	defer _w.Flush()
	fac10 := make([]int64, 12)
	fac10[0] = 1
	for i := 1; i < 11; i++ {
		fac10[i] = fac10[i-1] * 10
	}
	var _t int
	// n = 1
	fmt.Fscan(_r, &_t)
	for ; _t > 0; _t-- {
		var m int
		fmt.Fscan(_r, &m)
		l, r := 0, 11
		ans := 0
		for l <= r {
			mid := (l + r) >> 1
			if fac10[mid] <= int64(m) {
				ans = mid
				l = mid + 1
			} else {
				r = mid - 1
			}
		}
		fmt.Fprintln(_w, int64(m)-fac10[ans])
	}
}

package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	t, _ := strconv.Atoi(scanner.Text())
	for i := 0; i < t; i++ {
		scanner.Scan()
		s := scanner.Text()
		m, _ := strconv.Atoi(s)
		d := m - int(math.Pow10(len(s)-1))
		fmt.Println(d)
	}
}

package main
import(
    "fmt"
    "math"
)
func main() {
	var t int
	fmt.Scan(&t)
	for i:=0;i<t;i++{
		var x int
		fmt.Scan(&x)
		for j:=0;j<10;j++{
			if x < x_power_y(10,j+1) {
				fmt.Println(x-x_power_y(10,j))
				break
			}
		}
	}
}
func x_power_y(x,y int) int {
	//dependencies math
	return int(math.Pow(float64(x),float64(y)))
}

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 scanws(a ...interface{})           { fmt.Fscan(reader, a...) }

func main() {

	defer writer.Flush()
	var tc int
	var n int
	var ans int
	val := []int{1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000}
	lel := len(val)
	scanws(&tc)
	for t := 1; t <= tc; t++ {
		scanws(&n)
		for i := lel - 1; i >= 0; i-- {
			if n >= val[i] {
				ans = n - val[i]
				break
			}
		}
		printf("%d\n", ans)
	}

}

package main

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

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

	pow10 := []int{1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000}

	numCases := 0
	fmt.Fscan(in, &numCases)

	for ; numCases > 0; numCases-- {
		num := 0
		fmt.Fscan(in, &num)
		for i := len(pow10) - 1; i >= 0; i-- {
			if num >= pow10[i] {
				res := num - pow10[i]
				fmt.Fprintf(out, "%d\n", res)
				break
			}
		}
	}
}

package main

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

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

	var T int
	var M string
	for fmt.Fscan(in, &T); T > 0; T-- {
		fmt.Fscan(in, &M)
		l := len(M) - 1
		num, _ := strconv.Atoi(M)
		fmt.Fprintln(out, num-int(math.Pow10(l)))
	}
}

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

package main
import ("fmt"
        "strconv"
        )

func solve (num string) int {

    ans := 1

    for i:=1; i < len (num); i++{

        ans *= 10

    }

    to_int, _ := strconv.Atoi (num)

    return to_int - ans
}

func main() {

    var testCases int
    fmt.Scanln (&testCases)

    ans := make ([]int, testCases)

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

        var num string
        fmt.Scanln (&num)

        if len (num) == 1 {

            ans[i] =  int ([]rune (num)[0] ) - 49
        } else {

            ans[i] = solve (num)
        }
    }

    for _, v := range ans {

        fmt.Println (v)
    }

}

package main

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

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

	var buf bytes.Buffer

	tc := readNum(reader)

	for tc > 0 {
		tc--
		m := readNum(reader)
		res := solve(m)
		buf.WriteString(fmt.Sprintf("%d\n", res))
	}

	fmt.Print(buf.String())
}

func readString(reader *bufio.Reader) string {
	s, _ := reader.ReadString('\n')
	for i := 0; i < len(s); i++ {
		if s[i] == '\n' {
			return s[:i]
		}
	}
	return s
}

func normalize(s string) string {

	for i := len(s); i > 0; i-- {
		if s[i-1] >= 'a' && s[i-1] <= 'z' {
			return s[:i]
		}
	}
	return ""
}

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

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

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

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

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

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

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

	return i
}

func solve(m int) int {
	M := int64(m)
	var cur int64 = 1
	for cur*10 <= M {
		cur *= 10
	}

	return int(M - cur)
}

package main

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

func main() {
	var t int
	fmt.Scan(&t)
	for t > 0 {
		var b string
		fmt.Scan(&b)
		lens := len(b)
		ans, _ := strconv.Atoi(b)
		ans = ans - int(math.Pow10(lens-1))
		fmt.Println(ans)
		t--
	}
}

package main

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

var (
	reader = bufio.NewReader(os.Stdin)
	t, m   int
)

func solve(m int) int {
	var k = 1
	for 10*k <= m {
		k *= 10
	}
	return m - k
}

func main() {
	fmt.Fscan(reader, &t)
	for ; t > 0; t-- {
		fmt.Fscan(reader, &m)
		fmt.Println(solve(m))
	}
}

package main

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

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

func main() {
	defer writer.Flush()

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

	for ; T > 0; T-- {
		var m int
		fmt.Fscan(reader, &m)
		k := 0
		var mul int64 = 1
		for ; mul < int64(m); mul *= int64(10) {
			k += 1
		}
		if mul > int64(m) {
			mul /= int64(10)
		}
		fmt.Fprintf(writer, "%v\n", int64(m)-mul)
	}
}

package main

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

func power(base, exponential int) int {
	if exponential == 0 {
		return 1
	}

	ans := base
	for i := 1; i < exponential; i++ {
		ans *= base
	}
	return ans
}

func main(){
	rounds := make([]int, 10)
	for i := 0; i <= 9; i++ {
		rounds[i] = power(10, i)
	}
	// fmt.Println(rounds)

	cin := bufio.NewReader(os.Stdin)
	var t int
	fmt.Fscan(cin, &t)
	for i := 0; i < t; i++ {
		var m int
		fmt.Fscan(cin, &m)
		for j := 9; j >= 0; j-- {
			if m >= rounds[j] {
				fmt.Println(m - rounds[j])
				break
			}
		}
	}
}

package main

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

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

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

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

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

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

/**
Run solve the problem CF1702A
Date: 12/07/22
User: pepradere
URL: https://codeforces.com/problemset/problem/1702/A
Problem: CF1702A
**/
func (in *CF1702A) Run() {
	for t := in.NextInt(); t > 0; t-- {
		m := in.NextString()
		v, _ := strconv.ParseInt(m, 10, 64)
		b := int64(math.Pow(float64(10), float64(len(m)-1)))
		fmt.Println(v-b)
	}
}

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

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

package main

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

var rr = bufio.NewReader(os.Stdin)
var ww = bufio.NewWriter(os.Stdout)

func slove() {
	var n int64
	fmt.Fscan(rr, &n)
	var cur int64
	cur = 1
	for i:=0;i<=9;i++ {
		if cur > n {
			break
		}
		cur *= 10
	}
	cur /= 10
	fmt.Fprintln(ww, n-cur)

}

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

package main

import (
	"fmt"
	"math"
)

func main() {
	var t int
	fmt.Scan(&t)
	var i int = 0
	for i = 0; i < t; i++ {
		var n int
		fmt.Scan(&n)
		var d int = n
		var s int = 0
		for d > 9 {
			s++
			d = d / 10
		}
		n = n - int(math.Pow10(s))

		fmt.Println(n)
	}
}

package main

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

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

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

func rw(r io.Reader, w io.Writer) {
	var t int
	fmt.Fscan(r, &t)
	for ti := 0; ti < t; ti++ {
		var m int
		fmt.Fscan(r, &m)
		w1 := do(m)
		fmt.Fprintln(w, w1)
	}
}

func do(m int) int {
	a := 1
	b := m
	for b >= 10 {
		a *= 10
		b /= 10
	}
	return m - a
}

package main

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

func solve(sc *bufio.Scanner, wr *bufio.Writer) {
  sc.Scan()
  n, _ := strconv.ParseInt(sc.Text(), 10, 64)
  x := int64(1)
  for x <= n {
    x *= 10
  }
  x /= 10
  wr.WriteString(strconv.FormatInt(n - x, 10))
  wr.WriteRune('\n')
}

const (
  once = false
  maxBufSize = 10000000
)

func main() {
  sc := bufio.NewScanner(bufio.NewReader(os.Stdin))
  sc.Split(bufio.ScanWords)
  sc.Buffer(make([]byte, maxBufSize), maxBufSize)

  wr := bufio.NewWriter(os.Stdout)
  defer wr.Flush()

  if once {
    solve(sc, wr)
  } else {
    sc.Scan()
    times, _ := strconv.Atoi(sc.Text())
    for times > 0 {
      solve(sc, wr)
      times--
    }
  }
}

// 1702A. Round Down the Price
package main

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

func main() {
	var T int
	reader := bufio.NewReader(os.Stdin)
	fmt.Fscan(reader, &T)
	for t := 1; t <= T; t++ {
		var m int
		fmt.Fscan(reader, &m)
		curr := 1
		for m/curr >= 10 {
			curr = curr * 10
		}
		fmt.Println(m - curr)
	}
}

package main

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

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

	var T int
	fmt.Fscan(in, &T)
	for t := 0; t < T; t++ {
		var n int
		fmt.Fscan(in, &n)
		d := len(fmt.Sprintf("%d", n))
		fmt.Fprintln(out, n-int(math.Pow10(d-1)))
	}
}

package main

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

func solve(m int) int {
	t := 1

	for {
		if 10*t > m {
			return m - t
		}
		t *= 10
	}

}

func main() {
	inp := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)

	var test int
	fmt.Fscanln(inp, &test)

	for test > 0 {
		test--

		var m int
		fmt.Fscanln(inp, &m)

		res := solve(m)

		fmt.Fprintln(out, res)
	}

	out.Flush()
}

package main

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

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

	var n int
	fmt.Fscan(in, &n)
	base := int(math.Log10(float64(n)))
	ans := n - int(math.Pow10(base))
	fmt.Fprintln(out, ans)
}

func main() {
	var t int
	fmt.Fscan(bufio.NewReader(os.Stdin), &t)
	for t > 0 {
		solve()
		t--
	}
}

package main

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

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

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

	fmt.Fprintln(out, n)
}

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

	var n int
	fmt.Fscan(in, &n)
	base := int(math.Log10(float64(n)))
	ans := n - int(math.Pow10(base))
	fmt.Fprintln(out, ans)
}

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

package main

import (
	"fmt"
	"math"
)

func solve() {
	var n int
	fmt.Scanf("%d", &n)
	base := int(math.Log10(float64(n)))
	fmt.Printf("%d\n", n-int(math.Pow10(base)))
}

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

package main

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

var st []int64

func init() {
	for i := 9; i >= 0; i-- {
		st = append(st, int64(math.Pow(10, float64(i))))
	}
}

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

	val, _ := strconv.Atoi(scanner.Text())

	for i := 0; i < val; i++ {
		scanner.Scan()
		m, _ := strconv.ParseInt(scanner.Text(), 10, 64)

		for _, k := range st {
			if d := m - k; d > 0 && d < m {
				fmt.Println(d)
				break
			}
		}
	}
}

package main

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

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

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

  p := 1
  for ; n > 0 ;{
    n /= 10
    p *= 10
  }
  return p / 10
}
func solve() {
	var n int
	scan(&n)
  printf("%d\n",n-power(n))
}
func main() {
	defer out.Flush()
	n := 0
	scan(&n)
	for i := 0; i < n; i++ {
		solve()
	}
}

package main

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

func run(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	// 读入一行数据
	// s, _ := in.ReadString('\n')
	out := bufio.NewWriter(_w)
	defer out.Flush()
	solve := func(t int) {
		var n int64
		fmt.Fscan(in, &n)
		var temp int64 = 1
		for i := 0; i <= 9; i++{
			if temp > n{
				fmt.Fprintln(out, n - temp/10)
				return
			}
			temp *= 10
		}
	}

	var t int
	fmt.Fscan(in, &t)
	for i := 0; i < t; i++{
		solve(t)
	}
}
func main() {
	run(os.Stdin, os.Stdout)
}

package main

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

var (
	_r = bufio.NewReader(os.Stdin)
	_w = bufio.NewWriter(os.Stdout)
)

type Tint interface {
	int | int32 | int64
}

func min[T Tint](x, y T) T {
	if x <= y {
		return x
	}
	return y
}
func max[T Tint](x, y T) T {
	if x >= y {
		return x
	}
	return y
}
func main() {
	defer _w.Flush()
	fac10 := make([]int, 32)
	fac10[0] = 1
	for i := 1; i < 32; i++ {
		fac10[i] = fac10[i-1] * 10
	}
	var _t int
	// n = 1
	fmt.Fscan(_r, &_t)
	for ; _t > 0; _t-- {
		var m int
		fmt.Fscan(_r, &m)
		l, r := 0, 31
		ans := 0
		for l <= r {
			mid := (l + r) >> 1
			if fac10[mid] <= m {
				ans = mid
				l = mid + 1
			} else {
				r = mid - 1
			}
		}
		fmt.Fprintln(_w, m-fac10[ans])
	}
}


package main

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

// github.com/EndlessCheng/codeforces-go
func CF630F(_r io.Reader, _w io.Writer) {
	c := func(n, k int) int64 {
		res := int64(1)
		for i := 1; i <= k; i++ {
			res = res * int64(n-k+i) / int64(i)
		}
		return res
	}
	var n int
	Fscan(_r, &n)
	Fprintln(_w, c(n, 5)+c(n, 6)+c(n, 7))
}

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


package main

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

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

// func max(a, b int64) int64 {
// 	if a < b {
// 		return b
// 	} else {
// 		return a
// 	}
// }

// func min3(a, b, c int) int {
// 	return min(min(a, b), c)
// }

// func maxSquare(a int) int {
// 	tmp := int(math.Sqrt(float64(a)))
// 	if tmp*tmp == a {
// 		return tmp * tmp
// 	} else {
// 		return (tmp + 1) * (tmp + 1)
// 	}
// }

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var niter int
	fmt.Fscan(in, &niter)
	for iiter := 0; iiter < niter; iiter++ {
		var n, k, b, s int64
		fmt.Fscan(in, &n, &k, &b, &s)
		nstart := n
		first := true
		if (s >= (b * k)) && (s <= (k-1)*n+b*k) {
			for i := 0; i < int(nstart); i++ {
				elem := int64(0)
				if first {
					elem += b * k
					first = false
				}
				s -= elem
				s2 := s - (k - 1)
				if (s2 >= 0) && (s2 <= (k-1)*(n-1)) {
					s = s2
					n--
					elem += k - 1
				} else {
					elem += s
					s = 0
				}
				fmt.Fprintf(out, "%d ", elem)
			}
			fmt.Fprintln(out)
		} else {
			fmt.Fprintln(out, "-1")
		}
	}
}

package main

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

func main() {
	var t int
	fmt.Scanln(&t)
	var reader = bufio.NewReader(os.Stdin)
	var writer = bufio.NewWriter(os.Stdout)
	for i := 0; i < t; i++ {
		var x = getIntln(reader)
		var n, k, b, s = x[0], x[1], x[2], x[3]
		s -= k * b
		if s < 0 {
			writer.WriteString("-1\n")
		} else {
			var res = make([]int, n)
			res[0] = k * b
			for j := 0; j < n; j++ {
				var now = min(s, k-1)
				res[j] += now
				s -= now
			}
			if s > 0 {
				writer.WriteString("-1\n")
			} else {
				var resString = fmt.Sprint(res)
				writer.WriteString(resString[1:len(resString)-1] + "\n")
			}
		}
	}
	writer.Flush()
}

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

func getIntln(in *bufio.Reader) []int {
	var x = strings.Split(getString(in), " ")
	var res = make([]int, len(x))
	for k, v := range x {
		res[k], _ = strconv.Atoi(v)
	}
	return res
}

func getString(in *bufio.Reader) string {
	var s, _ = in.ReadString('\n')
	s = strings.TrimSpace(s)
	return s
}

package main

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

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

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

func Solve(reader *bufio.Reader) {
	scanner := bufio.NewScanner(reader)
	scanner.Split(bufio.ScanWords)
	wr := bufio.NewWriter(os.Stdout)
	defer wr.Flush()

	scanner.Scan()
	t, _ := strconv.Atoi(scanner.Text())
	for i_ := 0; i_ < t; i_++ {
		scanner.Scan()
    n, _ := strconv.Atoi(scanner.Text())
		scanner.Scan()
    k, _ := strconv.Atoi(scanner.Text())
		scanner.Scan()
    b, _ := strconv.Atoi(scanner.Text())
		scanner.Scan()
    s, _ := strconv.Atoi(scanner.Text())

		if s-n*(k-1) <= k*b && k*b <= s {
      sum := k * b
      toPrint := sum
      for i := 0; i < n; i++ {
        next := min(s - sum, k - 1)
        sum += next
        wr.WriteString(strconv.Itoa(toPrint + next)+ " ")
        toPrint = 0
      }
			wr.WriteString("\n")
		} else {
			wr.WriteString(strconv.Itoa(-1) + "\n")
		}
	}
}

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

package main

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

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

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

func Solve(reader *bufio.Reader) {
	scanner := bufio.NewScanner(reader)
	scanner.Split(bufio.ScanWords)
	wr := bufio.NewWriter(os.Stdout)
	defer wr.Flush()

	scanner.Scan()
	t, _ := strconv.Atoi(scanner.Text())
	for i_ := 0; i_ < t; i_++ {
		scanner.Scan()
		n, _ := strconv.ParseInt(scanner.Text(), 10, 64)
		scanner.Scan()
		k, _ := strconv.ParseInt(scanner.Text(), 10, 64)
		scanner.Scan()
		b, _ := strconv.ParseInt(scanner.Text(), 10, 64)
		scanner.Scan()
		s, _ := strconv.ParseInt(scanner.Text(), 10, 64)
		if s-n*(k-1) <= k*b && k*b <= s {
			if k == 1 {
				wr.WriteString(strconv.FormatInt(b, 10) + " ")
				var i int64
				for i = 0; i < n-1; i++ {
					wr.WriteString(strconv.Itoa(0) + " ")
				}
			} else {
				sm := (s - k*b) / (k - 1)
				sr := (s - k*b) % (k - 1)
				var i int64
				if sm == n {
					wr.WriteString(strconv.FormatInt(k*b+k-1, 10) + " ")
					for i = 0; i < n-1; i++ {
						wr.WriteString(strconv.FormatInt(k-1, 10) + " ")
					}
				} else {
					wr.WriteString(strconv.FormatInt(k*b+sr, 10) + " ")
					for i = 0; i < sm; i++ {
						wr.WriteString(strconv.FormatInt(k-1, 10) + " ")
					}
					for i = 0; i < n-sm-1; i++ {
						wr.WriteString("0 ")
					}
				}
			}
			wr.WriteString("\n")
		} else {
			wr.WriteString(strconv.Itoa(-1) + "\n")
		}
	}
}

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

package main

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

const MOD int64 = 1000000007

var n, k, b, s int64

// ByAge implements sort.Interface based on the Age field.
type ByV []*pair

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

var w *bufio.Writer

func main() {

	read := bufio.NewReader(os.Stdin)

	w = bufio.NewWriter(os.Stdout)

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

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

		fmt.Fscan(read, &n, &k, &b, &s)

		solve()

		fmt.Fprintln(w)

		w.Flush()
	}
}

type pair struct {
	v int
	idx []int
}

func solve() {

	var max int64 = s/k

	vv := (k - 1) * n

	var min int64

	if vv >= s {
		min = 0
	}

	if vv > s {
		min = 0
	} else {

		diffS := s - vv

		r := diffS % k

		if r != 0 {
			diffS += k - r
		}
		min = diffS/k
	}

	if b < min || b > max {
		fmt.Fprint(w, -1)
		return
	}

	rest := s - b * k

	arr := make([]int64, n)

	arr[0] = b * k

	for i := 1; i < int(n); i++ {
		arr[i] = 0
	}

	for i := 0; i < int(n); i++ {
		if rest >= k - 1 {
			arr[i] += (k - 1)
			rest -= (k - 1)
		} else {
			arr[i] += rest
			rest = 0
		}
	}

	for i := 0; i < int(n); i++ {
		fmt.Fprint(w, arr[i], " ")
	}
}

//IQ = 87

//........105....99...87..87..87..87.87.......87....

//            86

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

package main

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

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

	return b
}

func main() {
	// f, _ := os.Open("input.txt")
	var reader = bufio.NewReader(os.Stdin)
	// var reader = bufio.NewReader(f)
	var tests int
	fmt.Fscan(reader, &tests)
	for t := 0; t < tests; t++ {
		var n, k, b int
		var s int64
		fmt.Fscan(reader, &n)
		fmt.Fscan(reader, &k)
		fmt.Fscan(reader, &b)
		fmt.Fscan(reader, &s)
		var result = make([]int64, n)
		var first int64 = int64(k) * int64(b + 1) - 1
		if b == 0 {
			first = int64(k - 1)
		}
		if first > s {
			if s < int64(k) * int64(b) {
				fmt.Println(-1)
				continue
			}
			first = s
		}
		result[0] = first
		s -= first
		for i := 1; i < n; i++ {
			var next int64 = int64(k) - 1
			if s < next {
				next = s
			}

			result[i] = next
			s -= next
		}

		if s > 0 {
			fmt.Println(-1)
			continue
		}

		for i := 0; i < n; i++ {
			fmt.Print(result[i], " ")
		}

		fmt.Println()
	}
}

package main

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

var (
	reader bufio.Reader
	writer bufio.Writer
)

func main() {
	inp, err := os.Open("in.txt")
	if err == nil {
		os.Stdin = inp
		outp, _ := os.Create("out.txt")
		os.Stdout = outp
		defer outp.Close()
		defer inp.Close()
	}
	reader = *bufio.NewReader(os.Stdin)
	writer = *bufio.NewWriter(os.Stdout)
	defer writer.Flush()

	var T int
	scan(&T)

	for ; T > 0; T-- {
		var n int
		var k, b, s int64
		scan(&n, &k, &b, &s)

		if s < b * k {
			printf("-1\n")
			continue
		}

		arr := make([]int64, n)
		arr[0] = int64(b) * int64(k)
		s -= int64(b) * int64(k)
		for i := 1; i < n; i++ {
			if s >= k - 1 {
				arr[i] = int64(k - 1)
			} else {
				arr[i] = int64(s)
				s = 0
				break
			}
			s -= k - 1
		}

		if s > k - 1 {
			printf("-1\n")
			/*for i := 0; i < n; i++ {
				printf("%v ", arr[i])
			}
			printf("\n")*/
		} else {
			arr[0] += int64(s)
			for i := 0; i < n; i++ {
				printf("%v ", arr[i])
			}
			printf("\n")
		}
	}
}

func scan(a ...interface{}) (n int, err error) {
	return fmt.Fscan(&reader, a...)
}

func printf(format string, a ...interface{}) (n int, err error) {
	return fmt.Fprintf(&writer, format, a...)
}

package main

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

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

func qwq() {
	var n, k, b, s int64
	fmt.Fscan(in, &n, &k, &b, &s)
	a := make([]int64, n)
	a[0] = s
	cnt := s / k
	if cnt < b {
		fmt.Fprintln(out, -1)
	} else {
		idx := 1
		for int64(idx) < n && a[0]/k > b {
			a[idx] = k - 1
			a[0] -= a[idx]
			idx++
		}
		if int64(idx) == n && a[0]/k > b {
			fmt.Fprintln(out, -1)
		} else {
			sort.Slice(a, func(i, j int) bool { return a[i] < a[j] })
			for _, x := range a {
				fmt.Fprint(out, x, " ")
			}
			fmt.Fprintln(out)
		}
	}
}

func main() {
	defer out.Flush()
	q := 1
	fmt.Fscanln(in, &q)
	for ; q > 0; q-- {
		qwq()
	}
}

package main

import (
	"fmt"
)

func can_do(n, k, b, s int64) bool {
	rem := s - b*k
	return rem >= 0 && rem <= n*(k-1)
}

func main() {
	var t int
	fmt.Scanf("%d\n", &t)

	for ; t > 0; t-- {
		var n, k, b, s int64
		fmt.Scanf("%d %d %d %d\n", &n, &k, &b, &s)

		if can_do(n, k, b, s) {
			arr := make([]int64, n)
			arr[0] = b * k

			rem := s - arr[0]
			for i := range arr {
				if rem > k-1 {
					arr[i] += k - 1
					rem -= k - 1
				} else {
					arr[i] += rem
					break
				}
			}

			for i := range arr {
				fmt.Printf("%d ", arr[i])
			}
			fmt.Println()
		} else {
			fmt.Println("-1")
		}
	}
}

package main

import (
	"fmt"
)

func main() {
	var TC int
	fmt.Scanf("%d\n", &TC)
	for tc := 0; tc < TC; tc += 1 {
		var k, b, s uint64
		var n int
		fmt.Scanf("%d %d %d %d\n", &n, &k, &b, &s)

		curr_s := s
		out := make([]uint64, n)
		for i := 0; i < n; i += 1 {
			out[i] = 0
		}

		can := true
		for i := 0; i < n; i += 1 {
			if curr_s/k > b {
				if k-1 <= curr_s {
					out[i] = k - 1
					curr_s -= k - 1
				} else {
					can = false
					break
				}
			} else if curr_s/k < b {
				can = false
				break
			} else {
				out[i] = curr_s
				curr_s = 0
				break
			}
		}

		if curr_s > 0 {
			can = false
		}

		if !can {
			fmt.Printf("-1\n")
		} else {
			fmt.Printf("%v", out[0])
			for i := 1; i < n; i += 1 {
				fmt.Printf(" %v", out[i])
			}
			fmt.Printf("\n")
		}
	}
}

package main

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

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

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

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

		if k*b > s {
			fmt.Fprintln(out, -1)
			continue
		}

		aa := make([]int64, n)
		aa[0] = k * b
		s -= k * b
		for i := 0; i < n; i++ {
			if s == 0 {
				break
			}
			aa[i] += min(k-1, s)
			s -= min(k-1, s)
		}
		if s > 0 {
			fmt.Fprintln(out, -1)
		} else {
			for _, v := range aa {
				fmt.Fprintf(out, "%d ", v)
			}
			fmt.Fprintln(out)
		}
	}
}

// 00
package main

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

func write(f *bufio.Writer, a ...interface{}) {
	f.Write([]byte(fmt.Sprint(a...)))
}

type Number interface {
	int64 | float64 | int
}

func min[K Number](a K, b K) K {
	if a < b {
		return a
	}
	return b
}
func max[K Number](a K, b K) K {
	if a > b {
		return a
	}
	return b
}
func main() {
	var T int
	reader := bufio.NewReader(os.Stdin)
	f := bufio.NewWriter(os.Stdout)
	defer f.Flush()
	fmt.Fscan(reader, &T)
	for t := 1; t <= T; t++ {
		var n, k, b, s int64
		fmt.Fscan(reader, &n, &k, &b, &s)

		if s < b*k || s > b*k+(k-1)*n {
			write(f, "-1\n")
		} else {
			rem := s - b*k
			start := b * k
			if rem > (n-1)*(k-1) {
				start += rem - (n-1)*(k-1)
				rem = (n - 1) * (k - 1)
			}
			write(f, start)

			for i := 1; i < int(n); i++ {
				if rem >= k-1 {
					write(f, " ", k-1)
					rem -= k - 1
				} else if rem > 0 {
					write(f, " ", rem)
					rem = 0
				} else {
					write(f, " ", 0)
				}

			}
			write(f, "\n")
		}

	}
}

// 00
package main

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

func write(f *bufio.Writer, a ...interface{}) {
	f.Write([]byte(fmt.Sprint(a...)))
}

type Number interface {
	int64 | float64 | int
}

func min[K Number](a K, b K) K {
	if a < b {
		return a
	}
	return b
}
func max[K Number](a K, b K) K {
	if a > b {
		return a
	}
	return b
}
func main() {
	var T int
	reader := bufio.NewReader(os.Stdin)
	f := bufio.NewWriter(os.Stdout)
	defer f.Flush()
	fmt.Fscan(reader, &T)
	for t := 1; t <= T; t++ {
		var n, k, b, s int64
		fmt.Fscan(reader, &n, &k, &b, &s)
		min_sum := b * k
		if t == 182 {
			fmt.Println("start", n, k, b, s)
		}
		if s < min_sum && min_sum > 0 {
			write(f, "-1\n")
		} else {
			rem := s - min_sum
			if rem > (k-1)*(n-1) && min_sum > 0 || rem > (k-1)*n {
				write(f, "-1\n")
			} else {
				start := 0
				if min_sum > 0 {
					write(f, min_sum)
					start = 1
				}
				for i := start; i < int(n); i++ {
					if rem >= k-1 {
						write(f, " ", k-1)
						rem -= k - 1
					} else if rem > 0 {
						write(f, " ", rem)
						rem = 0
					} else {
						write(f, " ", 0)
					}

				}
				write(f, "\n")
			}
		}

	}
}

// 00
package main

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

func write(f *bufio.Writer, a ...interface{}) {
	f.Write([]byte(fmt.Sprint(a...)))
}

type Number interface {
	int64 | float64 | int
}

func min[K Number](a K, b K) K {
	if a < b {
		return a
	}
	return b
}
func max[K Number](a K, b K) K {
	if a > b {
		return a
	}
	return b
}
func main() {
	var T int
	reader := bufio.NewReader(os.Stdin)
	f := bufio.NewWriter(os.Stdout)
	defer f.Flush()
	fmt.Fscan(reader, &T)
	for t := 1; t <= T; t++ {
		var n, k, b, s int64
		fmt.Fscan(reader, &n, &k, &b, &s)
		min_sum := b * k

		if s < min_sum && min_sum > 0 {
			write(f, "-1\n")
		} else {
			rem := s - min_sum
			if rem > (k-1)*(n-1) && min_sum > 0 || rem > (k-1)*n {
				write(f, "-1\n")
			} else {
				start := 0
				if min_sum > 0 {
					write(f, min_sum)
					start = 1
				}
				for i := start; i < int(n); i++ {
					if rem >= k-1 {
						write(f, " ", k-1)
						rem -= k - 1
					} else if rem > 0 {
						write(f, " ", rem)
						rem = 0
					} else {
						write(f, " ", 0)
					}

				}
				write(f, "\n")
			}
		}

	}
}

// 00
package main

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

func write(f *bufio.Writer, a ...interface{}) {
	f.Write([]byte(fmt.Sprint(a...)))
}

type Number interface {
	int64 | float64 | int
}

func min[K Number](a K, b K) K {
	if a < b {
		return a
	}
	return b
}
func max[K Number](a K, b K) K {
	if a > b {
		return a
	}
	return b
}
func main() {
	var T int
	reader := bufio.NewReader(os.Stdin)
	f := bufio.NewWriter(os.Stdout)
	defer f.Flush()
	fmt.Fscan(reader, &T)
	for t := 1; t <= T; t++ {
		var n, k, b, s int64
		fmt.Fscan(reader, &n, &k, &b, &s)
		min_sum := b * k
		if b == 0 {
			for i := 0; i < int(n); i++ {
				write(f, 0)
				if i == int(n-1) {
					write(f, "\n")
				} else {
					write(f, " ")
				}
			}

		} else if s < min_sum {
			write(f, "-1\n")
		} else {
			rem := s - min_sum
			if rem > (k-1)*(n-1) {
				write(f, "-1\n")
			} else {
				write(f, min_sum)
				for i := 1; i < int(n); i++ {
					if rem >= k-1 {
						write(f, " ", k-1)
						rem -= k - 1
					} else if rem > 0 {
						write(f, " ", rem)
						rem = 0
					} else {
						write(f, " ", 0)
					}

				}
				write(f, "\n")
			}
		}

	}
}

// 00
package main

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

func write(f *bufio.Writer, a ...interface{}) {
	f.Write([]byte(fmt.Sprint(a...)))
}

type Number interface {
	int64 | float64 | int
}

func min[K Number](a K, b K) K {
	if a < b {
		return a
	}
	return b
}
func max[K Number](a K, b K) K {
	if a > b {
		return a
	}
	return b
}
func main() {
	var T int
	reader := bufio.NewReader(os.Stdin)
	f := bufio.NewWriter(os.Stdout)
	defer f.Flush()
	fmt.Fscan(reader, &T)
	for t := 1; t <= T; t++ {
		var n, k, b, s int64
		fmt.Fscan(reader, &n, &k, &b, &s)
		min_sum := b * k
		if t == 136 {
			fmt.Println("start", n, k, b, s)
		}
		if s < min_sum {
			write(f, "-1\n")
		} else {
			rem := s - min_sum
			if rem > (k-1)*(n-1) {
				write(f, "-1\n")
			} else {
				write(f, min_sum)
				for i := 1; i < int(n); i++ {
					if rem >= k-1 {
						write(f, " ", k-1)
						rem -= k - 1
					} else if rem > 0 {
						write(f, " ", rem)
						rem = 0
					} else {
						write(f, " ", 0)
					}

				}
				write(f, "\n")
			}
		}

	}
}

// 00
package main

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

func write(f *bufio.Writer, a ...interface{}) {
	f.Write([]byte(fmt.Sprint(a...)))
}

type Number interface {
	int64 | float64 | int
}

func min[K Number](a K, b K) K {
	if a < b {
		return a
	}
	return b
}
func max[K Number](a K, b K) K {
	if a > b {
		return a
	}
	return b
}
func main() {
	var T int
	reader := bufio.NewReader(os.Stdin)
	f := bufio.NewWriter(os.Stdout)
	defer f.Flush()
	fmt.Fscan(reader, &T)
	for t := 1; t <= T; t++ {
		var n, k, b, s int64
		fmt.Fscan(reader, &n, &k, &b, &s)
		min_sum := b * k
		if s < min_sum {
			write(f, "-1\n")
		} else {
			rem := s - min_sum
			if rem > (k-1)*(n-1) {
				write(f, "-1\n")
			} else {
				write(f, min_sum)
				for i := 1; i < int(n); i++ {
					if rem >= k-1 {
						write(f, " ", k-1)
						rem -= k - 1
					} else if rem > 0 {
						write(f, " ", rem)
						rem = 0
					} else {
						write(f, " ", 0)
					}

				}
				write(f, "\n")
			}
		}

	}
}

package main

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

func main() {
	var t int
	fmt.Scanln(&t)
	var reader = bufio.NewReader(os.Stdin)
	var writer = bufio.NewWriter(os.Stdout)
	for i := 0; i < t; i++ {
		var x = getIntln(reader)
		var n, k, b, s = x[0], x[1], x[2], x[3]
		if s < 0 {
			writer.WriteString("-1\n")
		} else {
			var res = make([]int, n)
			res[0] = k * b
			s -= k * b
			for j := 0; j < n; j++ {
				res[j] += min(s, k-1)
				s -= res[j]
			}
			if s > 0 {
				writer.WriteString("-1\n")
			} else {
				var resString = fmt.Sprint(res)
				writer.WriteString(resString[1:len(resString)-1] + "\n")
			}
		}
	}
	writer.Flush()
}

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

func getIntln(in *bufio.Reader) []int {
	var x = strings.Split(getString(in), " ")
	var res = make([]int, len(x))
	for k, v := range x {
		res[k], _ = strconv.Atoi(v)
	}
	return res
}

func getString(in *bufio.Reader) string {
	var s, _ = in.ReadString('\n')
	s = strings.TrimSpace(s)
	return s
}

package main

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

func main() {
	var t int
	fmt.Scanln(&t)
	var reader = bufio.NewReader(os.Stdin)
	var writer = bufio.NewWriter(os.Stdout)
	for i := 0; i < t; i++ {
		var x = getIntln(reader)
		var n, k, b, s = x[0], x[1], x[2], x[3]
		if s < k*b || s > k*b+(k-1)*n {
			writer.WriteString("-1\n")
		} else {
			var res = make([]int, n)
			res[0] = k * b
			s -= k * b
			for j := 1; j < n; j++ {
				res[j] = min(s, k-1)
				s -= res[j]
			}
			if s > 0 {
				writer.WriteString("-1\n")
			} else {
				var resString = fmt.Sprint(res)
				writer.WriteString(resString[1:len(resString)-1] + "\n")
			}
		}
	}
	writer.Flush()
}

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

func getIntln(in *bufio.Reader) []int {
	var x = strings.Split(getString(in), " ")
	var res = make([]int, len(x))
	for k, v := range x {
		res[k], _ = strconv.Atoi(v)
	}
	return res
}

func getString(in *bufio.Reader) string {
	var s, _ = in.ReadString('\n')
	s = strings.TrimSpace(s)
	return s
}

package main

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

func main() {
	var t int
	fmt.Scanln(&t)
	var reader = bufio.NewReader(os.Stdin)
	var writer = bufio.NewWriter(os.Stdout)
	for i := 0; i < t; i++ {
		var x = getIntln(reader)
		var n, k, b, s = x[0], x[1], x[2], x[3]
		if s < k*b || s > k*b+(k-1)*n {
			writer.WriteString("-1\n")
		} else {
			var res = make([]int, n)
			res[0] = k * b
			var sum = k * b
			for j := 1; j < n; j++ {
				res[j] = min(s-sum, k-1)
				sum += res[j]
			}
			var resString = fmt.Sprint(res)
			writer.WriteString(resString[1:len(resString)-1] + "\n")
		}
	}
	writer.Flush()
}

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

func getIntln(in *bufio.Reader) []int {
	var x = strings.Split(getString(in), " ")
	var res = make([]int, len(x))
	for k, v := range x {
		res[k], _ = strconv.Atoi(v)
	}
	return res
}

func getString(in *bufio.Reader) string {
	var s, _ = in.ReadString('\n')
	s = strings.TrimSpace(s)
	return s
}

package main

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

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

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

func Solve(reader *bufio.Reader) {
	scanner := bufio.NewScanner(reader)
	scanner.Split(bufio.ScanWords)
	wr := bufio.NewWriter(os.Stdout)
	defer wr.Flush()

	scanner.Scan()
	t, _ := strconv.Atoi(scanner.Text())
	for i_ := 0; i_ < t; i_++ {
		scanner.Scan()
		n, _ := strconv.ParseInt(scanner.Text(), 10, 64)
		scanner.Scan()
		k, _ := strconv.ParseInt(scanner.Text(), 10, 64)
		scanner.Scan()
		b, _ := strconv.ParseInt(scanner.Text(), 10, 64)
		scanner.Scan()
		s, _ := strconv.ParseInt(scanner.Text(), 10, 64)
		if s-n*(k-1) <= k*b && k*b <= s {
			if k == 1 {
				wr.WriteString(strconv.FormatInt(b, 10) + " ")
				var i int64
				for i = 0; i < n-1; i++ {
					wr.WriteString(strconv.Itoa(0) + " ")
				}
			} else {
				sm := (s - k*b) / (k - 1)
				sr := (s - k*b) % (k - 1)
				wr.WriteString(strconv.FormatInt(k*b, 10) + " ")
				wr.WriteString(strconv.FormatInt(sr, 10) + " ")
				var i int64
				for i = 0; i < sm; i++ {
					wr.WriteString(strconv.FormatInt(k-1, 10) + " ")
				}
				for i = 0; i < n-sm-2; i++ {
					wr.WriteString(strconv.Itoa(0) + " ")
				}
			}
			wr.WriteString("\n")
		} else {
			wr.WriteString(strconv.Itoa(-1) + "\n")
		}
	}
}

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

package main

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

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

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

func Solve(reader *bufio.Reader) {
	scanner := bufio.NewScanner(reader)
	scanner.Split(bufio.ScanWords)
	wr := bufio.NewWriter(os.Stdout)
	defer wr.Flush()

	scanner.Scan()
	t, _ := strconv.Atoi(scanner.Text())
	for i_ := 0; i_ < t; i_++ {
		scanner.Scan()
		n, _ := strconv.Atoi(scanner.Text())
		scanner.Scan()
		k, _ := strconv.Atoi(scanner.Text())
		scanner.Scan()
		b, _ := strconv.Atoi(scanner.Text())
		scanner.Scan()
		s, _ := strconv.Atoi(scanner.Text())
		if s-n*(k-1) <= k*b && k*b <= s {
			if k == 1 {
				wr.WriteString(strconv.Itoa(b) + " ")
				for i := 0; i < n-1; i++ {
					wr.WriteString(strconv.Itoa(0) + " ")
				}
			} else {
				sm := (s - k*b) / (k - 1)
				sr := (s - k*b) % (k - 1)
				wr.WriteString(strconv.Itoa(k*b+sr) + " ")
				for i := 0; i < sm; i++ {
					wr.WriteString(strconv.Itoa(k-1) + " ")
				}
				for i := 0; i < n-sm-1; i++ {
					wr.WriteString(strconv.Itoa(0) + " ")
				}
			}
			wr.WriteString("\n")
		} else {
			wr.WriteString(strconv.Itoa(-1) + "\n")
		}
	}
}

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

package main

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

const MOD int64 = 1000000007

var n, k, b, s int64

// ByAge implements sort.Interface based on the Age field.
type ByV []*pair

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

var w *bufio.Writer

func main() {

	read := bufio.NewReader(os.Stdin)

	w = bufio.NewWriter(os.Stdout)

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

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

		fmt.Fscan(read, &n, &k, &b, &s)

		solve()

		fmt.Fprintln(w)

		w.Flush()
	}
}

type pair struct {
	v int
	idx []int
}

func solve() {

	var max int64 = s/k

	vv := (k - 1) * n

	var min int64

	if vv >= s {
		min = 0
	}

	diffS := s - vv

	r := diffS % k

	if r != 0 {
		diffS += k - r
	}
	min = diffS/k

	if b < min || b > max {
		fmt.Fprint(w, -1)
		return
	}

	rest := s - b * k

	arr := make([]int64, n)

	arr[0] = b * k

	for i := 1; i < int(n); i++ {
		arr[i] = 0
	}

	for i := 0; i < int(n); i++ {
		if rest >= k - 1 {
			arr[i] += (k - 1)
			rest -= (k - 1)
		} else {
			arr[i] += rest
			rest = 0
		}
	}

	for i := 0; i < int(n); i++ {
		fmt.Fprint(w, arr[i], " ")
	}
}

//IQ = 87

//........105....99...87..87..87..87.87.......87....

//            86

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

package main

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

const MOD int64 = 1000000007

var n, k, b, s int64

// ByAge implements sort.Interface based on the Age field.
type ByV []*pair

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

var w *bufio.Writer

func main() {

	read := bufio.NewReader(os.Stdin)

	w = bufio.NewWriter(os.Stdout)

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

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

		fmt.Fscan(read, &n, &k, &b, &s)

		solve()

		fmt.Fprintln(w)

		w.Flush()
	}
}

type pair struct {
	v int
	idx []int
}

func solve() {
	if s/k < b {
		fmt.Fprint(w, -1)
		return
	}
	// s/k >= Sum(ai/k)

	v := k * b

	if s - v > 0 && n == 1  {
		fmt.Fprint(w, -1)
		return
	}

	if s - v == 0 && n == 1 {
		fmt.Fprint(w, v)
		return
	}

	var d int64

	d = (s - v)/(n - 1)

	if (s - v) % (n - 1) != 0 {
		d++
	}

	if d >= k {
		fmt.Fprint(w, -1)
		return
	}

	fmt.Fprint(w, v, " ")

	rest := s - v

	for i := 0; i < int(n) - 1; i ++ {
		if rest >= k - 1 {
			fmt.Fprint(w, k - 1, " ")
			rest -= (k - 1)
		} else {
			fmt.Fprint(w, rest, " ")
			rest = 0
		}
	}

	//n k b s
	//2 4 7 38
	//
	// 38/4  >=  21/4 + 17/4

	// 38/4   0/4  0/4  0/4  0/4   -> /

	//  7  - 10
	//  6 -  14

}

//IQ = 87

//........105....99...87..87..87..87.87.......87....

//            86

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

package main

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

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

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

// func min3(a, b, c int) int {
// 	return min(min(a, b), c)
// }

// func maxSquare(a int) int {
// 	tmp := int(math.Sqrt(float64(a)))
// 	if tmp*tmp == a {
// 		return tmp * tmp
// 	} else {
// 		return (tmp + 1) * (tmp + 1)
// 	}
// }

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var niter int
	fmt.Fscan(in, &niter)
	for iiter := 0; iiter < niter; iiter++ {
		var n, k, b, s int64
		fmt.Fscan(in, &n, &k, &b, &s)
		nstart := n
		if ((b >= 1) && (s >= b*k) && (s <= (((2*k - 1) * n) + (max(b-n, 0) * k)))) || ((b == 0) && (s <= (k-1)*n)) {
			for i := int64(0); i < nstart; i++ {
				//fmt.Fprintln(out, "!!!!!", n, k, b, s, (2*k-1)+max(b-n, 0)*k)
				if s == 0 {
					fmt.Fprintf(out, "%d ", 0)
					continue
				}
				if b == 0 {
					if s <= k-1 {
						fmt.Fprintf(out, "%d ", s)
						s = 0
						n--
						continue
					} else {
						fmt.Fprintf(out, "%d ", k-1)
						n--
						s -= k - 1
						continue
					}
				}
				if (s >= k*b) && (s <= (2*k-1)+max(b-n, 0)*k) {
					fmt.Fprintf(out, "%d ", s)
					s = 0
					b = 0
					n--
					//continue outer
				} else {
					//fmt.Fprintln(out, "HERE")
					s2 := s - (2*k - 1)
					if (s2 >= (b-1)*k) && (s2 <= (2*k-1)*(n-1)+max(b-n, 0)*k) {
						fmt.Fprintf(out, "%d ", 2*k-1)
						s = s2
						b--
						n--
					} else {
						fmt.Fprintf(out, "%d ", k)
						s -= k
						b--
						n--
					}
					//fmt.Fprintf(out, "%d ", 2*b-1)
				}
				// } else {
				// 	// snew := s - 2*b - 1
				// 	// if !((snew >= b*k) && (snew <= (2*k-1)*(n-1))) {
				// 	// 	s = s - b
				// 	// 	fmt.Fprintf(out, "%d ", b)
				// 	// } else {
				// 	// 	s = s - (2*b - 1)
				// 	// 	fmt.Fprintf(out, "%d ", 2*b-1)
				// 	}
				// }
			}
			fmt.Fprintln(out)
		} else {
			fmt.Fprintln(out, "-1")
		}
	}
}

package main

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

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

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

// func min3(a, b, c int) int {
// 	return min(min(a, b), c)
// }

// func maxSquare(a int) int {
// 	tmp := int(math.Sqrt(float64(a)))
// 	if tmp*tmp == a {
// 		return tmp * tmp
// 	} else {
// 		return (tmp + 1) * (tmp + 1)
// 	}
// }

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var niter int
	fmt.Fscan(in, &niter)
	for iiter := 0; iiter < niter; iiter++ {
		var n, k, b, s int64
		fmt.Fscan(in, &n, &k, &b, &s)
		nstart := n
		if (s >= b*k) && (s <= (((2*k - 1) * n) + (max(b-n, 0) * k))) {
			for i := int64(0); i < nstart; i++ {
				//fmt.Fprintln(out, "!!!!!", n, k, b, s)
				if s == 0 {
					fmt.Fprintf(out, "%d ", 0)
					continue
				}
				if (s >= k) && (s <= (2*k-1)*1+max(b-n, 0)*k) {
					fmt.Fprintf(out, "%d ", s)
					s = 0
					b = 0
					n--
					//continue outer
				} else {
					//fmt.Fprintln(out, "HERE")
					s2 := s - (2*k - 1)
					if (s2 >= (b-1)*k) && (s2 <= (2*k-1)*(n-1)+max(b-n, 0)*k) {
						fmt.Fprintf(out, "%d ", 2*k-1)
						s = s2
						b--
						n--
					} else {
						fmt.Fprintf(out, "%d ", k)
						s -= k
						b--
						n--
					}
					//fmt.Fprintf(out, "%d ", 2*b-1)
				}
				// } else {
				// 	// snew := s - 2*b - 1
				// 	// if !((snew >= b*k) && (snew <= (2*k-1)*(n-1))) {
				// 	// 	s = s - b
				// 	// 	fmt.Fprintf(out, "%d ", b)
				// 	// } else {
				// 	// 	s = s - (2*b - 1)
				// 	// 	fmt.Fprintf(out, "%d ", 2*b-1)
				// 	}
				// }
			}
			fmt.Fprintln(out)
		} else {
			fmt.Fprintln(out, "-1")
		}
	}
}

package main

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

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

	return b
}

func main() {
	// f, _ := os.Open("input.txt")
	var reader = bufio.NewReader(os.Stdin)
	// var reader = bufio.NewReader(f)
	var tests int
	fmt.Fscan(reader, &tests)
	for t := 0; t < tests; t++ {
		var n, k, b int
		var s int64
		fmt.Fscan(reader, &n)
		fmt.Fscan(reader, &k)
		fmt.Fscan(reader, &b)
		fmt.Fscan(reader, &s)
		var result = make([]int64, n)
		var first int64 = int64(k + 1) * int64(b) - 1
		if b == 0 {
			first = int64(k - 1)
		}
		if first > s {
			if s < int64(k) * int64(b) {
				fmt.Println(-1)
				continue
			}
			first = s
		}
		result[0] = first
		s -= first
		for i := 1; i < n; i++ {
			var next int64 = int64(k) - 1
			if s < next {
				next = s
			}

			result[i] = next
			s -= next
		}

		if s > 0 {
			fmt.Println(-1)
			continue
		}

		for i := 0; i < n; i++ {
			fmt.Print(result[i], " ")
		}

		fmt.Println()
	}
}

package main

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

var (
	reader bufio.Reader
	writer bufio.Writer
)

func main() {
	inp, err := os.Open("in.txt")
	if err == nil {
		os.Stdin = inp
		outp, _ := os.Create("out.txt")
		os.Stdout = outp
		defer outp.Close()
		defer inp.Close()
	}
	reader = *bufio.NewReader(os.Stdin)
	writer = *bufio.NewWriter(os.Stdout)
	defer writer.Flush()

	var T int
	scan(&T)

	for ; T > 0; T-- {
		var n, k, b, s int
		scan(&n, &k, &b, &s)

		if s < b * k {
			printf("-1\n")
			continue
		}

		arr := make([]int64, n)
		arr[0] = int64(b) * int64(k)
		s -= b * k
		for i := 1; i < n; i++ {
			if s >= k - 1 {
				arr[i] = int64(k - 1)
			} else {
				arr[i] = int64(s)
				s = 0
				break
			}
			s -= k - 1
		}

		if s > k - 1 {
			printf("-1\n")
			/*for i := 0; i < n; i++ {
				printf("%v ", arr[i])
			}
			printf("\n")*/
		} else {
			arr[0] += int64(s)
			for i := 0; i < n; i++ {
				printf("%v ", arr[i])
			}
			printf("\n")
		}
	}
}

func scan(a ...interface{}) (n int, err error) {
	return fmt.Fscan(&reader, a...)
}

func printf(format string, a ...interface{}) (n int, err error) {
	return fmt.Fprintf(&writer, format, a...)
}


// 354A-mic
package main

import (
	"fmt"
	"math"
)

func main() {
	var n, l, r, ql, qr int
	var P [100005]int
	fmt.Scan(&n, &l, &r, &ql, &qr)
	for i := 1; i < n+1; i++ {
		fmt.Scan(&P[i])
		P[i] += P[i-1]
	}
	res := 1000000000
	for i := 0; i < n+1; i++ {
		c := l*P[i] + r*(P[n]-P[i])
		r := n - i
		if i > r {
			c += ql * (i - r - 1)
		}
		if i < r {
			c += qr * (r - i - 1)
		}
		res = int(math.Min(float64(res), float64(c)))
	}
	fmt.Println(res)
}

// 354A-mic
package main

import (
	"fmt"
	"math"
)

func main() {
	var n, l, r, ql, qr int
	var P [100005]int
	fmt.Scan(&n, &l, &r, &ql, &qr)
	for i := 1; i < n+1; i++ {
		fmt.Scan(&P[i])
		P[i] += P[i-1]
	}
	res := 1 << 30
	for i := 0; i < n+1; i++ {
		c := l*P[i] + r*(P[n]-P[i])
		r := n - i
		if i > r {
			c += ql * (i - r - 1)
		}
		if i < r {
			c += qr * (r - i - 1)
		}
		res = int(math.Min(float64(res), float64(c)))
	}
	fmt.Println(res)
}

package main

import "os"
import "bufio"
import "strconv"

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

func main(){
	 var n, l, r, q1, q2 int
	 re := bufio.NewScanner(os.Stdin)
	 re.Split(bufio.ScanWords)
	 w := bufio.NewWriter(os.Stdout)
	 re.Scan()
	 n, _ = strconv.Atoi(re.Text())
	 re.Scan()
	 l, _ = strconv.Atoi(re.Text())
	 re.Scan()
	 r, _ = strconv.Atoi(re.Text())
	 re.Scan()
	 q1, _ = strconv.Atoi(re.Text())
	 re.Scan()
	 q2, _ = strconv.Atoi(re.Text())
	 sum := 0
	 ans := 0
	 a := make([]int, 100010)
	 for i:=1; i<=n; i++ {
		re.Scan()
		a[i], _ = strconv.Atoi(re.Text())
		sum += a[i]
	 }
	 sum *= r
	 ans = sum+(n-1)*q2
	 for i:=1; i<=n; i++ {
		sum = sum-r*a[i]+l*a[i]
		if i<n-i {
			ans = min(ans, sum+(n-i-i-1)*q2)
		} else if i > n-i {
			ans = min(ans, sum+(i-(n-i)-1)*q1)
		} else {
			ans = min(ans, sum)
		}
	 }
	 w.WriteString(strconv.Itoa(ans)+"\n")
	 w.Flush()
}

// 354A
package main

import (
	"fmt"
)

func min(x, y int64) int64 {
	if x > y {
		return y
	}
	return x
}

func main() {
	var Q, n, l, r, a, b, i, sum int64
	var w, s [100100]int64
	fmt.Scan(&n, &l, &r, &a, &b)
	s[0] = 0
	for i = 1; i <= n; i++ {
		fmt.Scan(&w[i])
		s[i] = s[i-1] + w[i]
	}
	Q = 2000000000
	for i = 0; i <= n; i++ {
		sum = s[i]*l + (s[n]-s[i])*r
		if i > n-i {
			sum += (2*i - n - 1) * a
		}
		if i < n-i {
			sum += (n - 2*i - 1) * b
		}
		Q = min(Q, sum)
	}

	fmt.Print(Q)
}

// 354A
package main

import (
	"fmt"
)

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

func main() {
	var n, l, r, a, b int
	var w, s [100100]int
	fmt.Scan(&n, &l, &r, &a, &b)
	s[0] = 0
	for i := 1; i <= n; i++ {
		fmt.Scan(&w[i])
		s[i] = s[i-1] + w[i]
	}
	Q := 200000000
	for i := 0; i <= n; i++ {
		sum := s[i]*l + (s[n]-s[i])*r
		if i > n-i {
			sum += (2*i - n - 1) * a
		}
		if i < n-i {
			sum += (n - 2*i - 1) * b
		}
		Q = min(Q, sum)
	}

	fmt.Print(Q)
}

// 354A
package main

import (
	"fmt"
)

func min(x, y int64) int64 {
	if x > y {
		return y
	}
	return x
}

func main() {
	var n, l, r, a, b, i, sum int64
	var w, s [100100]int64
	fmt.Scan(&n, &l, &r, &a, &b)
	s[0] = 0
	for i = 1; i <= n; i++ {
		fmt.Scan(&w[i])
		s[i] = s[i-1] + w[i]
	}
	Q := int64(200000000)
	for i = 0; i <= n; i++ {
		sum = s[i]*l + (s[n]-s[i])*r
		if i > n-i {
			sum += (2*i - n - 1) * a
		}
		if i < n-i {
			sum += (n - 2*i - 1) * b
		}
		Q = min(Q, sum)
	}

	fmt.Print(Q)
}


package main

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

func main() {

	//stdin, err := os.Open("file.in")
	//if err != nil {
	//	panic(err)
	//}
	//defer stdin.Close()
	stdin := os.Stdin
	reader := bufio.NewReaderSize(stdin, 1024*1024)

	//stdout, err := os.Create("file.out")
	//if err != nil {
	//	panic(err)
	//}
	//defer stdout.Close()
	stdout := os.Stdout
	writer := bufio.NewWriterSize(stdout, 1024*1024)

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

	var s1, s2 string
	fmt.Fscanf(reader, "%s\n", &s1)
	fmt.Fscanf(reader, "%s\n", &s2)

	a := make([]int, 0)
	b := make([]int, 0)

	var r int

	for i := 0; i < n; i++ {
		if s1[i] != s2[i] {
			if s1[i] == 'a' {
				r++
			}
			if s2[i] == 'a' {
				r++
			}
			if s1[i] == 'a' {
				a = append(a, i)
			} else {
				b = append(b, i)
			}
		}
	}

	if r % 2 == 1 || (2 * n - r) % 2 == 1 {
		fmt.Fprintf(writer,"-1\n")
	} else {
		if len(a) % 2 == 1 && len(b) % 2 == 1 {
			fmt.Fprintf(writer, "%d\n", (len(a) + len(b)) / 2 + 1)
		} else {
			fmt.Fprintf(writer, "%d\n", (len(a) + len(b)) / 2)
		}

		for len(a) > 1 {
			fmt.Fprintf(writer, "%d %d\n", a[0] + 1, a[1] + 1)
			a = a[2:]
		}

		for len(b) > 1 {
			fmt.Fprintf(writer, "%d %d\n", b[0] + 1, b[1] + 1)
			b = b[2:]
		}

		if len(a) > 0 {
			fmt.Fprintf(writer, "%d %d\n", a[0] + 1, a[0] + 1)
			fmt.Fprintf(writer, "%d %d\n", a[0] + 1, b[0] + 1)
		}

	}

	writer.Flush()
}

package main

import (
    "bufio"
    "fmt"
    "os"
)
const(
    mod int = 1e9 + 7
    N = 1e6
)
func main() {
    in := bufio.NewReader(os.Stdin)
    var n int
    var a, b string
    fmt.Fscan(in, &n)
    fmt.Fscan(in, &a)
    fmt.Fscan(in, &b)
    tot := make([][][]int, 2)
    tot[0] = make([][]int, 2)
    tot[1] = make([][]int, 2)
    for i := 0; i < n; i++ {
        if a[i] != b[i] {
            tot[a[i] - 'a'][b[i] - 'a'] = append(tot[a[i] - 'a'][b[i] - 'a'], i + 1)
        }
    }
    if (len(tot[0][1]) + len(tot[1][0])) % 2 != 0 {
        fmt.Println(-1)
        return
    }
    fmt.Println(len(tot[0][1]) / 2 + len(tot[1][0]) / 2 + 2 * (len(tot[0][1]) % 2))
    f := func(b int){
        for len(tot[b][b ^ 1]) >= 2 {
            fmt.Println(tot[b][b ^ 1][0], tot[b][b ^ 1][1])
            tot[b][b ^ 1] = tot[b][b ^ 1][2 : ]
        }
    }
    f(0)
    f(1)
    if len(tot[0][1]) > 0 {
        fmt.Println(tot[0][1][0], tot[0][1][0])
        fmt.Println(tot[0][1][0], tot[1][0][0])
    }
}