package main

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

func (io *IO) Solve() {
	t := io.Int()
	for i := 0; i < t; i++ {
		io.Skip()
		x := io.Int64()
		io.Printf("%v\n", x*2)
	}
}

func main() {
	NewIO().Solve()
}

type IO struct {
	scanner *bufio.Scanner
	writer  io.Writer
}

func NewIO() *IO {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	return &IO{scanner, os.Stdout}
}

func (io *IO) Skip() {
	io.scanner.Scan()
}

func (io *IO) Int32() (n int32) {
	io.scanner.Scan()
	buf := io.scanner.Bytes()
	for _, v := range buf {
		n = n*10 + int32(v-'0')
	}
	return
}

func (io *IO) Int64() (n int64) {
	io.scanner.Scan()
	buf := io.scanner.Bytes()
	for _, v := range buf {
		n = n*10 + int64(v-'0')
	}
	return
}

func (io *IO) Int() (n int) {
	io.scanner.Scan()
	buf := io.scanner.Bytes()
	for _, v := range buf {
		n = n*10 + int(v-'0')
	}
	return
}

func (io *IO) UInt() (n uint) {
	io.scanner.Scan()
	buf := io.scanner.Bytes()
	for _, v := range buf {
		n = n*10 + uint(v-'0')
	}
	return
}

func (io *IO) Bytes() []byte {
	io.scanner.Scan()
	return io.scanner.Bytes()
}

func (io *IO) IntArray(n int) (arr []int) {
	arr = make([]int, n)
	for i := 0; i < n; i++ {
		arr[i] = io.Int()
	}
	return
}

func (io *IO) UIntArray(n int) (arr []uint) {
	arr = make([]uint, n)
	for i := 0; i < n; i++ {
		arr[i] = io.UInt()
	}
	return
}

func (io *IO) Print(a interface{}) {
	fmt.Fprint(io.writer, a)
}

func (io *IO) Printf(format string, a interface{}) {
	fmt.Fprintf(io.writer, format, a)
}

func (io *IO) setBuffer() {
	io.scanner.Buffer(make([]byte, 4096), 512*1024)
}

package main

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

func main() {
	var read = bufio.NewReader(os.Stdin)
	var write = bufio.NewWriter(os.Stdout)
	defer write.Flush()
	var t int
	fmt.Fscan(read, &t)
	for i:=0; i < t; i++ {
		var n, x int64
		fmt.Fscan(read, &n, &x)
		fmt.Fprintln(write, 2 * x)
	}
}

package main

import "fmt"

func main() {
	var t, n, x int64
	fmt.Scan(&t)
	for ; t > 0; t-- {
		fmt.Scan(&n, &x)
		fmt.Println(x * 2)
	}
}

package main

import "fmt"

var testCase int

func main() {
	if _, err := fmt.Scanln(&testCase); err != nil {
		return
	}
	for testCase > 0 {
		testCase -= 1
		var (
			n int
			x int
		)
		if _, err := fmt.Scanln(&n, &x); err != nil {
            continue
		}

		fmt.Println(x * 2)
	}
}

package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	scanner.Text()
	for scanner.Scan() {
		text := scanner.Text()
		num := strings.Split(text, " ")
		x, _ := strconv.Atoi(num[1])
		fmt.Println(x + x)
	}
}

package main
import (
    "fmt"
)

func func1(a int) (int){
    return 2 * a
}

func main(){
    var T int
    fmt.Scanf("%d\n", &T)
    for; T > 0; T-- {
        var n, x int
         fmt.Scanf("%d%d\n", &n, &x)
        //fmt.Printf("%d %d %v\n", n, x, err)
        fmt.Printf("%d\n", func1(x))
    }
}

package main

import "fmt"

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

package main

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

func main() {
	sc := NewScanner()
	N := sc.NextInt()
	for i := 0; i < N; i++ {
		_, A := sc.NextInt(), sc.NextInt()
		fmt.Println(2 * A)
	}

}

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

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

func (s *Scanner) NextFloat() float64 {
	v, _ := strconv.ParseFloat(s.Next(), 64)
	return v
}

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

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

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

	return mp
}

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

// Author: sighduck
// URL: https://codeforces.com/contest/1194/problem/A

package main

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

func Solve(n int, x int) int {
	return 2 * x
}

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

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

package main
import (
    "fmt"
)

func func1(a int) (int){
    return 2 * a
}

func main(){
    var T int
    fmt.Scanf("%v", &T)
    for; T > 0; T-- {
        var n, x  int
        fmt.Scanf("%v%v", &n, &x)
        fmt.Printf("%v\n", func1(x))
    }
}

package main

import "fmt"

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


package main

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

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

	tc := readNum(reader)

	var buf bytes.Buffer

	for tc > 0 {
		tc--
		var n int
		var k int64
		s, _ := reader.ReadBytes('\n')
		pos := readInt(s, 0, &n)
		readInt64(s, pos+1, &k)
		s, _ = reader.ReadBytes('\n')
		pos = 0
		A := make([]int64, n)
		for i := 0; i < n; i++ {
			pos = readInt64(s, pos, &A[i]) + 1
		}
		res := solve(n, A, k)
		if res {
			buf.WriteString("YES\n")
		} else {
			buf.WriteString("NO\n")
		}
	}

	fmt.Print(buf.String())
}

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

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, A []int64, k int64) bool {
	sort.Slice(A, func(i, j int) bool {
		return A[i] < A[j]
	})

	diff := A[0]
	g := A[1] - diff
	for i := 2; i < n; i++ {
		g = gcd(g, A[i]-diff)
	}

	return (k-diff)%g == 0
}

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

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	//. "testgo/helpers"
)

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

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

func main() {
	defer writer.Flush()
	//RedirectInputToFile(reader, "input.txt")
	t := 1
	scan(&t)

	for T := 0; T < t; T++ {
		n, k := 0, int64(0)
		scan(&n)
		scan(&k)

		a := make([]int64, n)
		for i := range a {
			scan(&a[i])
		}

		solve(a, k)
	}
}

func solve(a []int64, k int64) {
	abs := func(a int64) int64 {
		if a < 0 {
			return -a
		}
		return a
	}

	gcd := func(a, b int64) int64 {
		a, b = abs(a), abs(b)
		for a > 0 && b > 0 {
			a, b = b, a%b
		}
		return a + b
	}

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

	g := int64(0)
	for i := 1; i < len(a); i++ {
		g = gcd(g, a[i]-a[i-1])
	}

	ans := "NO"
	if (k-a[0])%g == 0 {
		ans = "YES"
	}
	printf("%s\n", ans)
}

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

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

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

	var t int
	Fscan(in, &t)
	for t != 0 {
		t--
		var n int
		var k int64
		Fscan(in, &n, &k)
		var g int64 = 0
		var x int64
		for i:=1; i<=n; i++ {
			var tmp int64
			Fscan(in, &tmp)
			if i == 1 {
				x = tmp
			} else {
				g = gcd(g, tmp-x);
			}
		}
		k -= x
		if k % g == 0 {
			Fprintln(out, "YES")
		} else {
			Fprintln(out, "NO")
		}
	}
}

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 sint64() int64 {
	s := sstring()
	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 sint64s(n int64) []int64 {
	a := make([]int64, n)
	for i := range a {
		a[i] = sint64()
	}
	return a
}

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

func main() {
	defer writer.Flush()
	for t := sint64(); t > 0; t-- {
		n := sint64()
		k := sint64()
		x := sint64s(n)
		printf("%s\n", sol(n, k, x))
	}
}

func gcd(a, b int64) int64 {
	for b != 0 {
		a, b = b, a%b
	}
	if a < 0 {
		a *= -1
	}
	return a
}

func sol(n, k int64, x []int64) string {
	g := int64(0)
	for i := 1; i < len(x); i++ {
		g = gcd(g, x[i-1]-x[i])
	}
	if (k-x[0])%g == 0 {
		return "YES"
	}
	return "NO"
}

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 sint64() int64 {
	s := sstring()
	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 sint64s(n int64) []int64 {
	a := make([]int64, n)
	for i := range a {
		a[i] = sint64()
	}
	return a
}

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

func main() {
	defer writer.Flush()
	for t := sint64(); t > 0; t-- {
		n := sint64()
		k := sint64()
		x := sint64s(n)
		printf("%s\n", sol(n, k, x))
	}
}

func gcd(a, b int64) int64 {
	for b != 0 {
		a, b = b, a%b
	}
	if a < 0 {
		a *= -1
	}
	return a
}

func sol(n, k int64, x []int64) string {
	g := int64(0)
	for _, i := range x[1:] {
		g = gcd(g, i-x[0])
	}
	if (k-x[0])%g == 0 {
		return "YES"
	}
	return "NO"
}

package main

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

// github.com/EndlessCheng/codeforces-go
func CF1477A(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()
	gcd := func(a, b int64) int64 {
		for a != 0 {
			a, b = b%a, a
		}
		return b
	}

	var T, n int
	var s, x0, v int64
	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &n, &s, &x0)
		s -= x0
		g := int64(0)
		for n--; n > 0; n-- {
			Fscan(in, &v)
			g = gcd(g, v-x0)
		}
		if g == 0 || s%g != 0 {
			Fprintln(out, "NO")
		} else {
			Fprintln(out, "YES")
		}
	}
}

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

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

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

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

	var t int
	Fscan(in, &t)
	for t != 0 {
		t--
		var n int
		var k int64
		Fscan(in, &n, &k)
		var g int64 = 0
		var x int64
		for i:=1; i<=n; i++ {
			var tmp int64
			Fscan(in, &tmp)
			if i == 1 {
				x = tmp
			} else {
				g = gcd(g, tmp-x);
			}
		}
		k -= x
		if k % g == 0 {
			Fprintln(out, "YES")
		} else {
			Fprintln(out, "NO")
		}
	}
}

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

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

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

	var t int
	Fscan(in, &t)
	for t != 0 {
		t--
		var n int
		var k int
		Fscan(in, &n, &k)
		g := 0
		var x int
		for i:=1; i<=n; i++ {
			var tmp int
			Fscan(in, &tmp)
			if i == 1 {
				x = tmp
			} else {
				g = gcd(g, tmp-x);
			}
		}
		k -= x
		if k % g == 0 {
			Fprintln(out, "YES")
		} else {
			Fprintln(out, "NO")
		}
	}
}

package main

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

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

	tc := readNum(reader)

	var buf bytes.Buffer

	for tc > 0 {
		tc--
		var n int
		var k int64
		s, _ := reader.ReadBytes('\n')
		pos := readInt(s, 0, &n)
		readInt64(s, pos+1, &k)
		s, _ = reader.ReadBytes('\n')
		pos = 0
		A := make([]int64, n)
		for i := 0; i < n; i++ {
			pos = readInt64(s, pos, &A[i]) + 1
		}
		res := solve(n, A, k)
		if res {
			buf.WriteString("YES\n")
		} else {
			buf.WriteString("NO\n")
		}
	}

	fmt.Print(buf.String())
}

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

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, A []int64, k int64) bool {
	sort.Slice(A, func(i, j int) bool {
		return A[i] < A[j]
	})

	// if x < y, z = 2 * x - y, z < x, x - z = y - x
	// or z = 2 * y - x, z > y and z - y = y - x
	for i := 1; i < n; i++ {
		x := A[i-1]
		y := A[i]
		if k == x || k == y {
			return true
		}
		d := y - x
		if k < x {
			if (x-k)%d == 0 {
				return true
			}
		} else if y > k {
			if (y-k)%d == 0 {
				return true
			}
		}
	}
	return false
}


// 00
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 n, k int
		var s string
		fmt.Fscan(reader, &n, &k, &s)
		mk := 0
		i := 0
		j := n - 1
		for i < j {
			if s[i] != s[j] {
				break
			}
			i++
			j--
			mk++
		}
		if i == j+1 {
			mk--
		}
		//fmt.Println(mk, i, j)
		if k <= mk {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	var t int
	fmt.Fscan(in, &t)
	for ; t > 0; t-- {
		var n, k int
		str := ""
		fmt.Fscan(in, &n, &k, &str)
		if 2*k+1 > n {
			fmt.Println("NO")
		} else {
			i := 0
			for ; i < k; i++ {
				if str[i] != str[n-1-i] {
					break
				}
			}
			if i == k {
				fmt.Println("YES")
			} else {
				fmt.Println("NO")
			}
		}

	}
}

package main

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

var bytes []byte

func nextByte() byte {
	b := bytes[0]
	bytes = bytes[1:]
	return b
}

func ScanInt64() int64 {
	var negative bool
	var result int64

	b := nextByte()

	for ; b < '0' || b > '9'; b = nextByte() {
		if b == '-' {
			negative = true
		}
	}

	for ; '0' <= b && b <= '9'; b = nextByte() {
		result = (result << 3) + (result << 1) + int64(b-'0')
	}

	if negative {
		return -result
	} else {
		return result
	}
}

func ScanInt() int {
	return int(ScanInt64())
}

func ScanString() string {
	builder := strings.Builder{}

	for b := nextByte(); b != '\r'; b = nextByte() {
		if b != '\n' {
			builder.WriteByte(b)
		}
	}

	return builder.String()
}

func init() {
	f, err := os.Open("in.txt")

	if err == nil {
		defer f.Close()
	} else {
		f = os.Stdin
	}

	bytes, _ = ioutil.ReadAll(bufio.NewReader(f))
}

func main() {
	for t := ScanInt(); t > 0; t-- {
		n, k := ScanInt(), ScanInt()
		s := []rune(ScanString())

		res := 2*k < n

		for i, j := 0, n-1; i < k; i, j = i+1, j-1 {
			if s[i] != s[j] {
				res = false
			}
		}

		fmt.Println(map[bool]string{false: "NO", true: "YES"}[res])
	}
}

package main

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

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

var n, k, tc, ok int
var s string

func main() {
	fmt.Fscan(_r, &tc)
	for t := 1; t <= tc; t++ {
	    fmt.Fscan(_r, &n, &k)
	    fmt.Fscan(_r, &s)
	    ok=1
	    for i := 0; i<k; i++ {
	        if (s[i]!=s[n-i-1]) {
	            ok = 0
	        }
	    }
	    if (ok==1&&k*2<n) {
	        fmt.Println("YES")
	    } else {
	        fmt.Println("NO")
	    }
	}
}

package main

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

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

	var T, n, k int
	var s []byte
o:
	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &n, &k, &s)
		if 2*k == n {
			Fprintln(out, "NO")
			continue
		}
		for i, b := range s[:k] {
			if b != s[n-1-i] {
				Fprintln(out, "NO")
				continue o
			}
		}
		Fprintln(out, "YES")
	}
}

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

package main

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

func main() {
	var tcs int
	in := bufio.NewReader(os.Stdin)
	_, _ = fmt.Fscan(in, &tcs)

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

		var s string
		_, _ = fmt.Fscan(in, &s)

		got := 0
		for i := 0; (i < (n-1)/2) && (s[i] == s[n-1-i]); i++ {
			got++
		}

		if got >= k {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

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

func getNextString(scanner *bufio.Scanner) string {
	if !scanner.Scan() {
		panic("scan failed")
	}
	return scanner.Text()
}
func atoi(s string) int                             { x, _ := strconv.Atoi(s); return x }
func getNextInt(scanner *bufio.Scanner) int         { return atoi(getNextString(scanner)) }
func atoi64(s string) int64                         { x, _ := strconv.ParseInt(s, 10, 64); return x }
func getNextInt64(scanner *bufio.Scanner) int64     { return atoi64(getNextString(scanner)) }
func atof64(s string) float64                       { x, _ := strconv.ParseFloat(s, 64); return x }
func getNextFloat64(scanner *bufio.Scanner) float64 { return atof64(getNextString(scanner)) }
func main() {
	fp := os.Stdin
	wfp := os.Stdout
	extra := 0
	if os.Getenv("I") == "IronMan" {
		fp, _ = os.Open(os.Getenv("END_GAME"))
		extra = 100
	}
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
	writer := bufio.NewWriter(wfp)
	defer func() {
		r := recover()
		if r != nil {
			fmt.Fprintln(writer, r)
		}
		writer.Flush()
	}()
	solve(scanner, writer)
	for i := 0; i < extra; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
}
func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	t := getNextInt(scanner)
	for t > 0 {
		t--
		func() {
			n := getNextInt(scanner)
			k := getNextInt(scanner)
			s := getNextString(scanner)
			l := 0
			r := n - 1
			for l < r && s[l] == s[r] {
				l++
				r--
			}
			if l < k {
				fmt.Fprintln(writer, "NO")
				return
			}
			if l > k {
				fmt.Fprintln(writer, "YES")
				return
			}
			if l <= r {
				fmt.Fprintln(writer, "YES")
				return
			}
			fmt.Fprintln(writer, "NO")
		}()
	}
}

package main

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

// var m []int
// err = json.Unmarshal([]byte(r.FormValue("example")), &m)

// for i := 0; i < len(m); i++ {
// 	fmt.Println(m[i])
// }

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

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

func LCM(x, y int) int {
	if x >= y {
		initial := x
		for i := 1; i < y+2; i++ {
			if initial%y == 0 {
				break
			} else {
				initial = initial + x
			}

		}
		return initial
	} else {
		initial := y
		for i := 1; i < x+2; i++ {
			if initial%x == 0 {
				break
			} else {
				initial = initial + y
			}

		}
		return initial
	}
}

func IsItPrime(x int) bool {
	if x < 10 {
		if x == 2 || x == 3 || x == 5 || x == 7 {
			return true
		} else {
			return false
		}
	} else {
		j := 0
		k := math.Sqrt(float64(x))
		for m := 3; m <= int(k); {
			if x%m == 0 {
				j = 1
				break
			}
			m = m + 2
		}
		if j == 1 {
			return false
		} else {
			return true
		}
	}

}

// sort.Slice(arr, func(i, j int) bool {
// 	return arr[i] > arr[j]
// })

var t int

func main() {
	var input io.Reader = bufio.NewReader(os.Stdin)
	fmt.Fscan(input, &t)
	for o := 0; o < t; o++ {

		var n, k int
		fmt.Fscan(input, &n)
		fmt.Fscan(input, &k)
		STRING := make([]byte, 0)
		fmt.Fscan(input, &STRING)
		// ARRAY := make(int[], n)
		// for i := 0; i< n; i++{
		// 	fmt.Fscan(input, &ARRAY[i])
		// }

		if k == 0 {
			fmt.Println("YES")
		} else {
			sum := 0
			for i := 0; i < int(n/2); i++ {
				if STRING[i] == STRING[n-1-i] {
					sum++
				} else {
					break
				}
			}

			if sum < k {
				fmt.Println("NO")
			} else {
				if sum > k {
					fmt.Println("YES")
				} else {
					if n%2 == 1 {
						fmt.Println("YES")
					} else {
						if sum != int(n/2) {
							fmt.Println("YES")
						} else {
							fmt.Println("NO")

						}
					}
				}
			}

		}

	}
}

package main

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

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

func solve() {
	// qwqwq
	// a1: qw, a2: q, r1: wq
	n, k := getI(), getI()
	s := getS()

	ans := "YES"

	for i := int64(0); i < k; i++ {
		if ans == "NO" {
			break
		}

		if s[i] != s[n-i-1] {
			ans = "NO"
		}
	}

	if k*2 < n {
		out(ans)
	} else {
		out("NO")
	}
}

// http://github.com/KadoBOT (me@ricardoambrogi.com)
func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 4096), 1e9)
	for i := getI(); i > 0; i-- {
		solve()
	}
	out()
}

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

// !------- HELPERS -------!
func out(x ...interface{}) {
	fmt.Fprintln(wr, x...)
}

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

func getI() int64 {
	s := getS()
	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 getF() float64 {
	sc.Scan()
	i, e := strconv.ParseFloat(sc.Text(), 64)
	if e != nil {
		panic(e)
	}
	return i
}

func getInts(N int64) []int64 {
	ret := make([]int64, N)
	for i := range ret {
		ret[i] = getI()
	}
	return ret
}

func getS() string {
	if !sc.Scan() {
		panic(sc.Err())
	}
	return sc.Text()
}

func ceil(n, d int64) int64 {
	return (n + d - 1) / d
}

func nsort(data ...int64) []int64 {
	sort.SliceStable(data, func(i, j int) bool { return data[i] < data[j] })
	return data
}

func nsorti(data ...int64) []int64 {
	idxs := make([]int64, len(data))
	for i := 0; i < len(data); i++ {
		idxs[i] = int64(i)
	}

	sort.SliceStable(idxs, func(i, j int) bool { return data[idxs[i]] < data[idxs[j]] })
	return idxs
}

func nsum(data ...int64) int64 {
	var res int64
	for _, n := range data {
		res += n
	}
	return res
}

func njoin(s ...int64) string {
	return strings.Trim(fmt.Sprintf("%v", s), "[]")
}

func forEach(n int64, fn func(int64)) {
	for i := int64(0); i < n; i++ {
		fn(i)
	}
}

// min, max, asub, abs
func max(a, b int64) int64 {
	if a > b {
		return a
	}
	return b
}

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

// min for n entry
func nmin(a ...int64) int64 {
	ret := a[0]
	for _, e := range a {
		ret = min(ret, e)
	}
	return ret
}

// max for n entry
func nmax(a ...int64) int64 {
	ret := a[0]
	for _, e := range a {
		ret = max(ret, e)
	}
	return ret
}

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

func abs(a int64) int64 {
	if a >= 0 {
		return a
	}
	return -a
}

func lowerBound(a []int64, x int64) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int64, x int64) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

// !------- FORMULAS -------!
func gcd(a, b int64) int64 {
	for b != 0 {
		t := b
		b = a % b
		a = t
	}
	return a
}

func lcm(a, b int64, integers ...int64) int64 {
	result := a * b / gcd(a, b)

	for i := 0; i < len(integers); i++ {
		result = lcm(result, integers[i])
	}

	return result
}

func sieve(n int64) []int64 {
	integers := make([]bool, n+1)
	for i := int64(2); i < n+1; i++ {
		integers[i] = true
	}

	for p := int64(2); p*p <= n; p++ {
		if integers[p] == true {
			for i := p * 2; i <= n; i += p {
				integers[i] = false
			}
		}
	}

	var primes []int64
	for p := int64(2); p <= n; p++ {
		if integers[p] == true {
			primes = append(primes, p)
		}
	}

	return primes
}

package main

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

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

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

func main() {
	defer writer.Flush()
	////////////////////
	c := 0
	scan(&c)
	for c != 0 {
		solve()
		c--
	}
}

func solve() {
	n, k := 0, 0
	s := ""
	scan(&n, &k)
	scan(&s)
	if k == 0 {
		print("YES", "\n")
		return
	}
	for i := k; i < (n+1)/2; i++ {
		if check(i, s) {
			print("YES", "\n")
			return
		}
	}
	print("NO", "\n")
}

func check(k int, s string) bool {
	ln := len(s)
	t := s[0:k]
	t1 := s[ln-k:ln-1] + string(s[ln-1])
	if t == reverse(t1) {
		return true
	}
	return false
}

func reverse(s string) string {
	rns := []rune(s)
	for i, j := 0, len(rns)-1; i < j; i, j = i+1, j-1 {
		rns[i], rns[j] = rns[j], rns[i]
	}

	return string(rns)
}

package main

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

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

func solve() {
	// qwqwq
	// a1: qw, a2: q, r1: wq
	_, k := getI(), getI()
	s := getS()

	A := s[:k+1]
	R := s[k+1:]

	if len(R) == 0 && k != 0 {
		out("NO")
		return
	}

	var count int64
	for _, ch := range R {
		if strings.ContainsRune(A, ch) {
			count++
		}
	}

	if count < k {
		out("NO")
	} else {
		out("YES")
	}
}

// http://github.com/KadoBOT (me@ricardoambrogi.com)
func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 4096), 1e9)
	for i := getI(); i > 0; i-- {
		solve()
	}
	out()
}

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

// !------- HELPERS -------!
func out(x ...interface{}) {
	fmt.Fprintln(wr, x...)
}

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

func getI() int64 {
	s := getS()
	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 getF() float64 {
	sc.Scan()
	i, e := strconv.ParseFloat(sc.Text(), 64)
	if e != nil {
		panic(e)
	}
	return i
}

func getInts(N int64) []int64 {
	ret := make([]int64, N)
	for i := range ret {
		ret[i] = getI()
	}
	return ret
}

func getS() string {
	if !sc.Scan() {
		panic(sc.Err())
	}
	return sc.Text()
}

func ceil(n, d int64) int64 {
	return (n + d - 1) / d
}

func nsort(data ...int64) []int64 {
	sort.SliceStable(data, func(i, j int) bool { return data[i] < data[j] })
	return data
}

func nsorti(data ...int64) []int64 {
	idxs := make([]int64, len(data))
	for i := 0; i < len(data); i++ {
		idxs[i] = int64(i)
	}

	sort.SliceStable(idxs, func(i, j int) bool { return data[idxs[i]] < data[idxs[j]] })
	return idxs
}

func nsum(data ...int64) int64 {
	var res int64
	for _, n := range data {
		res += n
	}
	return res
}

func njoin(s ...int64) string {
	return strings.Trim(fmt.Sprintf("%v", s), "[]")
}

func forEach(n int64, fn func(int64)) {
	for i := int64(0); i < n; i++ {
		fn(i)
	}
}

// min, max, asub, abs
func max(a, b int64) int64 {
	if a > b {
		return a
	}
	return b
}

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

// min for n entry
func nmin(a ...int64) int64 {
	ret := a[0]
	for _, e := range a {
		ret = min(ret, e)
	}
	return ret
}

// max for n entry
func nmax(a ...int64) int64 {
	ret := a[0]
	for _, e := range a {
		ret = max(ret, e)
	}
	return ret
}

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

func abs(a int64) int64 {
	if a >= 0 {
		return a
	}
	return -a
}

func lowerBound(a []int64, x int64) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int64, x int64) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

// !------- FORMULAS -------!
func gcd(a, b int64) int64 {
	for b != 0 {
		t := b
		b = a % b
		a = t
	}
	return a
}

func lcm(a, b int64, integers ...int64) int64 {
	result := a * b / gcd(a, b)

	for i := 0; i < len(integers); i++ {
		result = lcm(result, integers[i])
	}

	return result
}

func sieve(n int64) []int64 {
	integers := make([]bool, n+1)
	for i := int64(2); i < n+1; i++ {
		integers[i] = true
	}

	for p := int64(2); p*p <= n; p++ {
		if integers[p] == true {
			for i := p * 2; i <= n; i += p {
				integers[i] = false
			}
		}
	}

	var primes []int64
	for p := int64(2); p <= n; p++ {
		if integers[p] == true {
			primes = append(primes, p)
		}
	}

	return primes
}

package main

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

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

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

func main() {
	defer writer.Flush()
	////////////////////
	c := 0
	scan(&c)
	for c != 0 {
		solve()
		c--
	}
}

func solve() {
	n, k := 0, 0
	s := ""
	scan(&n, &k)
	scan(&s)
	if k == 0 {
		print("YES", "\n")
		return
	}
	if check(s) && n%2 != 0 {
		print("YES", "\n")
		return
	}
	print("NO", "\n")
}

func check(s string) bool {
	ln := len(s)
	t := s[0:(ln / 2)]
	t1 := s[((ln+1)/2):ln-1] + string(s[ln-1])
	if t == reverse(t1) {
		return true
	}
	return false
}

func reverse(s string) string {
	rns := []rune(s)
	for i, j := 0, len(rns)-1; i < j; i, j = i+1, j-1 {
		rns[i], rns[j] = rns[j], rns[i]
	}

	return string(rns)
}


package main

import (
	"fmt"
)

func solve() string {
	var a, b int
	fmt.Scanf("%d%d\n", &a, &b)
	var s string
	fmt.Scanf("%s\n", &s)
	l := a + b
	arr := []byte(s)

	for i := 0; i < l/2; i++ {
		j := l - i - 1
		if arr[i] == 48 || arr[j] == 48 {
			if arr[j] == 49 || arr[i] == 49 {
				return "-1"
			}
			arr[i], arr[j] = 48, 48
			a -= 2
		} else if arr[i] == 49 || arr[j] == 49 {
			if arr[j] == 48 || arr[i] == 48 {
				return "-1"
			}
			arr[i], arr[j] = 49, 49
			b -= 2
		}
	}

	if l&1 == 1 {
		if arr[l/2] == 48 {
			a--
		} else if arr[l/2] == 49 {
			b--
		}
	}

	if a < 0 || b < 0 {
		return "-1"
	}

	for i := 0; i < l/2; i++ {
		j := l - i - 1
		if arr[i] == 63 {
			if a >= 2 {
				arr[i], arr[j] = 48, 48
				a -= 2
			} else if b >= 2 {
				arr[i], arr[j] = 49, 49
				b -= 2
			} else {
				return "-1"
			}
		}
	}

	if l&1 == 1 {
		if arr[l/2] == 63 {
			if a > 0 {
				arr[l/2] = 48
				a--
			} else {
				arr[l/2] = 49
				b--
			}
		}
	}

	if a != 0 && b != 0 {
		return "-1"
	}

	return string(arr)

}

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

	for ; t > 0; t-- {
		fmt.Println(solve())
	}

}

// 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 a, b int
		fmt.Fscan(reader, &a, &b)
		var sb string
		fmt.Fscan(reader, &sb)

		s := []byte(sb)
		for i := 0; i < len(s); i++ {
			if s[i] == '1' {
				b--
			} else if s[i] == '0' {
				a--
			}
		}
		ok := true
		i := 0
		j := len(sb) - 1
		for i <= j {
			if s[i] != '?' && s[j] != '?' {
				if s[i] != s[j] {
					ok = false
					break
				}
			}
			i++
			j--
		}
		i = 0
		j = len(sb) - 1
		if ok {
			for i <= j {
				if (s[i] == '?' || s[j] == '?') && (s[i] != s[j]) {
					if s[i] == '?' {
						s[i] = s[j]
						if s[j] == '1' {
							b -= 1
						} else {
							a -= 1
						}
					} else {
						s[j] = s[i]
						if s[j] == '1' {
							b -= 1
						} else {
							a -= 1
						}
					}

				}
				i++
				j--
			}
		}
		i = 0
		j = len(sb) - 1
		if ok {
			for i <= j {
				if s[i] == '?' && s[j] == '?' {
					if i == j {
						if a > 0 {
							s[i] = '0'
							a--
						} else if b > 0 {
							s[i] = '1'
							b--
						}
					} else {
						if a > 1 {
							s[i] = '0'
							s[j] = '0'
							a -= 2
						} else if b > 1 {
							s[i] = '1'
							s[j] = '1'
							b -= 2
						}
					}
				}
				i++
				j--
			}
		}
		if a != 0 || b != 0 {
			ok = false
		}
		if ok {
			write(f, string(s), "\n")
		} else {
			write(f, "-1\n")
		}
	}
}

package main

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

func Solve() {
	var n, m int
	scan(&n, &m)
	var s string
	scan(&s)
	t := []rune(s)
	l, r := 0, n+m-1
	for l < r {
		if t[l] != t[r] {
			if t[l] != '?' && t[r] != '?' {
				println(-1)
				return
			} else {
				if t[l] == '?' {
					t[l] = t[r]
				} else {
					t[r] = t[l]
				}
			}
		}
		l++
		r--
	}
	//println(string(t))
	l, r = 0, n+m-1
	for l <= r {
		switch {
		case t[l] == '0':
			n--
		case t[l] == '1':
			m--
		}
		if l != r {
			switch {
			case t[r] == '0':
				n--
			case t[r] == '1':
				m--
			}
		}
		l++
		r--
	}
	//println(n, m)
	l, r = 0, len(t)-1
	for l <= r {
		if t[l] == '?' {
			if l == r {
				if n >= m {
					t[l] = '0'
					n -= 1
				} else {
					t[l] = '1'
					m -= 1
				}
			} else {
				if n >= m {
					t[l] = '0'
					t[r] = '0'
					n -= 2
				} else {
					t[l] = '1'
					t[r] = '1'
					m -= 2
				}
			}
		}
		l++
		r--
	}
	//println(n, m)
	if n == 0 && m == 0 {
		println(string(t))
	} else {
		println(-1)
	}
}

func main() {
	T := 0
	in, out = bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)
	if T == 0 {
		scan(&T)
	}
	for t := 0; t < T; t++ {
		Solve()
	}
	out.Flush()
}

var in *bufio.Reader
var out *bufio.Writer

func scan(a ...interface{})    { Fscan(in, a...) }
func print(a ...interface{})   { Fprint(out, a...) }
func println(a ...interface{}) { Fprintln(out, a...) }

package main

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

var reader = bufio.NewReader(os.Stdin)

func ri() int {
	var x int
	c, _ := reader.ReadByte()
	for c < '0' || c > '9' {
		c, _ = reader.ReadByte()
	}
	for '0' <= c && c <= '9' {
		x = (x << 3) + (x << 1) + int(c) - '0'
		c, _ = reader.ReadByte()
	}
	return x
}

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

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

const MAXN = 2e5 + 5

type Node struct {
	x, y int
}

func Solve() {
	var n, m int
	fmt.Scan(&n, &m)
	var s string
	fmt.Scan(&s)
	t := []rune(s)
	l, r := 0, n+m-1
	for l < r {
		if t[l] != t[r] {
			if t[l] != '?' && t[r] != '?' {
				fmt.Println(-1)
				return
			} else {
				if t[l] == '?' {
					t[l] = t[r]
				} else {
					t[r] = t[l]
				}
			}
		}
		l++
		r--
	}
	//fmt.Println(string(t))
	l, r = 0, n+m-1
	for l <= r {
		switch {
		case t[l] == '0':
			n--
		case t[l] == '1':
			m--
		}
		if l != r {
			switch {
			case t[r] == '0':
				n--
			case t[r] == '1':
				m--
			}
		}
		l++
		r--
	}
	//fmt.Println(n, m)
	l, r = 0, len(t)-1
	for l <= r {
		if t[l] == '?' {
			if l == r {
				if n >= m {
					t[l] = '0'
					n -= 1
				} else {
					t[l] = '1'
					m -= 1
				}
			} else {
				if n >= m {
					t[l] = '0'
					t[r] = '0'
					n -= 2
				} else {
					t[l] = '1'
					t[r] = '1'
					m -= 2
				}
			}
		}
		l++
		r--
	}
	//fmt.Println(n, m)
	if n == 0 && m == 0 {
		fmt.Println(string(t))
	} else {
		fmt.Println(-1)
	}
}

func main() {
	var T = 0
	if T == 0 {
		fmt.Scan(&T)
	}
	for t := 1; t <= T; t++ {
		Solve()
	}
}
//114514 1919810

package main

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

type pos struct {
	i int
	j int
}

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

	solve := func() {
		var a, b int
		Fscan(in, &a, &b)
		var str []byte
		var cnt [2]int
		var empty_num []pos
		var unique_num []pos
		Fscan(in, &str)

		for l, r := 0, len(str)-1; l <= r; l, r = l+1, r-1 {
			if str[l] == '?' && str[r] == '?' {
				if l != r {
					empty_num = append(empty_num, pos{l, r})
				} else {
					unique_num = append(unique_num, pos{l, r})
				}

			} else {
				if str[l] == '?' {
					str[l] = str[r]
				} else if str[r] == '?' {
					str[r] = str[l]
				}
				if str[l] != str[r] {
					Fprintln(out, -1)
					return
				} else {
					cnt[str[l]-'0']++
					if l != r {
						cnt[str[r]-'0']++
					}
				}
			}
		}
		// Fprint(out, cnt[0], cnt[1])
		if cnt[0] > a || cnt[1] > b {
			Fprintln(out, -1)
		} else {
			for i := 0; i < (a-cnt[0])/2; i++ {
				u := empty_num[len(empty_num)-1].i
				v := empty_num[len(empty_num)-1].j
				str[u] = '0'
				str[v] = '0'
				empty_num = empty_num[:len(empty_num)-1]
			}
			for i := 0; i < (b-cnt[1])/2; i++ {
				u := empty_num[len(empty_num)-1].i
				v := empty_num[len(empty_num)-1].j
				str[u] = '1'
				str[v] = '1'
				empty_num = empty_num[:len(empty_num)-1]
			}
			if len(unique_num) == 1 {
				if len(empty_num) > 0 {
					Fprintln(out, -1)
				} else {
					if (a-cnt[0])%2 == 1 {
						str[len(str)/2] = '0'
					} else {
						str[len(str)/2] = '1'
					}

					Fprintln(out, string(str))
				}
			} else {
				if len(empty_num) > 0 {
					Fprintln(out, -1)
				} else {
					Fprintln(out, string(str))
				}
			}
		}

	}

	var T int
	Fscan(in, &T)
	for o := 0; o < T; o++ {
		solve()
	}

}

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

package main

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

type Scanner struct {
	bScanner *bufio.Scanner
}

func NewScanner() *Scanner {
	bScanner := bufio.NewScanner(os.Stdin)
	bScanner.Split(bufio.ScanWords)
	bScanner.Buffer([]byte{}, math.MaxInt32)
	return &Scanner{
		bScanner,
	}
}
func (s *Scanner) next() string {
	s.bScanner.Scan()
	return s.bScanner.Text()
}
func (s *Scanner) nextInt() int {
	s.bScanner.Scan()
	res, err := strconv.Atoi(s.bScanner.Text())
	if err != nil {
		panic(err)
	}
	return res
}
func (s *Scanner) nextInt64() int64 {
	s.bScanner.Scan()
	res, err := strconv.ParseInt(s.bScanner.Text(), 10, 64)
	if err != nil {
		panic(err)
	}
	return res
}
func (s *Scanner) nextFloat() float64 {
	s.bScanner.Scan()
	res, err := strconv.ParseFloat(s.bScanner.Text(), 64)
	if err != nil {
		panic(err)
	}
	return res
}
func (s *Scanner) nextInts(N int) []int {
	res := make([]int, N)
	for i := 0; i < N; i++ {
		res[i] = s.nextInt()
	}
	return res
}
func (s *Scanner) nextInt64s(N int) []int64 {
	res := make([]int64, N)
	for i := 0; i < N; i++ {
		res[i] = s.nextInt64()
	}
	return res
}
func min(nums ...int) int {
	ans := math.MaxInt32
	for _, num := range nums {
		if num < ans {
			ans = num
		}
	}
	return ans
}
func max(nums ...int) int {
	ans := math.MinInt32
	for _, num := range nums {
		if num > ans {
			ans = num
		}
	}
	return ans
}

func replace(str []byte, a int, b int) string {
	N := len(str)
	l := 0
	r := N - 1
	for l < r {
		if str[l] == '0' {
			a--
		} else if str[l] == '1' {
			b--
		}
		if str[r] == '0' {
			a--
		} else if str[r] == '1' {
			b--
		}
		if str[l] == '?' && str[r] != '?' {
			if str[r] == '0' {
				str[l] = '0'
				a--
			} else {
				str[l] = '1'
				b--
			}
		} else if str[l] != '?' && str[r] == '?' {
			if str[l] == '0' {
				str[r] = '0'
				a--
			} else {
				str[r] = '1'
				b--
			}
		}
		if a < 0 || b < 0 || str[l] != str[r] {
			return "-1"
		}
		l++
		r--
	}
	if l == r {
		if str[l] == '0' {
			a--
		} else if str[l] == '1' {
			b--
		}
		if a < 0 || b < 0 {
			return "-1"
		}
	}

	l = 0
	r = N - 1
	for l < r {
		if str[l] == '?' {
			if a >= 2 {
				str[l] = '0'
				str[r] = '0'
				a -= 2
			} else {
				str[l] = '1'
				str[r] = '1'
				b -= 2
			}
		}
		if a < 0 || b < 0 {
			return "-1"
		}
		l++
		r--
	}
	if l == r && str[l] == '?' {
		if a > 0 {
			str[l] = '0'
			a--
		} else if b > 0 {
			str[l] = '1'
			b--
		} else {
			return "-1"
		}
	}
	if a > 0 || b > 0 {
		return "-1"
	}
	return string(str)
}

func main() {
	sc := NewScanner()
	wr := bufio.NewWriter(os.Stdout)
	defer wr.Flush()

	TC := sc.nextInt()
	for tc := 0; tc < TC; tc++ {
		a := sc.nextInt()
		b := sc.nextInt()
		str := []byte(sc.next())
		ans := replace(str, a, b)
		fmt.Fprintln(wr, ans)
	}

}

package main

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

func main() {
	/*rand.Seed(time.Now().Unix())

	for k := 0; k < 100; k++ {
		a := 1 + rand.Intn(10)
		b := 1 + rand.Intn(10)

		bts := make([]byte, a + b)

		s := "10?"

		for p := 0 ; p < len(bts); p++ {
			r := rand.Intn(3)
			bts[p] = s[r]
		}

		fmt.Printf("a == %d, b == %d, arr = %s", a, b , string(bts))
		fmt.Println()

		ans := solve(string(bts), a, b)

		if ans == "-1" {
			fmt.Println("-1")

		} else {
			var aCount int
			var bCount int

			n := len(ans)

			for j := 0; j < len(ans)/2; j++ {
				if ans[j] == '1' {
					if ans[n - j - 1] != '1' {
						panic("wrong")
					} else {
						bCount +=2
					}
				} else if ans[j] == '0' {
					if ans[n - j - 1] != '0' {
						panic("wring")
					} else {
						aCount +=2
					}
				} else {
					panic("wrong")
				}
			}

			if n % 2 == 1 {
				if ans[n/2] == '1' {
					bCount++
				} else if ans[n/2] == '0' {
					aCount++
				} else {
					panic("wrong")
				}
			}
			if aCount > a || bCount > b {
				panic("wrong")
			}
		}
	}*/

	r := bufio.NewReader(os.Stdin)

	var t int

	fmt.Fscan(r, &t)

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

		var a, b int

		fmt.Fscan(r, &a, &b)

		var s string

		fmt.Fscan(r, &s)

		ans := solve(s, a, b)

		fmt.Println(ans)
	}
}

func solve(s string, a, b int) string {
	if a % 2 == 1 && b % 2 == 1 {
		return "-1"
	}
	n := len(s)
	bts := make([]byte, n)

	aInit := a
	bInit := b

	for i := 0; i < n; i++ {
		if s[i] == '0' {
			a--
		} else if s[i] == '1' {
			b--
		}
	}
	if a < 0 || b < 0 {
		return "-1"
	}

	var count int

	for i := 0; i < n/2; i++ {
		if s[i] == '0' {
			if s[n - i - 1] == '1' {
				return "-1"
			} else if s[n - i - 1] == '?' {
				if a > 0 {
					a--
				} else {
					return "-1"
				}

			}
			bts[n - i - 1] = '0'
			bts[i] = '0'

		} else if s[i] == '1' {
			if s[n - i - 1] == '0' {
				return "-1"
			} else if s[n - i - 1] == '?' {
				if b > 0 {
					b--
				} else {
					return "-1"
				}
			}
			bts[i] = '1'
			bts[n - i - 1] = '1'

		} else if s[i] == '?' {
			if s[n - i - 1] == '1' {
				if b > 0 {
					b--
				} else {
					return "-1"
				}
				bts[i] = '1'
				bts[n - i - 1] = '1'

			} else if s[n - i - 1] == '0' {
				if a > 0 {
					a--
				} else {
					return "-1"
				}
				bts[i] = '0'
				bts[n - i - 1] = '0'

			} else if s[n - i - 1] == '?' {
				count++
				bts[i] = '?'
				bts[n - i - 1] = '?'

			} else {
				panic("unkown2")
			}

		} else {
			panic("unknown")
		}
	}

	if n % 2 == 1 {
		if s[n/2] == '?' {
			if aInit % 2 == 1 && a > 0 {
				a--
				bts[n/2] = '0'
			} else if bInit % 2 == 1 && b > 0 {
				b--
				bts[n/2] = '1'
			}
		} else {
			bts[n/2] = s[n/2]
		}
	}

	if a + b >= 2 * count {

		for i := 0; i < n/2; i++ {
			if bts[i] == '?' {
				if a >= 2 {
					bts[i] = '0'
					bts[n - i - 1] = '0'
					a-=2
				} else if b >= 2 {
					bts[i] = '1'
					bts[n - i - 1] = '1'
					b-=2
				} else {
					return "-1"
				}
			}
		}

	} else {
		return "-1"
	}

	return string(bts)
}

package main

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

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

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

		n := a + b
		m := make([]rune, n)
		f := true
		for i := 0; i < n/2; i++ {
			if s[i] != '?' {
				m[i] = rune(s[i])
				if s[i] == '0' {
					a--
				} else {
					b--
				}
			}

			if s[n-i-1] != '?' {
				m[n-i-1] = rune(s[n-i-1])
				if s[n-i-1] == '0' {
					a--
				} else {
					b--
				}
			}

			if s[i] != '?' && s[n-1-i] != '?' && s[i] != s[n-1-i] {
				f = false
				break
			}

			if s[i] != '?' && s[n-i-1] == '?' {
				if s[i] == '0' {
					m[n-i-1] = '0'
					a--
				} else {
					m[n-i-1] = '1'
					b--
				}
			} else if s[i] == '?' && s[n-i-1] != '?' {
				if s[n-i-1] == '0' {
					m[i] = '0'
					a--
				} else {
					m[i] = '1'
					b--
				}
			}

			if a < 0 || b < 0 {
				f = false
				break
			}
		}

		for i := 0; i < n/2; i++ {
			if m[i] == 0 {
				if a > b {
					m[i], m[n-i-1] = '0', '0'
					a -= 2
				} else {
					m[i], m[n-i-1] = '1', '1'
					b -= 2
				}
			}

			if a < 0 || b < 0 {
				f = false
				break
			}
		}

		if n%2 != 0 {
			mid := n / 2

			if s[mid] != '?' {
				m[mid] = rune(s[mid])
				if s[mid] == '0' {
					a--
				} else {
					b--
				}
			} else {
				if a > 0 {
					m[mid] = '0'
					a--
				} else {
					m[mid] = '1'
					b--
				}
			}
		}

		if !f || (a != 0 && b != 0) {
			fmt.Fprintln(out, -1)
		} else {
			for _, ch := range m {
				fmt.Fprintf(out, "%c", ch)
			}
			fmt.Fprintln(out)
		}
	}
}

package main

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

/*

 */

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

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

	for ; t > 0; t-- {
		var a, b int
		scanf("%d %d\n", &a, &b)

		runeToCnt := make(map[rune]int)
		runeToCnt['0'] = a
		runeToCnt['1'] = b

		var s string
		scanf("%s\n", &s)

		for _, r := range s {
			if r != '?' {
				runeToCnt[r]--
			}
		}

		res := []rune(s)

		for i := 0; i < len(res)/2; i++ {
			lr := res[i]

			j := len(res) - i - 1
			rr := res[j]

			switch {
			case lr != '?' && rr == '?':
				res[j] = lr
				runeToCnt[lr]--
			case lr == '?' && rr != '?':
				res[i] = rr
				runeToCnt[rr]--
			}
		}

		for i := 0; i < len(s)/2; i++ {
			if res[i] == '?' {
				filler := rune(0)
				if runeToCnt['0'] > 1 {
					filler = '0'
				} else if runeToCnt['1'] > 1 {
					filler = '1'
				} else {
					break
				}

				res[i] = filler
				res[len(s)-i-1] = filler

				runeToCnt[filler] -= 2
			}
		}

		midIdx := (len(res) - 1) / 2

		if len(res)%2 != 0 {
			if res[midIdx] == '?' {
				if runeToCnt['0'] == 1 {
					res[midIdx] = '0'
				} else if runeToCnt['1'] == 1 {
					res[midIdx] = '1'
				}
			}
		}

		isPalindrome := true
		zeroCnt := 0
		oneCnt := 0

		for i := range res {
			if res[i] == '0' {
				zeroCnt++
			} else if res[i] == '1' {
				oneCnt++
			}

			j := len(res) - i - 1
			if res[i] == '?' || res[i] != res[j] {
				isPalindrome = false
				break
			}
		}

		if isPalindrome && zeroCnt == a && oneCnt == b {
			fmt.Fprintln(writer, string(res))
		} else {
			fmt.Fprintln(writer, -1)
		}
	}
}

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 int) int {
	quot := num / div
	if num%div != 0 {
		quot++
	}
	return quot
}

//goland:noinspection GoUnusedFunction
func min(nums ...int) int {
	minimum := nums[0]
	for _, num := range nums {
		if num < minimum {
			minimum = num
		}
	}
	return minimum
}

//goland:noinspection GoUnusedFunction
func max(nums ...int64) int64 {
	maximum := nums[0]
	for _, num := range nums {
		if num > maximum {
			maximum = num
		}
	}
	return maximum
}

//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))
}

package main

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

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

	var t int
	for Fscan(in, &t); t > 0; t-- {
		var num [2]int
		Fscan(in, &num[0], &num[1])
		s := make([]byte, num[0] + num[1])
		Fscan(in, &s)

		solve := func() {
			left, right := 0, len(s) - 1
			for left <= right {
				if s[left] == s[right] && s[left] == '?' {
					left++; right--
					continue
				}
				if s[left] == '?' {
					s[left] = s[right]
				} else if s[right] == '?' {
					s[right] = s[left]
				} else if s[left] != s[right] {
					Fprintln(out, -1)
					return
				}
				num[int(s[left] - '0')] -= 2
				if left == right {
					num[int(s[left] - '0')]++
				}
				if num[int(s[left] - '0')] < 0 {
					Fprintln(out, -1)
					return
				}
				left++; right--
			}
			left, right = 0, len(s) - 1
			for left <= right {
				if left == right && s[left] == '?' {
					if num[0] == 1 {
						num[0]--
						s[left] = '0'
					} else if num[1] == 1 {
						num[1]--
						s[left] = '1'
					} else {
						Fprintln(out, -1)
						return
					}
				}
				if left != right && s[left] == '?' && s[right] == '?' {
					if num[0] >= 2 {
						num[0] -= 2
						s[left], s[right] = '0', '0'
					} else if num[1] >= 2 {
						num[1] -= 2
						s[left], s[right] = '1', '1'
					} else {
						Fprintln(out, -1)
						return
					}
				}
				left++; right--
			}
			Fprintln(out, string(s))
		}
		solve()
	}
}

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

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

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

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

package main

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

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

	solve := func(Case int) {
		var a, b int
		var s []byte
		Fscan(in, &a, &b, &s)
		n := len(s)
		for i, j := 0, n-1; i < j; i++ {
			if s[i] != '?' || s[j] != '?' {
				if s[i] == '?' {
					s[i] = s[j]
				} else if s[j] == '?' {
					s[j] = s[i]
				} else if s[i] != s[j] {
					Fprintln(out, -1)
					return
				}
			}
			j--
		}
		c0, c1 := bytes.Count(s, []byte{'0'}), bytes.Count(s, []byte{'1'})
		if c0 > a || c1 > b {
			Fprintln(out, -1)
			return
		}
		for i, j := 0, n-1; i < j; i++ {
			if s[i] == '?' {
				if c0+2 <= a {
					s[i] = '0'
					s[j] = '0'
					c0 += 2
				} else if c1+2 <= b {
					s[i] = '1'
					s[j] = '1'
					c1 += 2
				} else {
					Fprintln(out, -1)
					return
				}
			}
			j--
		}
		if n&1 > 0 && s[n/2]=='?' {
			if c0 < a {
				s[n/2] = '0'
			} else if c1 < b {
				s[n/2] = '1'
			} else {
				Fprintln(out, -1)
				return
			}
		}
		c0, c1 = bytes.Count(s, []byte{'0'}), bytes.Count(s, []byte{'1'})
		if c0 != a || c1 != b {
			Fprintln(out, -1)
			return
		}
		Fprintln(out, string(s))
	}

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

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

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

package main

import (
	"fmt"
	"strings"
)

func genPalindrome(str string, nOnes, nZeros int) string {
	left, right := 0, len(str)-1
	arr := make([]byte, len(str))
	for left <= right {
		if str[right] != str[left] {
			if str[left] == '?' {
				arr[left] = str[right]
				arr[right] = str[right]
			} else if str[right] == '?' {
				arr[left] = str[left]
				arr[right] = str[left]
			} else {
				return "-1"
			}
		} else {
			arr[left] = str[left]
			arr[right] = str[right]
		}
		if arr[left] == '1' {
			if left != right {
				nOnes -= 2
			} else {
				nOnes--
			}
		} else if arr[left] == '0' {
			if left != right {
				nZeros -= 2
			} else {
				nZeros--
			}
		}
		left++
		right--
	}
	left, right = 0, len(str)-1
	for left < right {
		if arr[left] == '?' {
			if nOnes > nZeros {
				arr[left] = '1'
				arr[right] = '1'
				nOnes -= 2
			} else {
				arr[left] = '0'
				arr[right] = '0'
				nZeros -= 2
			}
		}
		if nOnes < 0 || nZeros < 0 {
			return "-1"
		}
		left++
		right--
	}
	if left == right && arr[left] == '?' {
		if nOnes > nZeros {
			nOnes--
			arr[left] = '1'
		} else {
			nZeros--
			arr[left] = '0'
		}
	}
	if nZeros != 0 || nOnes != 0 {
		return "-1"
	}
	var sb strings.Builder
	for _, v := range arr {
		sb.WriteByte(v)
	}
	return sb.String()

}

func main() {
	var nTests int
	fmt.Scanf("%d\n", &nTests)
	for i := 0; i < nTests; i++ {
		var nZeros, nOnes int
		fmt.Scanf("%d %d\n", &nZeros, &nOnes)
		var str string
		fmt.Scanf("%s\n", &str)
		str = genPalindrome(str, nOnes, nZeros)
		fmt.Println(str)
	}
}

package main

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

func main() {

	r := bufio.NewReader(os.Stdin)

	var t int

	fmt.Fscan(r, &t)

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

		var a, b int

		fmt.Fscan(r, &a, &b)

		var s string

		fmt.Fscan(r, &s)

		ans := solve(s, a, b)

		fmt.Println(ans)
	}
}

func solve(s string, a, b int) string {
	if a % 2 == 1 && b % 2 == 1 {
		return "-1"
	}
	n := len(s)
	bts := make([]byte, n)

	aInit := a
	bInit := b

	for i := 0; i < n; i++ {
		if s[i] == '0' {
			a--
		} else if s[i] == '1' {
			b--
		}
	}
	if a < 0 || b < 0 {
		return "-1"
	}

	var count int

	for i := 0; i < n/2; i++ {
		if s[i] == '0' {
			if s[n - i - 1] == '1' {
				return "-1"
			} else if s[n - i - 1] == '?' {
				if a > 0 {
					a--
				} else {
					return "-1"
				}

			}
			bts[n - i - 1] = '0'
			bts[i] = '0'

		} else if s[i] == '1' {
			if s[n - i - 1] == '0' {
				return "-1"
			} else if s[n - i - 1] == '?' {
				if b > 0 {
					b--
				} else {
					return "-1"
				}
			}
			bts[i] = '1'
			bts[n - i - 1] = '1'

		} else if s[i] == '?' {
			if s[n - i - 1] == '1' {
				if b > 0 {
					b--
				} else {
					return "-1"
				}
				bts[i] = '1'
				bts[n - i - 1] = '1'

			} else if s[n - i - 1] == '0' {
				if a > 0 {
					a--
				} else {
					return "-1"
				}
				bts[i] = '0'
				bts[n - i - 1] = '0'

			} else if s[n - i - 1] == '?' {
				count++
				bts[i] = '?'
				bts[n - i - 1] = '?'

			} else {
				panic("unkown2")
			}

		} else {
			panic("unknown")
		}
	}

	if n % 2 == 1 {
		if s[n/2] == '?' {
			if aInit % 2 == 1 && a > 0 {
				a--
				bts[n/2] = '0'
			} else if bInit % 2 == 1 && b > 0 {
				b--
				bts[n/2] = '1'
			}
		} else {
			bts[n/2] = s[n/2]
		}
	}

	if a + b >= 2 * count {

		for i := 0; i < n/2; i++ {
			if bts[i] == '?' {
				if a >= 2 {
					bts[i] = '0'
					bts[n - i - 1] = '0'
					a-=2
				} else if b >= 2 {
					bts[i] = '1'
					bts[n - i - 1] = '1'
					b-=2
				}
			}
		}

	} else {
		return "-1"
	}

	return string(bts)
}

package main

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

func main() {

	r := bufio.NewReader(os.Stdin)

	var t int

	fmt.Fscan(r, &t)

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

		var a, b int

		fmt.Fscan(r, &a, &b)

		var s string

		fmt.Fscan(r, &s)

		ans := solve(s, a, b)

		fmt.Println(ans)
	}
}

func solve(s string, a, b int) string {
	if a % 2 == 1 && b % 2 == 1 {
		return "-1"
	}
	n := len(s)
	bts := make([]byte, n)

	if n % 2 == 1 {
		if s[n/2] == '?' {
			if a % 2 == 1 && a > 0 {
				a--
				bts[n/2] = '0'
			} else if b % 2 == 1 && b > 0 {
				b--
				bts[n/2] = '1'
			}
		} else {
			bts[n/2] = s[n/2]
		}
	}

	for i := 0; i < n; i++ {
		if s[i] == '0' {
			a--
		} else if s[i] == '1' {
			b--
		}
	}
	if a < 0 || b < 0 {
		return "-1"
	}

	var count int

	for i := 0; i < n/2; i++ {
		if s[i] == '0' {
			if s[n - i - 1] == '1' {
				return "-1"
			} else if s[n - i - 1] == '?' {
				if a > 0 {
					a--
				} else {
					return "-1"
				}

			}
			bts[n - i - 1] = '0'
			bts[i] = '0'

		} else if s[i] == '1' {
			if s[n - i - 1] == '0' {
				return "-1"
			} else if s[n - i - 1] == '?' {
				if b > 0 {
					b--
				} else {
					return "-1"
				}
			}
			bts[i] = '1'
			bts[n - i - 1] = '1'

		} else if s[i] == '?' {
			if s[n - i - 1] == '1' {
				if b > 0 {
					b--
				} else {
					return "-1"
				}
				bts[i] = '1'
				bts[n - i - 1] = '1'

			} else if s[n - i - 1] == '0' {
				if a > 0 {
					a--
				} else {
					return "-1"
				}
				bts[i] = '0'
				bts[n - i - 1] = '0'

			} else if s[n - i - 1] == '?' {
				count++
				bts[i] = '?'
				bts[n - i - 1] = '?'

			} else {
				panic("unkown2")
			}

		} else {
			panic("unknown")
		}
	}

	if a + b >= 2 * count {

		for i := 0; i < n/2; i++ {
			if bts[i] == '?' {
				if a >= 2 {
					bts[i] = '0'
					bts[n - i - 1] = '0'
					a-=2
				} else if b >= 2 {
					bts[i] = '1'
					bts[n - i - 1] = '1'
					b-=2
				}
			}
		}

	} else {
		return "-1"
	}

	return string(bts)
}

package main

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

func main() {

	r := bufio.NewReader(os.Stdin)

	var t int

	fmt.Fscan(r, &t)

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

		var a, b int

		fmt.Fscan(r, &a, &b)

		var s string

		fmt.Fscan(r, &s)

		ans := solve(s, a, b)

		fmt.Println(ans)
	}
}

func solve(s string, a, b int) string {
	if a % 2 == 1 && b % 2 == 1 {
		return "-1"
	}
	n := len(s)
	bts := make([]byte, n)

	for i := 0; i < n; i++ {
		if s[i] == '0' {
			a--
		} else if s[i] == '1' {
			b--
		}
	}
	if a < 0 || b < 0 {
		return "-1"
	}

	var count int

	for i := 0; i < n/2; i++ {
		if s[i] == '0' {
			if s[n - i - 1] == '1' {
				return "-1"
			} else if s[n - i - 1] == '?' {
				if a > 0 {
					a--
				} else {
					return "-1"
				}

			}
			bts[n - i - 1] = '0'
			bts[i] = '0'

		} else if s[i] == '1' {
			if s[n - i - 1] == '0' {
				return "-1"
			} else if s[n - i - 1] == '?' {
				if b > 0 {
					b--
				} else {
					return "-1"
				}
			}
			bts[i] = '1'
			bts[n - i - 1] = '1'

		} else if s[i] == '?' {
			if s[n - i - 1] == '1' {
				if b > 0 {
					b--
				} else {
					return "-1"
				}
				bts[i] = '1'
				bts[n - i - 1] = '1'

			} else if s[n - i - 1] == '0' {
				if a > 0 {
					a--
				} else {
					return "-1"
				}
				bts[i] = '0'
				bts[n - i - 1] = '0'

			} else if s[n - i - 1] == '?' {
				count++
				bts[i] = '?'
				bts[n - i - 1] = '?'

			} else {
				panic("unkown2")
			}

		} else {
			panic("unknown")
		}
	}

	if n % 2 == 1 {
		if s[n/2] == '?' {
			if a % 2 == 1 && a > 0 {
				a--
				bts[n/2] = '0'
			} else if b % 2 == 1 && b > 0 {
				b--
				bts[n/2] = '1'
			}
		} else {
			bts[n/2] = s[n/2]
		}
	}

	if a + b >= 2 * count {

		for i := 0; i < n/2; i++ {
			if bts[i] == '?' {
				if a >= 2 {
					bts[i] = '0'
					bts[n - i - 1] = '0'
					a-=2
				} else if b >= 2 {
					bts[i] = '1'
					bts[n - i - 1] = '1'
					b-=2
				}
			}
		}

	} else {
		return "-1"
	}

	return string(bts)
}

package main

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

func main() {

	r := bufio.NewReader(os.Stdin)

	var t int

	fmt.Fscan(r, &t)

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

		var a, b int

		fmt.Fscan(r, &a, &b)

		var s string

		fmt.Fscan(r, &s)

		ans := solve(s, a, b)

		fmt.Println(ans)
	}
}

func solve(s string, a, b int) string {
	if a % 2 == 1 && b % 2 == 1 {
		return "-1"
	}
	n := len(s)
	bts := make([]byte, n)

	for i := 0; i < n; i++ {
		if s[i] == '0' {
			a--
		} else if s[i] == '1' {
			b--
		}
	}
	if a < 0 || b < 0 {
		return "-1"
	}

	var count int

	for i := 0; i < n/2; i++ {
		if s[i] == '0' {
			if s[n - i - 1] == '1' {
				return "-1"
			} else if s[n - i - 1] == '?' {
				if a > 0 {
					a--
				} else {
					return "-1"
				}

			}
			bts[n - i - 1] = '0'
			bts[i] = '0'

		} else if s[i] == '1' {
			if s[n - i - 1] == '0' {
				return "-1"
			} else if s[n - i - 1] == '?' {
				if b > 0 {
					b--
				} else {
					return "-1"
				}
			}
			bts[i] = '1'
			bts[n - i - 1] = '1'

		} else if s[i] == '?' {
			if s[n - i - 1] == '1' {
				if b > 0 {
					b--
				} else {
					return "-1"
				}
				bts[i] = '1'
				bts[n - i - 1] = '1'

			} else if s[n - i - 1] == '0' {
				if a > 0 {
					a--
				} else {
					return "-1"
				}
				bts[i] = '0'
				bts[n - i - 1] = '0'

			} else if s[n - i - 1] == '?' {
				count++
				bts[i] = '?'
				bts[n - i - 1] = '?'

			} else {
				panic("unkown2")
			}

		} else {
			panic("unknown")
		}
	}

	if n % 2 == 1 {
		if s[n/2] == '?' {
			if a % 2 == 1 && a > 0 {
				a--
				bts[n/2] = '0'
			} else if b % 2 == 1 && b > 0 {
				b--
				bts[n/2] = '1'
			}
		} else {
			bts[n/2] = s[n/2]
		}
	}

	if a + b >= 2 * count {

		for i := 0; i < n/2; i++ {
			if bts[i] == '?' {
				if a >= 2 {
					bts[i] = '0'
					bts[n - i - 1] = '0'
				} else if b >= 2 {
					bts[i] = '1'
					bts[n - i - 1] = '1'
				}
			}
		}

	} else {
		return "-1"
	}

	return string(bts)
}

package main

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

func main() {

	r := bufio.NewReader(os.Stdin)

	var t int

	fmt.Fscan(r, &t)

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

		var a, b int

		fmt.Fscan(r, &a, &b)

		var s string

		fmt.Fscan(r, &s)

		ans := solve(s, a, b)

		fmt.Println(ans)
	}
}

func solve(s string, a, b int) string {
	if a % 2 == 1 && b % 2 == 1 {
		return "-1"
	}
	n := len(s)
	bts := make([]byte, n)

	if a % 2 == 1 {
		if s[n/2] == '1'{
			return "-1"
		} else if s[n/2] == '?' {
			a--
		}
		bts[n/2] = '0'

	} else if b % 2 == 1 {
		if s[n/2] == '0'{
			return "-1"
		} else if s[n/2] == '?' {
			b--
		}
		bts[n/2] = '1'
	}

	for i := 0; i < len(s); i++ {
		if s[i] == '0' {
			a--
		} else if s[i] == '1' {
			b--
		}
	}

	for i := 0; i < len(s)/2; i++ {
		if s[i] == '0' {
			if s[n - i - 1] == '1' {
				return "-1"
			} else if s[n - i - 1] == '?' {
				a--
			}
			bts[n - i - 1] = '0'
			bts[i] = '0'

		} else if s[i] == '1' {
			if s[n - i - 1] == '0' {
				return "-1"
			} else if s[n - i - 1] == '?' {
				b--
			}
			bts[n - i - 1] = '1'
			bts[i] = '1'

		} else if s[i] == '?' {

			if s[n - i - 1] == '0' && a >= 1 {
				bts[i] = '0'
				bts[n - i - 1] = '0'
				a --
			} else if s[n - i - 1] == '1' && b >= 1 {
				bts[i] = '1'
				bts[n - i - 1] = '1'
				b --

			 } else if s[n - i - 1] == '?' {
			 	if a >= 2 {
					bts[i] = '0'
					bts[n - i - 1] = '0'
					a -=2
				} else if b >= 2 {
					bts[i] = '1'
					bts[n - i - 1] = '1'
					b -= 2
				} else {
					return "-1"
				}

			 } else {
			 	return "-1"
			}

		} else {
			panic("asd")
		}
	}
	return string(bts)
}

package main

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

func main() {

	r := bufio.NewReader(os.Stdin)

	var t int

	fmt.Fscan(r, &t)

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

		var a, b int

		fmt.Fscan(r, &a, &b)

		var s string

		fmt.Fscan(r, &s)

		ans := solve(s, a, b)

		fmt.Println(ans)
	}
}

func solve(s string, a, b int) string {
	if a % 2 == 1 && b % 2 == 1 {
		return "-1"
	}
	n := len(s)
	bts := make([]byte, n)

	if a % 2 == 1 {
		if s[n/2] == '1'{
			return "-1"
		} else if s[n/2] == '?' {
			a--
		}
		bts[n/2] = '0'

	} else if b % 2 == 1 {
		if s[n/2] == '0'{
			return "-1"
		} else if s[n/2] == '?' {
			b--
		}
		bts[n/2] = '1'
	}

	for i := 0; i < len(s); i++ {
		if s[i] == '0' {
			a--
		} else if s[i] == '1' {
			b--
		}
	}

	for i := 0; i < len(s)/2; i++ {
		if s[i] == '0' {
			if s[n - i - 1] == '1' {
				return "-1"
			} else if s[n - i - 1] == '?' {
				a--
			}
			bts[n - i - 1] = '0'
			bts[i] = '0'

		} else if s[i] == '1' {
			if s[n - i - 1] == '0' {
				return "-1"
			} else if s[n - i - 1] == '?' {
				b--
			}
			bts[n - i - 1] = '1'
			bts[i] = '1'

		} else if s[i] == '?' {

			if s[n - i - 1] == '0' && a >= 2 {
				bts[i] = '0'
				bts[n - i - 1] = '0'
				a --
			} else if s[n - i - 1] == '1' && b >= 2 {
				bts[i] = '1'
				bts[n - i - 1] = '1'
				b --

			 } else if s[n - i - 1] == '?' {
			 	if a >= 2 {
					bts[i] = '0'
					bts[n - i - 1] = '0'
					a -=2
				} else if b >= 2 {
					bts[i] = '1'
					bts[n - i - 1] = '1'
					b -= 2
				} else {
					return "-1"
				}

			 } else {
			 	return "-1"
			}

		} else {
			panic("asd")
		}
	}
	return string(bts)
}

package main

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

func main() {

	r := bufio.NewReader(os.Stdin)

	var t int

	fmt.Fscan(r, &t)

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

		var a, b int

		fmt.Fscan(r, &a, &b)

		var s string

		fmt.Fscan(r, &s)

		ans := solve(s, a, b)

		fmt.Println(ans)
	}
}

func solve(s string, a, b int) string {
	if a % 2 == 1 && b % 2 == 1 {
		return "-1"
	}
	n := len(s)
	bts := make([]byte, n)

	if a % 2 == 1 {
		bts[n/2] = '0'
		a--

	} else if b % 2 == 1 {
		bts[n/2] = '1'
		b--
	}

	for i := 0; i < len(s); i++ {
		if s[i] == '0' {
			bts[n - i - 1] = '0'
			bts[i] = '0'
			a-=2
		} else if s[i] == '1' {
			bts[n - i - 1] = '1'
			bts[i] = '1'
			b-=2
		} else if s[i] == '?' {
			if b >= 2 {
				bts[i] = '1'
				bts[n - i - 1] = '1'
				b -= 2

			} else if a >= 2 {
				bts[i] = '0'
				bts[n - i - 1] = '0'
				a -=2
			}

		} else {
			panic("asd")
		}
	}
	return string(bts)
}

package main

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

func main() {

	r := bufio.NewReader(os.Stdin)

	var t int

	fmt.Fscan(r, &t)

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

		var a, b int

		fmt.Fscan(r, &a, &b)

		var s string

		fmt.Fscan(r, &s)

		ans := solve(s, a, b)

		fmt.Println(ans)
	}
}

func solve(s string, a, b int) string {
	if a % 2 == 1 && b % 2 == 1 {
		return "-1"
	}
	n := len(s)
	bts := make([]byte, n)

	if a % 2 == 1 {
		bts[n/2] = '0'
		a--

	} else if b % 2 == 1 {
		bts[n/2] = '1'
		b--
	}

	for i := 0; i < len(s); i++ {
		if s[i] == '0' {
			bts[n - i - 1] = '0'
			bts[i] = '0'
			a--
		} else if s[i] == '1' {
			bts[n - i - 1] = '1'
			bts[i] = '1'
			b--
		} else if s[i] == '?' {
			if b >= 2 {
				bts[i] = '1'
				bts[n - i - 1] = '1'
				b -= 2

			} else if a >= 2 {
				bts[i] = '0'
				bts[n - i - 1] = '0'
				a -=2
			}

		} else {
			panic("asd")
		}
	}
	return string(bts)
}

package main

import "fmt"

func genPalindrome(str string, nOnes, nZeros int) (bool, string) {
	lastPos := len(str) - 1
	if nOnes < 0 || nZeros < 0 {
		return false, ""
	}
	if len(str) == 0 {
		if nOnes == 0 && nZeros == 0 {
			return true, ""
		} else {
			return false, ""
		}
	}
	if str[0] != str[lastPos] {
		return false, ""
	}
	if len(str) == 1 {
		if nOnes == 1 && nZeros == 0 && (str[0] == '?' || str[0] == '1') {
			return true, "1"
		} else if nZeros == 1 && nOnes == 0 && (str[0] == '?' || str[0] == '0') {
			return true, "0"
		}
		return false, ""
	}
	if str[0] == '?' {
		if nZeros > nOnes {
			if ok, zeros := genPalindrome(str[1:len(str)-1], nOnes, nZeros-2); ok {
				return true, "0" + zeros + "0"
			}
		} else {
			if ok, ones := genPalindrome(str[1:len(str)-1], nOnes-2, nZeros); ok {
				return true, "1" + ones + "1"
			}
		}

	} else if str[0] == '1' {
		if ok, ones := genPalindrome(str[1:len(str)-1], nOnes, nZeros); ok {
			return true, "1" + ones + "1"
		}
	} else {
		if ok, zeros := genPalindrome(str[1:len(str)-1], nOnes, nZeros); ok {
			return true, "0" + zeros + "0"
		}
	}
	return false, ""
}

func fixString(str string) string {
	if len(str) < 2 {
		return str
	}
	lastPos := len(str) - 1
	start, end := string(str[0]), string(str[lastPos])
	if str[0] == '?' {
		return end + fixString(str[1:lastPos]) + end
	}
	if str[len(str)-1] == '?' {
		return start + fixString(str[1:lastPos]) + start
	}
	return start + fixString(str[1:lastPos]) + end
}

func possibleWildcards(nOnes, nZeros int, str string) (int, int) {
	for _, v := range str {
		if v == '0' {
			nZeros--
		} else if v == '1' {
			nOnes--
		}
	}
	return nOnes, nZeros
}

func main() {
	var nTests int
	fmt.Scanf("%d\n", &nTests)
	for i := 0; i < nTests; i++ {
		var nZeros, nOnes int
		fmt.Scanf("%d %d\n", &nZeros, &nOnes)
		var str string
		fmt.Scanf("%s\n", &str)
		str = fixString(str)
		ok, palindrome := genPalindrome(str, nOnes, nZeros)
		if !ok {
			palindrome = "-1"
		}
		fmt.Println(palindrome)
	}
}

package main

import "fmt"

func genPalindrome(str string, nOnes, nZeros int) (bool, string) {
	if len(str) == 0 {
		if nOnes == 0 && nZeros == 0 {
			return true, ""
		} else {
			return false, ""
		}
	}
	if len(str) == 1 {
		if nOnes == 1 && nZeros == 0 && (str[0] == '?' || str[0] == '1') {
			return true, "1"
		} else if nZeros == 1 && nOnes == 0 && (str[0] == '?' || str[0] == '1') {
			return true, "0"
		}
		return false, ""
	}
	if str[0] != '?' && str[len(str)-1] != '?' && str[0] != str[len(str)-1] {
		return false, ""
	}
	if str[0] == '?' {
		if str[len(str)-1] == '?' {
			if ok, zeros := genPalindrome(str[1:len(str)-1], nOnes, nZeros-2); ok {
				return true, "0" + zeros + "0"
			}
			if ok, ones := genPalindrome(str[1:len(str)-1], nOnes-2, nZeros); ok {
				return true, "1" + ones + "1"
			}
		} else {
			if str[len(str)-1] == '1' {
				if ok, ones := genPalindrome(str[1:len(str)-1], nOnes-2, nZeros); ok {
					return true, "1" + ones + "1"
				}
			} else {
				if ok, zeros := genPalindrome(str[1:len(str)-1], nOnes, nZeros-2); ok {
					return true, "0" + zeros + "0"
				}
			}
		}
	} else if str[0] == '1' {
		if ok, ones := genPalindrome(str[1:len(str)-1], nOnes-2, nZeros); ok {
			return true, "1" + ones + "1"
		}
	} else {
		if ok, zeros := genPalindrome(str[1:len(str)-1], nOnes, nZeros-2); ok {
			return true, "0" + zeros + "0"
		}
	}
	return false, ""
}

func main() {
	var nTests int
	fmt.Scanf("%d\n", &nTests)
	for i := 0; i < nTests; i++ {
		var nZeros, nOnes int
		fmt.Scanf("%d %d\n", &nZeros, &nOnes)
		var str string
		fmt.Scanf("%s\n", &str)
		ok, palindrome := genPalindrome(str, nOnes, nZeros)
		if !ok {
			palindrome = "-1"
		}
		fmt.Println(palindrome)
	}
}

// 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 a, b int
		fmt.Fscan(reader, &a, &b)
		var sb string
		fmt.Fscan(reader, &sb)
		if t == 42 {
			fmt.Println(sb, a, b)
		}
		s := []byte(sb)
		for i := 0; i < len(s); i++ {
			if s[i] == '1' {
				b--
			} else if s[i] == '0' {
				a--
			}
		}
		ok := true
		i := 0
		j := len(sb) - 1
		for i <= j {
			if s[i] != '?' && s[j] != '?' {
				if s[i] != s[j] {
					ok = false
					break
				}

			} else if s[i] == '?' && s[j] == '?' {
				if i == j {
					if a > 0 {
						s[i] = '0'
						a--
					} else if b > 0 {
						s[i] = '1'
						b--
					}
				} else {
					if a > 1 {
						s[i] = '0'
						s[j] = '0'
						a -= 2
					} else if b > 1 {
						s[i] = '1'
						s[j] = '1'
						b -= 2
					}
				}
			} else {
				if s[i] == '?' {
					s[i] = s[j]
					if s[j] == '1' {
						b -= 1
					} else {
						a -= 1
					}
				} else {
					s[j] = s[i]
					if s[j] == '1' {
						b -= 1
					} else {
						a -= 1
					}
				}
			}
			i++
			j--
		}
		if a != 0 || b != 0 {
			ok = false
		}
		if ok {
			write(f, string(s), "\n")
		} else {
			write(f, "-1\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 a, b int
		fmt.Fscan(reader, &a, &b)
		var sb string
		fmt.Fscan(reader, &sb)
		if t == 42 {
			fmt.Println(sb)
		}
		s := []byte(sb)
		for i := 0; i < len(s); i++ {
			if s[i] == '1' {
				b--
			} else if s[i] == '0' {
				a--
			}
		}
		ok := true
		i := 0
		j := len(sb) - 1
		for i <= j {
			if s[i] != '?' && s[j] != '?' {
				if s[i] != s[j] {
					ok = false
					break
				}

			} else if s[i] == '?' && s[j] == '?' {
				if i == j {
					if a > 0 {
						s[i] = '0'
						a--
					} else if b > 0 {
						s[i] = '1'
						b--
					}
				} else {
					if a > 1 {
						s[i] = '0'
						s[j] = '0'
						a -= 2
					} else if b > 1 {
						s[i] = '1'
						s[j] = '1'
						b -= 2
					}
				}
			} else {
				if s[i] == '?' {
					s[i] = s[j]
					if s[j] == '1' {
						b -= 1
					} else {
						a -= 1
					}
				} else {
					s[j] = s[i]
					if s[j] == '1' {
						b -= 1
					} else {
						a -= 1
					}
				}
			}
			i++
			j--
		}
		if a != 0 || b != 0 {
			ok = false
		}
		if ok {
			write(f, string(s), "\n")
		} else {
			write(f, "-1\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 a, b int
		fmt.Fscan(reader, &a, &b)
		var sb string
		fmt.Fscan(reader, &sb)
		s := []byte(sb)
		for i := 0; i < len(s); i++ {
			if s[i] == '1' {
				b--
			} else if s[i] == '0' {
				a--
			}
		}
		ok := true
		i := 0
		j := len(sb) - 1
		for i <= j {
			if s[i] != '?' && s[j] != '?' {
				if s[i] != s[j] {
					ok = false
					break
				}

			} else if s[i] == '?' && s[j] == '?' {
				if i == j {
					if a > 0 {
						s[i] = '0'
						a--
					} else if b > 0 {
						s[i] = '1'
						b--
					}
				} else {
					if a > 1 {
						s[i] = '0'
						s[j] = '0'
						a -= 2
					} else if b > 1 {
						s[i] = '1'
						s[j] = '1'
						b -= 2
					}
				}
			} else {
				if s[i] == '?' {
					s[i] = s[j]
					if s[j] == '1' {
						b -= 1
					} else {
						a -= 1
					}
				} else {
					s[j] = s[i]
					if s[j] == '1' {
						b -= 1
					} else {
						a -= 1
					}
				}
			}
			i++
			j--
		}
		if a != 0 || b != 0 {
			ok = false
		}
		if ok {
			write(f, string(s), "\n")
		} else {
			write(f, "-1\n")
		}
	}
}

package main

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

var reader = bufio.NewReader(os.Stdin)

func ri() int {
	var x int
	c, _ := reader.ReadByte()
	for c < '0' || c > '9' {
		c, _ = reader.ReadByte()
	}
	for '0' <= c && c <= '9' {
		x = (x << 3) + (x << 1) + int(c) - '0'
		c, _ = reader.ReadByte()
	}
	return x
}

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

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

const MAXN = 2e5 + 5

type Node struct {
	x, y int
}

func Solve() {
	var n, m int
	fmt.Scan(&n, &m)
	var s string
	fmt.Scan(&s)
	t := []rune(s)
	l, r := 0, n+m-1
	for l < r {
		if t[l] != t[r] {
			if t[l] != '?' && t[r] != '?' {
				fmt.Println(-1)
				return
			} else {
				if t[l] == '?' {
					t[l] = t[r]
				} else {
					t[r] = t[l]
				}
			}
		}
		l++
		r--
	}
	l, r = 0, n+m-1
	for l <= r {
		switch {
		case t[l] == '0':
			n--
		case t[l] == '1':
			m--
		}
		if l != r {
			switch {
			case t[r] == '0':
				n--
			case t[r] == '1':
				m--
			}
		}
		l++
		r--
	}
	l, r = 0, len(t)-1
	for l <= r {
		if t[l] == '?' {
			if l == r {
				if n != 0 {
					t[l] = '0'
					n -= 1
				} else {
					t[l] = '1'
					m -= 1
				}
			} else {
				if n != 0 {
					t[l] = '0'
					t[r] = '0'
					n -= 2
				} else {
					t[l] = '1'
					t[r] = '1'
					m -= 2
				}
			}
		}
		l++
		r--
	}
	if n == 0 && m == 0 {
		fmt.Println(string(t))
	} else {
		fmt.Println(-1)
	}
}

func main() {
	var T = 0
	if T == 0 {
		fmt.Scan(&T)
	}
	for t := 1; t <= T; t++ {
		Solve()
	}
}

package main

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

type pos struct {
	i int
	j int
}

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

	solve := func() {
		var a, b int
		Fscan(in, &a, &b)
		var str []byte
		var cnt [2]int
		var empty_num []pos
		var unique_num []pos
		Fscan(in, &str)

		for l, r := 0, len(str)-1; l <= r; l, r = l+1, r-1 {
			if str[l] == '?' && str[r] == '?' {
				if l != r {
					empty_num = append(empty_num, pos{l, r})
				} else {
					unique_num = append(unique_num, pos{l, r})
				}

			} else {
				if str[l] == '?' {
					str[l] = str[r]
				} else if str[r] == '?' {
					str[r] = str[l]
				}
				if str[l] != str[r] {
					Fprintln(out, -1)
					return
				} else {
					cnt[str[l]-'0']++
					if l != r {
						cnt[str[r]-'0']++
					}
				}
			}
		}
		// Fprint(out, cnt[0], cnt[1])
		if cnt[0] > a || cnt[1] > b {
			Fprintln(out, -1)
		} else {
			for i := 0; i < (a-cnt[0])/2; i++ {
				u := empty_num[len(empty_num)-1].i
				v := empty_num[len(empty_num)-1].j
				str[u] = '0'
				str[v] = '0'
				empty_num = empty_num[:len(empty_num)-1]
			}
			for i := 0; i < (b-cnt[1])/2; i++ {
				u := empty_num[len(empty_num)-1].i
				v := empty_num[len(empty_num)-1].j
				str[u] = '1'
				str[v] = '1'
				empty_num = empty_num[:len(empty_num)-1]
			}
			if len(unique_num) == 1 {
				if len(empty_num) > 0 {
					Fprintln(out, -1)
				} else {
					if (a-cnt[0])%2 == 1 {
						str[len(str)-1] = '0'
					} else {
						str[len(str)-1] = '1'
					}

					Fprintln(out, string(str))
				}
			} else {
				if len(empty_num) > 0 {
					Fprintln(out, -1)
				} else {
					Fprintln(out, string(str))
				}
			}
		}

	}

	var T int
	Fscan(in, &T)
	for o := 0; o < T; o++ {
		solve()
	}

}

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

package main

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

type pos struct {
	i int
	j int
}

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

	solve := func() {
		var a, b int
		Fscan(in, &a, &b)
		var str []byte
		var cnt [2]int
		var empty_num []pos
		var unique_num []pos
		Fscan(in, &str)

		for l, r := 0, len(str)-1; l <= r; l, r = l+1, r-1 {
			if str[l] == '?' && str[r] == '?' {
				if l != r {
					empty_num = append(empty_num, pos{l, r})
				} else {
					unique_num = append(unique_num, pos{l, r})
				}

			} else {
				if str[l] == '?' {
					str[l] = str[r]
				} else if str[r] == '?' {
					str[r] = str[l]
				}
				if str[l] != str[r] {
					Fprintln(out, -1)
					return
				} else {
					cnt[str[l]-'0']++
					if l != r {
						cnt[str[r]-'0']++
					}
				}
			}
		}
		if cnt[0] > a && cnt[1] > b {
			Fprintln(out, -1)
		} else {
			for i := 0; i < (a-cnt[0])/2; i++ {
				u := empty_num[len(empty_num)-1].i
				v := empty_num[len(empty_num)-1].j
				str[u] = '0'
				str[v] = '0'
				empty_num = empty_num[:len(empty_num)-1]
			}
			for i := 0; i < (b-cnt[1])/2; i++ {
				u := empty_num[len(empty_num)-1].i
				v := empty_num[len(empty_num)-1].j
				str[u] = '1'
				str[v] = '1'
				empty_num = empty_num[:len(empty_num)-1]
			}
			if len(unique_num) == 1 {
				if len(empty_num) > 0 {
					Fprintln(out, -1)
				} else {
					if (a-cnt[0])%2 == 1 {
						str[len(str)-1] = '0'
					} else {
						str[len(str)-1] = '1'
					}

					Fprintln(out, string(str))
				}
			} else {
				if len(empty_num) > 0 {
					Fprintln(out, -1)
				} else {
					Fprintln(out, string(str))
				}
			}
		}

	}

	var T int
	Fscan(in, &T)
	for o := 0; o < T; o++ {
		solve()
	}

}

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

package main

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

type pos struct {
	i int
	j int
}

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

	solve := func() {
		var a, b int
		Fscan(in, &a, &b)
		var str []byte
		var cnt [2]int
		var empty_num []pos
		var unique_num []pos
		Fscan(in, &str)

		for l, r := 0, len(str)-1; l <= r; l, r = l+1, r-1 {
			if str[l] == '?' && str[r] == '?' {
				if l != r {
					empty_num = append(empty_num, pos{l, r})
				} else {
					unique_num = append(unique_num, pos{l, r})
				}

			} else {
				if str[l] == '?' {
					str[l] = str[r]
				} else if str[r] == '?' {
					str[r] = str[l]
				}
				if str[l] != str[r] {
					Fprintln(out, -1)
					return
				} else {
					cnt[str[l]-'0']++
					cnt[str[r]-'0']++
				}
			}
		}
		if cnt[0] > a && cnt[1] > b {
			Fprintln(out, -1)
		} else {
			for i := 0; i < (a-cnt[0])/2; i++ {
				u := empty_num[len(empty_num)-1].i
				v := empty_num[len(empty_num)-1].j
				str[u] = '0'
				str[v] = '0'
				empty_num = empty_num[:len(empty_num)-1]
			}
			for i := 0; i < (b-cnt[1])/2; i++ {
				u := empty_num[len(empty_num)-1].i
				v := empty_num[len(empty_num)-1].j
				str[u] = '1'
				str[v] = '1'
				empty_num = empty_num[:len(empty_num)-1]
			}
			if len(unique_num) == 1 {
				if len(empty_num) > 0 {
					Fprintln(out, -1)
				} else {
					if (a-cnt[0])%2 == 1 {
						str[len(str)-1] = '0'
					} else {
						str[len(str)-1] = '1'
					}

					Fprintln(out, string(str))
				}
			} else {
				if len(empty_num) > 0 {
					Fprintln(out, -1)
				} else {
					Fprintln(out, string(str))
				}
			}
		}

	}

	var T int
	Fscan(in, &T)
	for o := 0; o < T; o++ {
		solve()
	}

}

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

package main

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

type Scanner struct {
	bScanner *bufio.Scanner
}

func NewScanner() *Scanner {
	bScanner := bufio.NewScanner(os.Stdin)
	bScanner.Split(bufio.ScanWords)
	bScanner.Buffer([]byte{}, math.MaxInt32)
	return &Scanner{
		bScanner,
	}
}
func (s *Scanner) next() string {
	s.bScanner.Scan()
	return s.bScanner.Text()
}
func (s *Scanner) nextInt() int {
	s.bScanner.Scan()
	res, err := strconv.Atoi(s.bScanner.Text())
	if err != nil {
		panic(err)
	}
	return res
}
func (s *Scanner) nextInt64() int64 {
	s.bScanner.Scan()
	res, err := strconv.ParseInt(s.bScanner.Text(), 10, 64)
	if err != nil {
		panic(err)
	}
	return res
}
func (s *Scanner) nextFloat() float64 {
	s.bScanner.Scan()
	res, err := strconv.ParseFloat(s.bScanner.Text(), 64)
	if err != nil {
		panic(err)
	}
	return res
}
func (s *Scanner) nextInts(N int) []int {
	res := make([]int, N)
	for i := 0; i < N; i++ {
		res[i] = s.nextInt()
	}
	return res
}
func (s *Scanner) nextInt64s(N int) []int64 {
	res := make([]int64, N)
	for i := 0; i < N; i++ {
		res[i] = s.nextInt64()
	}
	return res
}
func min(nums ...int) int {
	ans := math.MaxInt32
	for _, num := range nums {
		if num < ans {
			ans = num
		}
	}
	return ans
}
func max(nums ...int) int {
	ans := math.MinInt32
	for _, num := range nums {
		if num > ans {
			ans = num
		}
	}
	return ans
}

func replace(str []byte, a int, b int) string {
	N := len(str)
	l := 0
	r := N - 1
	for l < r {
		if str[l] == '0' {
			a--
		} else if str[l] == '1' {
			b--
		}
		if str[r] == '0' {
			a--
		} else if str[r] == '1' {
			b--
		}
		if str[l] == '?' && str[r] != '?' {
			if str[r] == '0' {
				str[l] = '0'
				a--
			} else {
				str[l] = '1'
				b--
			}
		} else if str[l] != '?' && str[r] == '?' {
			if str[l] == '0' {
				str[r] = '0'
				a--
			} else {
				str[r] = '1'
				b--
			}
		}
		if a < 0 || b < 0 || str[l] != str[r] {
			return "-1"
		}
		l++
		r--
	}
	if l == r {
		if str[l] == '0' {
			a--
		} else if str[l] == '1' {
			b--
		}
		if a < 0 || b < 0 {
			return "-1"
		}
	}

	l = 0
	r = N - 1
	for l < r {
		if str[l] == '?' {
			if a > 0 {
				str[l] = '0'
				str[r] = '0'
				a -= 2
			} else {
				str[l] = '1'
				str[r] = '1'
				b -= 2
			}
		}
		if a < 0 || b < 0 {
			return "-1"
		}
		l++
		r--
	}
	if l == r && str[l] == '?' {
		if a > 0 {
			str[l] = '0'
			a--
		} else if b > 0 {
			str[l] = '1'
			b--
		} else {
			return "-1"
		}
	}
	if a > 0 || b > 0 {
		return "-1"
	}
	return string(str)
}

func main() {
	sc := NewScanner()
	wr := bufio.NewWriter(os.Stdout)
	defer wr.Flush()

	TC := sc.nextInt()
	for tc := 0; tc < TC; tc++ {
		a := sc.nextInt()
		b := sc.nextInt()
		str := []byte(sc.next())
		ans := replace(str, a, b)
		fmt.Fprintln(wr, ans)
	}

}

package main

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

type Scanner struct {
	bScanner *bufio.Scanner
}

func NewScanner() *Scanner {
	bScanner := bufio.NewScanner(os.Stdin)
	bScanner.Split(bufio.ScanWords)
	bScanner.Buffer([]byte{}, math.MaxInt32)
	return &Scanner{
		bScanner,
	}
}
func (s *Scanner) next() string {
	s.bScanner.Scan()
	return s.bScanner.Text()
}
func (s *Scanner) nextInt() int {
	s.bScanner.Scan()
	res, err := strconv.Atoi(s.bScanner.Text())
	if err != nil {
		panic(err)
	}
	return res
}
func (s *Scanner) nextInt64() int64 {
	s.bScanner.Scan()
	res, err := strconv.ParseInt(s.bScanner.Text(), 10, 64)
	if err != nil {
		panic(err)
	}
	return res
}
func (s *Scanner) nextFloat() float64 {
	s.bScanner.Scan()
	res, err := strconv.ParseFloat(s.bScanner.Text(), 64)
	if err != nil {
		panic(err)
	}
	return res
}
func (s *Scanner) nextInts(N int) []int {
	res := make([]int, N)
	for i := 0; i < N; i++ {
		res[i] = s.nextInt()
	}
	return res
}
func (s *Scanner) nextInt64s(N int) []int64 {
	res := make([]int64, N)
	for i := 0; i < N; i++ {
		res[i] = s.nextInt64()
	}
	return res
}
func min(nums ...int) int {
	ans := math.MaxInt32
	for _, num := range nums {
		if num < ans {
			ans = num
		}
	}
	return ans
}
func max(nums ...int) int {
	ans := math.MinInt32
	for _, num := range nums {
		if num > ans {
			ans = num
		}
	}
	return ans
}

func replace(str []byte, a int, b int) string {
	N := len(str)
	l := 0
	r := N - 1
	for l < r {
		if str[l] == '0' {
			a--
		} else if str[l] == '1' {
			b--
		}
		if str[r] == '0' {
			a--
		} else if str[r] == '1' {
			b--
		}
		if str[l] == '?' && str[r] != '?' {
			if str[r] == '0' {
				str[l] = '0'
				a--
			} else {
				str[l] = '1'
				b--
			}
		} else if str[l] != '?' && str[r] == '?' {
			if str[l] == '0' {
				str[r] = '0'
				a--
			} else {
				str[r] = '1'
				b--
			}
		}
		if a < 0 || b < 0 || str[l] != str[r] {
			return "-1"
		}
		l++
		r--
	}
	if l == r {
		if str[l] == '0' {
			a--
		} else if str[l] == '1' {
			b--
		}
		if a < 0 || b < 0 {
			return "-1"
		}
	}

	l = 0
	r = N - 1
	for l < r {
		if str[l] == '?' {
			if a > 0 {
				str[l] = '0'
				str[r] = '0'
				a -= 2
			} else {
				str[l] = '1'
				str[r] = '1'
				b -= 2
			}
		}
		if a < 0 || b < 0 {
			return "-1"
		}
		l++
		r--
	}
	if l == r && str[l] == '?' {
		if a > 0 {
			str[l] = '0'
			a--
		} else if b > 0 {
			str[l] = '1'
			b--
		} else {
			return "-1"
		}
	}
	return string(str)
}

func main() {
	sc := NewScanner()
	wr := bufio.NewWriter(os.Stdout)
	defer wr.Flush()

	TC := sc.nextInt()
	for tc := 0; tc < TC; tc++ {
		a := sc.nextInt()
		b := sc.nextInt()
		str := []byte(sc.next())
		ans := replace(str, a, b)
		fmt.Fprintln(wr, ans)
	}

}

package main

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

type Scanner struct {
	bScanner *bufio.Scanner
}

func NewScanner() *Scanner {
	bScanner := bufio.NewScanner(os.Stdin)
	bScanner.Split(bufio.ScanWords)
	bScanner.Buffer([]byte{}, math.MaxInt32)
	return &Scanner{
		bScanner,
	}
}
func (s *Scanner) next() string {
	s.bScanner.Scan()
	return s.bScanner.Text()
}
func (s *Scanner) nextInt() int {
	s.bScanner.Scan()
	res, err := strconv.Atoi(s.bScanner.Text())
	if err != nil {
		panic(err)
	}
	return res
}
func (s *Scanner) nextInt64() int64 {
	s.bScanner.Scan()
	res, err := strconv.ParseInt(s.bScanner.Text(), 10, 64)
	if err != nil {
		panic(err)
	}
	return res
}
func (s *Scanner) nextFloat() float64 {
	s.bScanner.Scan()
	res, err := strconv.ParseFloat(s.bScanner.Text(), 64)
	if err != nil {
		panic(err)
	}
	return res
}
func (s *Scanner) nextInts(N int) []int {
	res := make([]int, N)
	for i := 0; i < N; i++ {
		res[i] = s.nextInt()
	}
	return res
}
func (s *Scanner) nextInt64s(N int) []int64 {
	res := make([]int64, N)
	for i := 0; i < N; i++ {
		res[i] = s.nextInt64()
	}
	return res
}
func min(nums ...int) int {
	ans := math.MaxInt32
	for _, num := range nums {
		if num < ans {
			ans = num
		}
	}
	return ans
}
func max(nums ...int) int {
	ans := math.MinInt32
	for _, num := range nums {
		if num > ans {
			ans = num
		}
	}
	return ans
}

func replace(str []byte, a int, b int) string {
	N := len(str)
	l := 0
	r := N - 1
	for l < r {
		if str[l] == '0' {
			a--
		} else if str[l] == '1' {
			b--
		}
		if str[r] == '0' {
			a--
		} else if str[r] == '1' {
			b--
		}
		if str[l] == '?' && str[r] != '?' {
			if str[r] == '0' {
				str[l] = '0'
				a--
			} else {
				str[l] = '1'
				b--
			}
		} else if str[l] != '?' && str[r] == '?' {
			if str[l] == '0' {
				str[r] = '0'
				a--
			} else {
				str[r] = '1'
				b--
			}
		}
		if a < 0 || b < 0 || str[l] != str[r] {
			return "-1"
		}
		l++
		r--
	}

	l = 0
	r = N - 1
	for l < r {
		if str[l] == '?' {
			if a > 0 {
				str[l] = '0'
				str[r] = '0'
				a -= 2
			} else {
				str[l] = '1'
				str[r] = '1'
				b -= 2
			}
		}
		if a < 0 || b < 0 {
			return "-1"
		}
		l++
		r--
	}
	if l == r && str[l] == '?' {
		if a > 0 {
			str[l] = '0'
			a--
		} else if b > 0 {
			str[l] = '1'
			b--
		} else {
			return "-1"
		}
	}
	return string(str)
}

func main() {
	sc := NewScanner()
	wr := bufio.NewWriter(os.Stdout)
	defer wr.Flush()

	TC := sc.nextInt()
	for tc := 0; tc < TC; tc++ {
		a := sc.nextInt()
		b := sc.nextInt()
		str := []byte(sc.next())
		ans := replace(str, a, b)
		fmt.Fprintln(wr, ans)
	}

}


package main

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

func I(i interface{}, delim string) error {
	_, err := fmt.Fscanf(r, "%v"+delim, i)
	return err
}

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

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

func init() {
	if f, err := os.Open("in.txt"); err == nil {
		r = bufio.NewReader(f)
	} else {
		r = bufio.NewReader(os.Stdin)
	}
	w = bufio.NewWriter(os.Stdout)
}

func main() {
	defer w.Flush()
	var n int
	for I(&n, "\n") == nil {
		solve(n)
	}
}

func solve(n int) {
	var s string
	I(&s, "\n")
	var R, D []int
	for i, c := range s {
		if c == 'R' {
			R = append(R, i)
		} else if c == 'D' {
			D = append(D, i)
		}
	}
	for len(D) > 0 && len(R) > 0 {
		if D[0] < R[0] {
			D = append(D[1:], D[0]+n)
			R = R[1:]
		} else {
			R = append(R[1:], R[0]+n)
			D = D[1:]
		}
	}
	if len(D) > 0 {
		O("D", "\n")
	} else {
		O("R", "\n")
	}
}

package main

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

func main() {

	b, _ := ioutil.ReadAll(os.Stdin)
	r := bytes.NewReader(b)

	var n int
	var str string
	fmt.Fscanf(r, "%d\n", &n)
	fmt.Fscanf(r, "%s", &str)

	cntd, cntr := 0, 0

	for i := 0; i < len(str); i++ {
		if str[i] == 'D' {
			cntd++
		} else if str[i] == 'R' {
			cntr++
		}
	}

	//fmt.Printf("cntd = %d cntr = %d\n", cntd, cntr)

	cd, cr := 0, 0

	vis := make([]bool, n+1)

	for cntd > 0 && cntr > 0 {
		for i := 0; i < len(str); i++ {
			if str[i] == 'D' && !vis[i] {
				if cd <= 0 {
					cntr = cntr - 1
					cr++
				} else {
					cd = cd - 1
					vis[i] = true
				}
			} else if str[i] == 'R' && !vis[i] {
				if cr <= 0 {
					cntd = cntd - 1
					cd++
				} else {
					cr = cr - 1
					vis[i] = true
				}
			}
			if cntd <= 0 || cntr <= 0 {
				break
			}
		}
	}

	if cntr > 0 {
		fmt.Printf("R\n")
	} else {
		fmt.Printf("D\n")
	}
}

package main

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

func I(i interface{}, delim string) error {
	_, err := fmt.Fscanf(r, "%v"+delim, i)
	return err
}

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

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

func init() {
	if f, err := os.Open("in.txt"); err == nil {
		r = bufio.NewReader(f)
	} else {
		r = bufio.NewReader(os.Stdin)
	}
	w = bufio.NewWriter(os.Stdout)
}

func main() {
	defer w.Flush()
	var n int
	for I(&n, "\n") == nil {
		solve(n)
	}
}

func solve(n int) {
	var s string
	I(&s, "\n")
	var R, D []int
	for i, c := range s {
		if c == 'R' {
			R = append(R, i)
		} else if c == 'D' {
			D = append(D, i)
		}
	}
	o := 0
	for len(D) > 0 && len(R) > 0 {
		if D[0] < R[0] {
			o++
		} else if D[0] > R[0] {
			o--
		}
		R = R[1:]
		D = D[1:]
	}
	o += len(D)
	o -= len(R)
	if o > 0 {
		O("D", "\n")
	} else {
		O("R", "\n")
	}
}

package main

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

func I(i interface{}, delim string) error {
	_, err := fmt.Fscanf(r, "%v"+delim, i)
	return err
}

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

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

func init() {
	if f, err := os.Open("in.txt"); err == nil {
		r = bufio.NewReader(f)
	} else {
		r = bufio.NewReader(os.Stdin)
	}
	w = bufio.NewWriter(os.Stdout)
}

func main() {
	defer w.Flush()
	var n int
	for I(&n, "\n") == nil {
		solve(n)
	}
}

func solve(n int) {
	var s string
	I(&s, "\n")
	var R, D []int
	for i, c := range s {
		if c == 'R' {
			R = append(R, i)
		} else if c == 'D' {
			D = append(D, i)
		}
	}
	o := 0
	for len(D) > 0 && len(R) > 0 {
		if D[0] < R[0] {
			o++
		} else if D[0] > R[0] {
			o--
		}
		R = R[1:]
		D = D[1:]
	}
	o += len(D) - len(R)
	if o > 0 || (len(D) > 0 && o == 0) {
		O("D", "\n")
	} else {
		O("R", "\n")
	}
}

package main

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

func I(i interface{}, delim string) error {
	_, err := fmt.Fscanf(r, "%v"+delim, i)
	return err
}

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

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

func init() {
	if f, err := os.Open("in.txt"); err == nil {
		r = bufio.NewReader(f)
	} else {
		r = bufio.NewReader(os.Stdin)
	}
	w = bufio.NewWriter(os.Stdout)
}

func main() {
	defer w.Flush()
	var n int
	for I(&n, "\n") == nil {
		solve(n)
	}
}

func solve(n int) {
	var s string
	I(&s, "\n")
	var R, D int
	for _, c := range s {
		if c == 'D' {
			D++
			if D > 0 {
				R--
			}
		} else if c == 'R' {
			R++
			if R > 0 {
				D--
			}
		}
	}
	if R > D {
		O("R", "\n")
	} else {
		O("D", "\n")
	}
}

package main

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

func main() {

	b, _ := ioutil.ReadAll(os.Stdin)
	r := bytes.NewReader(b)

	var n int
	var str string
	fmt.Fscanf(r, "%d\n", &n)
	fmt.Fscanf(r, "%s", &str)

	cntd, cntr := 0, 0

	for i := 0; i < len(str); i++ {
		if str[i] == 'D' {
			cntd++
		} else if str[i] == 'R' {
			cntr++
		}
	}

	//fmt.Printf("cntd = %d cntr = %d\n", cntd, cntr)

	cd, cr := 0, 0

	for cntd > 0 && cntr > 0 {
		for i := 0; i < len(str); i++ {
			if str[i] == 'D' {
				if cd <= 0 {
					cntr = cntr - 1
					cr++
				} else {
					cd = cd - 1
				}
			} else if str[i] == 'R' {
				if cr <= 0 {
					cntd = cntd - 1
					cd++
				} else {
					cr = cr - 1
				}
			}
		}
	}

	if cntr > 0 {
		fmt.Printf("R\n")
	} else {
		fmt.Printf("D\n")
	}
}

package main

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

func main() {

	b, _ := ioutil.ReadAll(os.Stdin)
	r := bytes.NewReader(b)

	var n int
	var str string
	fmt.Fscanf(r, "%d\n", &n)
	fmt.Fscanf(r, "%s", &str)

	cntd, cntr := 0, 0

	for i := 0; i < len(str); i++ {
		if str[i] == 'D' {
			cntd++
		} else if str[i] == 'R' {
			cntr++
		}
	}

	//fmt.Printf("cntd = %d cntr = %d\n", cntd, cntr)

	cd, cr := 0, 0

	for cntd > 0 && cntr > 0 {
		for i := 0; i < len(str); i++ {
			if str[i] == 'D' {
				if cd <= 0 {
					cntr = cntr - 1
					cr++
				} else {
					cd = cd - 1
				}
			} else if str[i] == 'R' {
				if cr <= 0 {
					cntd = cntd - 1
					cd++
				} else {
					cr = cr - 1
				}
			}
			if cntd <= 0 || cntr <= 0 {
				break
			}
		}
	}

	if cntr > 0 {
		fmt.Printf("R\n")
	} else {
		fmt.Printf("D\n")
	}
}