You are given a string $$$s$$$ consisting of the characters '0', '1', and '?'. You need to replace all the characters with '?' in the string $$$s$$$ by '0' or '1' so that the string becomes a palindrome and has exactly $$$a$$$ characters '0' and exactly $$$b$$$ characters '1'. Note that each of the characters '?' is replaced independently from the others.A string $$$t$$$ of length $$$n$$$ is called a palindrome if the equality $$$t[i] = t[n-i+1]$$$ is true for all $$$i$$$ ($$$1 \le i \le n$$$).For example, if $$$s=$$$"01?????0", $$$a=4$$$ and $$$b=4$$$, then you can replace the characters '?' in the following ways:   "01011010";  "01100110". For the given string $$$s$$$ and the numbers $$$a$$$ and $$$b$$$, replace all the characters with '?' in the string $$$s$$$ by '0' or '1' so that the string becomes a palindrome and has exactly $$$a$$$ characters '0' and exactly $$$b$$$ characters '1'.

The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$). Then $$$t$$$ test cases follow. The first line of each test case contains two integers $$$a$$$ and $$$b$$$ ($$$0 \le a, b \le 2 \cdot 10^5$$$, $$$a + b \ge 1$$$). The second line of each test case contains the string $$$s$$$ of length $$$a+b$$$, consisting of the characters '0', '1', and '?'. It is guaranteed that the sum of the string lengths of $$$s$$$ over all test cases does not exceed $$$2 \cdot 10^5$$$.

For each test case, output:    "-1", if you can't replace all the characters '?' in the string $$$s$$$ by '0' or '1' so that the string becomes a palindrome and that it contains exactly $$$a$$$ characters '0' and exactly $$$b$$$ characters '1';  the string that is obtained as a result of the replacement, otherwise.  If there are several suitable ways to replace characters, you can output any.

"use strict";

process.stdin.resume();
process.stdin.setEncoding("utf-8");

let inputString = "";
let currentLine = 0;

process.stdin.on("data", (inputStdin) => {
  inputString += inputStdin;
});

process.stdin.on("end", () => {
  inputString = inputString
    .trim()
    .split("\n")
    .map((string) => {
      return string.trim();
    });

  main();
});

function readline() {
  return inputString[currentLine++];
}

//  Write your logic in `main`

const reverse = (palindrome) => palindrome.split("").reverse().join("");

const makePalindrome = (palindrome, counts) => {
  let newPalindrome = "";
  for (let i = 0; i < Math.ceil(palindrome.length / 2); i++) {
    let left = palindrome[i];
    let right = palindrome[palindrome.length - 1 - i];

    if (left !== right && left !== "?" && right !== "?") {
      // console.log("error: no match");
      return -1;
    }

    let character = left;

    if (left === "?") {
      left = right;
      character = right;
    }

    if (right === "?") {
      right = left;
      character = left;
    }

    newPalindrome += character;

    counts[left] -= 1;
    if (i !== palindrome.length - 1 - i) {
      counts[right] -= 1;
    }
  }

  if (counts["0"] < 0 || counts["1"] < 0) {
    return -1;
  }

  if (
    counts["?"] % 2 === 0 &&
    (counts["0"] % 2 !== 0 || counts["1"] % 2 !== 0)
  ) {
    // console.log("error: not even");
    return -1;
  }

  counts["?"] += counts["1"] + counts["0"];

  if (counts["?"] !== 0) {
    // console.log("error: not zero");
    return -1;
  }

  // console.log("looks good");

  // console.log("new", newPalindrome, counts);
  newPalindrome = newPalindrome
    .split("")
    .map((el) => {
      if (el === "?") {
        // console.log("map", counts);
        if (counts["0"] > 1) {
          counts["0"] -= 2;
          return "0";
        } else if (counts["1"] > 1) {
          counts["1"] -= 2;
          return "1";
        }

        // for a single question mark in the case with odd palindrome length
        if (counts["0"] > 0) {
          return "0";
        } else {
          return "1";
        }
      }
      return el;
    })
    .join("");

  return (
    newPalindrome +
    reverse(newPalindrome.slice(0, Math.floor(palindrome.length / 2)))
  );
};

const main = () => {
  const numberOfTestCases = 1 * readline();
  // console.log("number of test cases", numberOfTestCases);

  Array.from({ length: numberOfTestCases }).forEach(() => {
    const [zerosCount, onesCount] = readline()
      .split(" ")
      .map((el) => +el);

    // console.log(zerosCount, onesCount);

    const palindrome = readline();

    // console.log(palindrome);

    const counts = {
      0: zerosCount,
      1: onesCount,
      "?": 0,
    };

    console.log(makePalindrome(palindrome, counts));
  });
};

"use strict";

process.stdin.resume();
process.stdin.setEncoding("utf-8");

let inputString = "";
let currentLine = 0;

process.stdin.on("data", (inputStdin) => {
  inputString += inputStdin;
});

process.stdin.on("end", (_) => {
  inputString = inputString
    .trim()
    .split("\n")
    .map((string) => {
      return string.trim();
    });

  main();
});

function readline() {
  return inputString[currentLine++];
}

//  Write your logic in `main`

const reverse = (palindrome) => palindrome.split("").reverse().join("");

const makePalindrome = (palindrome, counts) => {
  let newPalindrome = "";
  for (let i = 0; i < Math.ceil(palindrome.length / 2); i++) {
    let left = palindrome[i];
    let right = palindrome[palindrome.length - 1 - i];

    if (left !== right && left !== "?" && right !== "?") {
      // console.log("error: no match");
      return -1;
    }

    let character = left;

    if (left === "?") {
      left = right;
      character = right;
    }

    if (right === "?") {
      right = left;
      character = left;
    }

    newPalindrome += character;

    counts[left] -= 1;
    if (i !== palindrome.length - 1 - i) {
      counts[right] -= 1;
    }
  }

  if (counts["0"] < 0 || counts["1"] < 0) {
    return -1;
  }

  if (counts["?"] % 2 === 0) {
    if (counts["0"] % 2 !== 0 || counts["1"] % 2 !== 0) {
      // console.log("error: not even");
      return -1;
    }
  }

  counts["?"] += counts["1"] + counts["0"];

  if (counts["?"] !== 0) {
    // console.log("error: not zero");
    return -1;
  }

  // console.log("looks good");

  // console.log("new", newPalindrome, counts);
  newPalindrome = newPalindrome
    .split("")
    .map((el) => {
      if (el === "?") {
        // console.log("map", counts);
        if (counts["0"] > 1) {
          counts["0"] -= 2;
          return "0";
        } else if (counts["1"] > 1) {
          counts["1"] -= 2;
          return "1";
        }

        // for a single question mark in the case with odd palindrome length
        if (counts["0"] > 0) {
          return "0";
        } else {
          return "1";
        }
      }
      return el;
    })
    .join("");

  return (
    newPalindrome +
    reverse(newPalindrome.slice(0, Math.floor(palindrome.length / 2)))
  );
};

const main = () => {
  const numberOfTestCases = 1 * readline();
  // console.log("number of test cases", numberOfTestCases);

  Array.from({ length: numberOfTestCases }).forEach(() => {
    const [zerosCount, onesCount] = readline()
      .split(" ")
      .map((el) => +el);

    // console.log(zerosCount, onesCount);

    const palindrome = readline();

    // console.log(palindrome);

    const counts = {
      0: zerosCount,
      1: onesCount,
      "?": 0,
    };

    console.log(makePalindrome(palindrome, counts));
  });
};

"use strict";

process.stdin.resume();
process.stdin.setEncoding("utf-8");

let inputString = "";
let currentLine = 0;

process.stdin.on("data", (inputStdin) => {
  inputString += inputStdin;
});

process.stdin.on("end", (_) => {
  inputString = inputString
    .trim()
    .split("\n")
    .map((string) => {
      return string.trim();
    });

  main();
});

function readline() {
  return inputString[currentLine++];
}

//  Write your logic in `main`

const reverse = (palindrome) => palindrome.split("").reverse().join("");

const isPalindrome = (palindrome, counts) => {
  let newPalindrome = "";
  for (let i = 0; i < Math.ceil(palindrome.length / 2); i++) {
    let left = palindrome[i];
    let right = palindrome[palindrome.length - 1 - i];

    if (left !== right && left !== "?" && right !== "?") {
      // console.log("error: no match");
      return -1;
    }

    let character = left;

    if (left === "?") {
      left = right;
      character = right;
    }

    if (right === "?") {
      right = left;
      character = left;
    }

    newPalindrome += character;

    counts[left] -= 1;
    if (i !== palindrome.length - 1 - i) {
      counts[right] -= 1;
    }
  }

  if (counts["0"] < 0 || counts["1"] < 0) {
    return -1;
  }

  if (counts["?"] % 2 === 0) {
    if (counts["0"] % 2 !== 0 || counts["1"] % 2 !== 0) {
      // console.log("error: not even");
      return -1;
    }
  }

  counts["?"] += counts["1"] + counts["0"];

  if (counts["?"] !== 0) {
    // console.log("error: not zero");
    return -1;
  }

  // console.log("looks good");

  // console.log("new", newPalindrome, counts);
  newPalindrome = newPalindrome
    .split("")
    .map((el) => {
      if (el === "?") {
        // console.log("map", counts);
        if (counts["0"] > 1) {
          counts["0"] -= 2;
          return "0";
        } else if (counts["1"] > 1) {
          counts["1"] -= 2;
          return "1";
        }

        if (counts["0"] > 0) {
          return "0";
        } else {
          return "1";
        }
      }
      return el;
    })
    .join("");

  return (
    newPalindrome +
    reverse(newPalindrome.slice(0, Math.floor(palindrome.length / 2)))
  );
};

const main = () => {
  const numberOfTestCases = 1 * readline();
  // console.log("number of test cases", numberOfTestCases);

  Array.from({ length: numberOfTestCases }).forEach(() => {
    const [zerosCount, onesCount] = readline()
      .split(" ")
      .map((el) => +el);

    // console.log(zerosCount, onesCount);

    let palindrome = readline();

    // console.log(palindrome);

    const counts = {
      0: zerosCount,
      1: onesCount,
      "?": 0,
    };

    console.log(isPalindrome(palindrome, counts));
  });
};

//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
	input: process.stdin, output: process.stdout
});
var obj; var inLine = []; var outputList = [];var retcode = new Set();
read.on('line', function(input){
	var tmp = input.split(' ');
	for(var i = 0; i < tmp.length; i++){
		inLine.push(tmp[i]);
		if(i == tmp.length - 1){
			retcode.add(inLine.length);
		}
	}
});
read.on('close', function(){
	obj = init(inLine);
	console.error('\n↑入力 ↓出力');
	Main();
	console.log(myconv(outputList, 9));
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextArray(size, code){
	var ret = new Array(size);
	for(var i = 0; i < size; i++){
		if(code == 'int'){
			ret[i] = nextInt();
		}else{
			ret[i] = next();
		}
	}
	return ret;
}
function nextIntArray(size){return nextArray(size, 'int');} function nextStrArray(size){return nextArray(size, 'str');}
function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();} function nextInt(){return myconv(next(),1);}
function getCountMap(list){
	var map = {};
	for(var i = 0; i < list.length; i++){
		if(map[list[i]] == null){
			map[list[i]] = 0;
		}
		map[list[i]]++;
	}
	return map;
}
function init(input){
	return {
		list : input, index : 0, max : input.length,
		hasNext : function(){return (this.index < this.max);},
		next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException ‚There is no more input';}},
		isReturn : function(){return retcode.has(this.index);}
	};
}
function myout(s){outputList.push(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
function isReturn(){return obj.isReturn();}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
	var t = nextInt();
	for(var i = 0; i < t; i++){
		var A = nextInt();
		var B = nextInt();
		var s = nextCharArray();
		var N = s.length;
		var isOK = true;
		for(var j = 0; j < N / 2; j++){
			if(s[j] == s[N - 1 - j]){
				if(s[j] == "0"){
					if(j == Math.ceil(N / 2) - 1 && N % 2 == 1){
						A--;
					}else{
						A -= 2;
					}
				}else if(s[j] == "1"){
					if(j == Math.ceil(N / 2) - 1 && N % 2 == 1){
						B--;
					}else{
						B -= 2;
					}
				}
			}else{
				if(s[j] == "?"){
					if(s[N - 1 - j] == "1"){
						s[j] = "1";
						B -= 2;
					}else{
						s[j] = "0";
						A -= 2;
					}
				}else if(s[N - 1 - j] == "?"){
					if(s[j] == "1"){
						s[N - 1 - j] = "1";
						B -= 2;
					}else{
						s[N - 1 - j] = "0";
						A -= 2;
					}
				}else{
					isOK = false;
				}
			}
		}
		for(var j = 0; j < N / 2; j++){
			if(s[j] == "?" && s[N - 1 - j] == "?"){
				if(A > 0){
					if(j == Math.ceil(N / 2) - 1 && N % 2 == 1){
						s[j] = "0";
						A--;
					}else if(A > 1){
						s[j] = "0";
						s[N - 1 - j] = "0";
						A -= 2;
					}
				}
			}
		}
		for(var j = 0; j < N / 2; j++){
			if(s[j] == "?" && s[N - 1 - j] == "?"){
				if(B > 0){
					if(j == Math.ceil(N / 2) - 1 && N % 2 == 1){
						s[j] = "1";
						B--;
					}else if(B > 1){
						s[j] = "1";
						s[N - 1 - j] = "1";
						B -= 2;
					}
				}else{
					isOK = false;
				}
			}

		}
		for(var j = 0; j < N / 2; j++){
			if(s[j] != s[N - 1 - j] || s[j] == "?" || s[N - 1 - j] == "?"){
				isOK = false;
			}
		}
		if(A < 0 || B < 0){
			isOK = false;
		}
		if(isOK){
			myout(myconv(s, 0));
		}else{
			myout(-1);
		}
	}
}

process.stdin.resume();

process.stdin.setEncoding('utf8');

var input = '';

process.stdin.on('data' , data=>{
    input += data;
});
process.stdin.on('end' , ()=>{
    main(input);
});

function main(input) {
    input = input.split("\n");
    let z = 0;
    let testCases = +input[z++];

    while(testCases--){
        let [a , b] = input[z++].split(' ');
        let str = input[z++].split('');
        let n = +a + +b;
        if(n % 2 === 0){
            if((a % 2 == 1) || (b % 2 == 1)){
                console.log(-1);
                continue;
            }
        }
        if(n % 2 === 1){
            if( (str[(n-1)/2]) == 0 && (a % 2 == 0)){
                console.log(-1);
                continue;
            }
            if( (str[(n-1)/2]) == 1 && (b % 2 == 0)){
                console.log(-1);
                continue;
            }
        }
        let flag = false;
        for (let i = 0; i < n; i++) {
            if(str[i] != "?" && str[n - i - 1] != "?"){
                if(str[i] != str[n - i - 1]){
                    console.log(-1);
                    flag = true;
                    break;
                }
            }
        }
        if(flag) continue
        let c = 0;
        let d = 0;
        for (let i = 0; i < n; i++) {
            if(str[i] == "?" && str[n-i-1] != "?"){
                str[i] = str[n-i-1];
            }
        }
        for (let i = 0; i < n; i++) {
            if(str[i] != "?" && str[n-i-1] == "?"){
                str[n-i-1] = str[i];
            }
        }
        for (let i = 0; i < n; i++) {
            if(str[i] == '0') c++;
            if(str[i] == '1') d++;
        }
        if(c > a || d > b){
            console.log(-1);
            continue;
        }
        let x = a - c;
        let  y = b - d;
        for (let i = 0; i < n; i++)
        {
            if (str[i] == '?' && Math.floor(x/2)> 0)
            {
                str[i] = '0';
                str[n - i - 1] = '0';
                x-=2;
            }
            if (str[i] == '?' && Math.floor(y/2)> 0)
            {
                str[i] = '1';
                str[n - i - 1] = '1';
                y-=2;
            }
            if (str[i] == '?')
            {
                if (a % 2 == 1)
                {
                    str[i] = '0';
                }
                else
                {
                    str[i] = '1';
                }
            }
        }
        console.log(str.join(''));
    }
}

process.stdin.resume();

process.stdin.setEncoding('utf8');

var input = '';

process.stdin.on('data' , data=>{
    input += data;
});
process.stdin.on('end' , ()=>{
    main(input);
});

function main(input) {
    input = input.split("\n");
    let z = 0;
    let testCases = +input[z++];

    while(testCases--){
        let [a , b] = input[z++].split(' ');
        let str = input[z++].split('');
        let n = +a + +b;
        if(n % 2 === 0){
            if((a % 2 == 1) || (b % 2 == 1)){
                console.log(-1);
                continue;
            }
        }
        if(n % 2 === 1){
            if( (str[(n-1)/2]) == 0 && (a % 2 == 0)){
                console.log(-1);
                continue;
            }
            if( (str[(n-1)/2]) == 1 && (b % 2 == 0)){
                console.log(-1);
                continue;
            }
        }
        let flag = false;
        for (let i = 0; i < n; i++) {
            if(str[i] != "?" && str[n - i - 1] != "?"){
                if(str[i] != str[n - i - 1]){
                    console.log(-1);
                    flag = true;
                    break;
                }
            }
        }
        if(flag) continue
        let c = 0;
        let d = 0;
        for (let i = 0; i < n; i++) {
            if(str[i] == "?" && str[n-i-1] != "?"){
                str[i] = str[n-i-1];
            }
        }
        for (let i = 0; i < n; i++) {
            if(str[i] != "?" && str[n-i-1] == "?"){
                str[n-i-1] = str[i];
            }
        }
        for (let i = 0; i < n; i++) {
            if(str[i] == '0') c++;
            if(str[i] == '1') d++;
        }
        if(c > a || d > b){
            console.log(-1);
            continue;
        }
        let x = a - c;
        let  y = b - d;
        let p, q;
            p = Math.floor(x / 2);
            q = Math.floor(y / 2);
        for (let i = 0; i < n; i++)
        {
            if (str[i] == '?' && p > 0)
            {
                str[i] = '0';
                str[n - i - 1] = '0';
                p--;
            }
            if (str[i] == '?' && q > 0)
            {
                str[i] = '1';
                str[n - i - 1] = '1';
                q--;
            }
            if (str[i] == '?')
            {
                if (a % 2 == 1)
                {
                    str[i] = '0';
                }
                else
                {
                    str[i] = '1';
                }
            }
        }
        console.log(str.join(''));
    }
}

"use strict";
const fs = require("fs");
//let filename = "0.txt";
let filename = 0;
const input = fs.readFileSync(filename, "utf8").trim().split("\n");
let line = 0;
function readline() {
  return input[line++];
}
function iInpArr() {
  return readline()
    .trim()
    .split(" ")
    .map((cur) => parseInt(cur));
}
function BInpArr() {
  return readline()
    .trim()
    .split(" ")
    .map((cur) => BigInt(cur));
}
function string() {
  return readline().trim();
}
function stringArr() {
  return readline().trim().split("");
}
function getValue() {
  return parseInt(readline());
}
let mod = BigInt(1e9 + 7);
const solve = () => {
  let t = getValue();
  while (t--) {
    let [a, b] = iInpArr();
    let str = stringArr();
    let to = a + b,
      i = 0,
      j = str.length - 1,
      flag = false;
    while (i <= j) {
      if (i === j) {
        if (str[i] === "0") a--;
        else if (str[j] === "1") b--;
      } else if (str[i] === str[j]) {
        if (str[i] === "1") b -= 2;
        else if (str[i] === "0") a -= 2;
      } else {
        if (str[i] !== "?" && str[j] !== "?") {
          flag = true;
          break;
        } else if (str[i] !== "?") {
          if (str[i] === "0") {
            a -= 2;
            str[j] = "0";
          } else {
            b -= 2;
            str[j] = "1";
          }
        } else {
          if (str[j] === "0") {
            a -= 2;
            str[i] = "0";
          } else {
            b -= 2;
            str[i] = "1";
          }
        }
      }
      i++;
      j--;
    }
    if (a < 0 || b < 0 || flag) {
      console.log(-1);
      continue;
    }
    if (a === 0 && b === 0) {
      console.log(str.join(""));
      continue;
    }
    (i = 0), (j = str.length - 1), (flag = true);
    // console.log(a, b);
    while (i <= j) {
      if (i === j) {
        if (str[i] === "?") {
          if (a > 0) str[i] = "0";
          else if (b > 0) str[i] = "1";
          else flag = false;
        }
      } else if (str[i] === str[j]) {
        if (str[i] === "?") {
          if (b >= 2) {
            str[i] = str[j] = "1";
            b -= 2;
          } else if (a >= 2) {
            str[i] = str[j] = "0";
            a -= 2;
          } else {
            flag = false;
            break;
          }
        }
      }
      i++;
      j--;
    }
    console.log(`${flag === true ? str.join("") : -1}`);
  }
};
solve();

var dataitr;
var stdin_input = "";
process.stdin.resume();
process.stdin.setEncoding("ascii");
process.stdin.on("data", function (input) { stdin_input += input; });
process.stdin.on("end", function () { dataitr = stdin_input.split('\n').values(); main(); });

const rl = () => dataitr.next().value.trim();
const rn = () => Number(rl());
const ra = () => rl().split(' ');
const rna = () => ra().map(x => Number(x));

function main () {
	let T = rn();
	while (T--) {
		let [a, b] = rna();
		let s = rl().split('');

		const n = s.length;
		if (a + b != n ) {
			console.log(-1);
			continue;
		}

		let ok = true;
		for (let i = 0; ok && i < Math.floor(n/2); i++) {
			if (s[i] == '?')
				s[i] = s[n-i-1];
			if (s[n-i-1] == '?')
				s[n-i-1] = s[i];
			if (s[i] != s[n-i-1])
				ok = false;
		}
		if (!ok) {
			console.log(-1);
			continue;
		}

		for (const c of s) {
			a -= c == '0';
			b -= c == '1';
		}

		for (let i = 0; i < Math.floor(n/2); i++) {
			if (s[i] == '?') {
				if (a > 1) {
					s[i] = s[n-i-1] = '0';
					a -= 2;
				} else {
					s[i] = s[n-i-1] = '1';
					b -= 2;
				}

			}
		}

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

		if (a < 0 || b < 0) ans = false;
		else ans = s;

		console.log(ans ? ans.join('') : -1);
	}
}

'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
  inputString += inputStdin;
});

process.stdin.on('end', _ => {
  inputString = inputString.trim().split('\n').map(string => {
    return string.trim();
  });

  main();
});

function readline() {
  return inputString[currentLine++];
}

var maxN = 21
var mod = 1000000007

// Make a Snippet for the code above this and then write your logic in main();

function main() {
  const xx = readline();

  Array(Number(xx)).fill(1).map((t, i) => {
    // const n = parseInt(readline());
    var [x, y] = readline().split(' ').map((x, iii) => {
      return parseInt(x)
    });
    var a = readline().split('').map((x, iii) => {
      return x
    })
    var n = a.length
    for (let j = 0; j < Math.floor(n / 2); j++) {
      if (a[j] === '0' && a[n - j - 1] === '1') return console.log(-1)
      if (a[j] === '1' && a[n - j - 1] === '0') return console.log(-1)

      if (a[j] === '0' && a[n - j - 1] === '?') {
        a[n - j - 1] = '0'
        x -= 2
      } else if (a[j] === '?' && a[n - j - 1] === '0') {
        a[j] = '0'
        x -= 2
      } else if (a[j] === '1' && a[n - j - 1] === '?') {
        a[n - j - 1] = '1'
        y -= 2
      } else if (a[j] === '?' && a[n - j - 1] === '1') {
        a[j] = '1'
        y -= 2
      } else if (a[j] === '1' && a[n - j - 1] === '1') {
        y -= 2
      } else if (a[j] === '0' && a[n - j - 1] === '0') {
        x -= 2
      }
    }
    var count = 0
    for (let j = 0; j < n; j++) {
      if (a[j] === '?') count++
    }

    for (let j = 0; j < Math.floor(n / 2); j++) {
      if (a[j] === '?' && x > 1) {
        a[j] = '0'
        a[n - j - 1] = '0'
        x -= 2
        continue
      }

      if (a[j] === '?' && y > 1) {
        a[j] = '1'
        a[n - j - 1] = '1'
        y -= 2
        continue
      }
      if (a[j] === '?') return console.log(-1)
    }
    if (n % 2 === 1 && a[Math.floor(n / 2)] === '0') {
      x--
    }
    if (n % 2 === 1 && a[Math.floor(n / 2)] === '1') {
      y--
    }

    if (n % 2 === 1 && a[Math.floor(n / 2)] === '?' && x > 0) {
      a[Math.floor(n / 2)] = '0'
      x--
    }
    if (n % 2 === 1 && a[Math.floor(n / 2)] === '?' && y > 0) {
      a[Math.floor(n / 2)] = '1'
      y--
    }
    if (x !== 0 || y !== 0) return console.log(-1)
    console.log(a.join(''))
  })
}

"use strict";

process.stdin.resume();
process.stdin.setEncoding("utf-8");

let inputString = "";
let currentLine = 0;

process.stdin.on("data", (inputStdin) => {
  inputString += inputStdin;
});

process.stdin.on("end", (_) => {
  inputString = inputString
    .trim()
    .split("\n")
    .map((string) => {
      return string.trim();
    });

  main();
});

function readline() {
  return inputString[currentLine++];
}

//  Write your logic in `main`

const reverse = (palindrome) => palindrome.split("").reverse().join("");

const isPalindrome = (palindrome, counts) => {
  let newPalindrome = "";
  for (let i = 0; i < Math.ceil(palindrome.length / 2); i++) {
    let left = palindrome[i];
    let right = palindrome[palindrome.length - 1 - i];

    if (left !== right && left !== "?" && right !== "?") {
      // console.log("error: no match");
      return -1;
    }

    let character = left;

    if (left === "?") {
      left = right;
      character = right;
    }

    if (right === "?") {
      right = left;
      character = left;
    }

    newPalindrome += character;

    counts[left] -= 1;
    if (i !== palindrome.length - 1 - i) {
      counts[right] -= 1;
    }
  }

  if (counts["0"] < 0 || counts["1"] < 0) {
    return -1;
  }

  if (counts["?"] % 2 === 0) {
    if (counts["0"] % 2 !== 0 || counts["1"] % 2 !== 0) {
      // console.log("error: not even");
      return -1;
    }
  }

  counts["?"] += counts["1"] + counts["0"];

  if (counts["?"] !== 0) {
    // console.log("error: not zero");
    return -1;
  }

  // console.log("looks good");

  // console.log("new", newPalindrome, counts);
  newPalindrome = newPalindrome
    .split("")
    .map((el) => {
      if (el === "?") {
        // console.log("map", counts);
        if (counts["0"] > 0) {
          counts["0"] -= 2;
          return "0";
        } else {
          return "1";
        }
      }
      return el;
    })
    .join("");
  return (
    newPalindrome +
    reverse(newPalindrome.slice(0, Math.floor(palindrome.length / 2)))
  );
};

const main = () => {
  const numberOfTestCases = 1 * readline();
  // console.log("number of test cases", numberOfTestCases);

  Array.from({ length: numberOfTestCases }).forEach(() => {
    const [zerosCount, onesCount] = readline()
      .split(" ")
      .map((el) => +el);

    // console.log(zerosCount, onesCount);

    let palindrome = readline();

    // console.log(palindrome);

    const counts = {
      0: zerosCount,
      1: onesCount,
      "?": 0,
    };

    console.log(isPalindrome(palindrome, counts));
  });
};

"use strict";

process.stdin.resume();
process.stdin.setEncoding("utf-8");

let inputString = "";
let currentLine = 0;

process.stdin.on("data", (inputStdin) => {
  inputString += inputStdin;
});

process.stdin.on("end", (_) => {
  inputString = inputString
    .trim()
    .split("\n")
    .map((string) => {
      return string.trim();
    });

  main();
});

function readline() {
  return inputString[currentLine++];
}

//  Write your logic in `main`

const reverse = (palindrome) => palindrome.split("").reverse().join("");

const isPalindrome = (palindrome, counts) => {
  let newPalindrome = "";
  for (let i = 0; i < Math.ceil(palindrome.length / 2); i++) {
    let left = palindrome[i];
    let right = palindrome[palindrome.length - 1 - i];

    if (left !== right && left !== "?" && right !== "?") {
      // console.log("error: no match");
      return -1;
    }

    let character = left;

    if (left === "?") {
      left = right;
      character = right;
    }

    if (right === "?") {
      right = left;
      character = left;
    }

    newPalindrome += character;

    counts[left] -= 1;
    if (i !== palindrome.length - 1 - i) {
      counts[right] -= 1;
    }
  }

  if (counts["?"] % 2 === 0) {
    if (counts["0"] % 2 !== 0 || counts["1"] % 2 !== 0) {
      // console.log("error: not even");
      return -1;
    }
  }

  counts["?"] += counts["1"] + counts["0"];

  if (counts["?"] !== 0) {
    // console.log("error: not zero");
    return -1;
  }

  // console.log("looks good");

  // console.log("new", newPalindrome, counts);
  newPalindrome = newPalindrome
    .split("")
    .map((el) => {
      if (el === "?") {
        // console.log("map", counts);
        if (counts["0"] > 0) {
          counts["0"] -= 2;
          return "0";
        } else {
          return "1";
        }
      }
      return el;
    })
    .join("");
  return (
    newPalindrome +
    reverse(newPalindrome.slice(0, Math.floor(palindrome.length / 2)))
  );
};

const main = () => {
  const numberOfTestCases = 1 * readline();
  // console.log("number of test cases", numberOfTestCases);

  Array.from({ length: numberOfTestCases }).forEach(() => {
    const [zerosCount, onesCount] = readline()
      .split(" ")
      .map((el) => +el);

    // console.log(zerosCount, onesCount);

    let palindrome = readline();

    // console.log(palindrome);

    const counts = {
      0: zerosCount,
      1: onesCount,
      "?": 0,
    };

    console.log(isPalindrome(palindrome, counts));
  });
};

//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
	input: process.stdin, output: process.stdout
});
var obj; var inLine = []; var outputList = [];var retcode = new Set();
read.on('line', function(input){
	var tmp = input.split(' ');
	for(var i = 0; i < tmp.length; i++){
		inLine.push(tmp[i]);
		if(i == tmp.length - 1){
			retcode.add(inLine.length);
		}
	}
});
read.on('close', function(){
	obj = init(inLine);
	console.error('\n↑入力 ↓出力');
	Main();
	console.log(myconv(outputList, 9));
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextArray(size, code){
	var ret = new Array(size);
	for(var i = 0; i < size; i++){
		if(code == 'int'){
			ret[i] = nextInt();
		}else{
			ret[i] = next();
		}
	}
	return ret;
}
function nextIntArray(size){return nextArray(size, 'int');} function nextStrArray(size){return nextArray(size, 'str');}
function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();} function nextInt(){return myconv(next(),1);}
function getCountMap(list){
	var map = {};
	for(var i = 0; i < list.length; i++){
		if(map[list[i]] == null){
			map[list[i]] = 0;
		}
		map[list[i]]++;
	}
	return map;
}
function init(input){
	return {
		list : input, index : 0, max : input.length,
		hasNext : function(){return (this.index < this.max);},
		next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException ‚There is no more input';}},
		isReturn : function(){return retcode.has(this.index);}
	};
}
function myout(s){outputList.push(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
function isReturn(){return obj.isReturn();}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
	var t = nextInt();
	for(var i = 0; i < t; i++){
		var A = nextInt();
		var B = nextInt();
		var s = nextCharArray();
		var N = s.length;
		var isOK = true;
		for(var j = 0; j < N / 2; j++){
			if(s[j] == s[N - 1 - j]){
				if(s[j] == "0"){
					if(j == Math.ceil(N / 2) - 1 && N % 2 == 1){
						A--;
					}else{
						A -= 2;
					}
				}else if(s[j] == "1"){
					if(j == Math.ceil(N / 2) - 1 && N % 2 == 1){
						B--;
					}else{
						B -= 2;
					}
				}
			}else{
				if(s[j] == "?"){
					if(s[N - 1 - j] == "1"){
						s[j] = "1";
						B -= 2;
					}else{
						s[j] = "0";
						A -= 2;
					}
				}else if(s[N - 1 - j] == "?"){
					if(s[j] == "1"){
						s[N - 1 - j] = "1";
						B -= 2;
					}else{
						s[N - 1 - j] = "0";
						A -= 2;
					}
				}else{
					isOK = false;
				}
			}
		}
		for(var j = 0; j < N / 2; j++){
			if(s[j] == "?" && s[N - 1 - j] == "?"){
				if(A > 0){
					if(j == Math.ceil(N / 2) - 1 && N % 2 == 1){
						s[j] = "0";
						A--;
					}else if(A > 1){
						s[j] = "0";
						s[N - 1 - j] = "0";
						A -= 2;
					}
				}else if(B > 0){
					if(j == Math.ceil(N / 2) - 1 && N % 2 == 1){
						s[j] = "1";
						B--;
					}else if(B > 1){
						s[j] = "1";
						s[N - 1 - j] = "1";
						B -= 2;
					}
				}else{
					isOK = false;
				}
			}
		}
		for(var j = 0; j < N / 2; j++){
			if(s[j] != s[N - 1 - j] || s[j] == "?" || s[N - 1 - j] == "?"){
				isOK = false;
			}
		}
		if(A % 2 == 1 || B % 2 == 1 || A < 0 || B < 0){
			isOK = false;
		}
		if(isOK){
			myout(myconv(s, 0));
		}else{
			myout(-1);
		}
	}
}

//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
	input: process.stdin, output: process.stdout
});
var obj; var inLine = []; var outputList = [];var retcode = new Set();
read.on('line', function(input){
	var tmp = input.split(' ');
	for(var i = 0; i < tmp.length; i++){
		inLine.push(tmp[i]);
		if(i == tmp.length - 1){
			retcode.add(inLine.length);
		}
	}
});
read.on('close', function(){
	obj = init(inLine);
	console.error('\n↑入力 ↓出力');
	Main();
	console.log(myconv(outputList, 9));
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextArray(size, code){
	var ret = new Array(size);
	for(var i = 0; i < size; i++){
		if(code == 'int'){
			ret[i] = nextInt();
		}else{
			ret[i] = next();
		}
	}
	return ret;
}
function nextIntArray(size){return nextArray(size, 'int');} function nextStrArray(size){return nextArray(size, 'str');}
function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();} function nextInt(){return myconv(next(),1);}
function getCountMap(list){
	var map = {};
	for(var i = 0; i < list.length; i++){
		if(map[list[i]] == null){
			map[list[i]] = 0;
		}
		map[list[i]]++;
	}
	return map;
}
function init(input){
	return {
		list : input, index : 0, max : input.length,
		hasNext : function(){return (this.index < this.max);},
		next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException ‚There is no more input';}},
		isReturn : function(){return retcode.has(this.index);}
	};
}
function myout(s){outputList.push(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
function isReturn(){return obj.isReturn();}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
	var t = nextInt();
	for(var i = 0; i < t; i++){
		var A = nextInt();
		var B = nextInt();
		var s = nextCharArray();
		var N = s.length;
		var isOK = true;
		for(var j = 0; j < N / 2; j++){
			if(s[j] == s[N - 1 - j]){
				if(s[j] == "0"){
					if(j == Math.ceil(N / 2) - 1 && N % 2 == 1){
						A--;
					}else{
						A -= 2;
					}
				}else if(s[j] == "1"){
					if(j == Math.ceil(N / 2) - 1 && N % 2 == 1){
						B--;
					}else{
						B -= 2;
					}
				}
			}else{
				if(s[j] == "?"){
					if(s[N - 1 - j] == "1"){
						s[j] = "1";
						B -= 2;
					}else{
						s[j] = "0";
						A -= 2;
					}
				}else if(s[N - 1 - j] == "?"){
					if(s[j] == "1"){
						s[N - 1 - j] = "1";
						B -= 2;
					}else{
						s[N - 1 - j] = "0";
						A -= 2;
					}
				}else{
					isOK = false;
				}
			}
		}
		for(var j = 0; j < N / 2; j++){
			if(s[j] == "?" && s[N - 1 - j] == "?"){
				if(A > 0){
					if(j == Math.ceil(N / 2) - 1 && N % 2 == 1){
						s[j] = "0";
						A--;
					}else if(A > 1){
						s[j] = "0";
						s[N - 1 - j] = "0";
						A -= 2;
					}
				}else if(B > 0){
					if(j == Math.ceil(N / 2) - 1 && N % 2 == 1){
						s[j] = "1";
						B--;
					}else if(B > 1){
						s[j] = "1";
						s[N - 1 - j] = "1";
						B -= 2;
					}
				}else{
					isOK = false;
				}
			}
		}
		for(var j = 0; j < N / 2; j++){
			if(s[j] != s[N - 1 - j] || s[j] == "?"){
				isOK = false;
			}
		}
		if(A % 2 == 1 || B % 2 == 1 || A < 0 || B < 0){
			isOK = false;
		}
		if(isOK){
			myout(myconv(s, 0));
		}else{
			myout(-1);
		}
	}
}

//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
	input: process.stdin, output: process.stdout
});
var obj; var inLine = []; var outputList = [];var retcode = new Set();
read.on('line', function(input){
	var tmp = input.split(' ');
	for(var i = 0; i < tmp.length; i++){
		inLine.push(tmp[i]);
		if(i == tmp.length - 1){
			retcode.add(inLine.length);
		}
	}
});
read.on('close', function(){
	obj = init(inLine);
	console.error('\n↑入力 ↓出力');
	Main();
	console.log(myconv(outputList, 9));
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextArray(size, code){
	var ret = new Array(size);
	for(var i = 0; i < size; i++){
		if(code == 'int'){
			ret[i] = nextInt();
		}else{
			ret[i] = next();
		}
	}
	return ret;
}
function nextIntArray(size){return nextArray(size, 'int');} function nextStrArray(size){return nextArray(size, 'str');}
function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();} function nextInt(){return myconv(next(),1);}
function getCountMap(list){
	var map = {};
	for(var i = 0; i < list.length; i++){
		if(map[list[i]] == null){
			map[list[i]] = 0;
		}
		map[list[i]]++;
	}
	return map;
}
function init(input){
	return {
		list : input, index : 0, max : input.length,
		hasNext : function(){return (this.index < this.max);},
		next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException ‚There is no more input';}},
		isReturn : function(){return retcode.has(this.index);}
	};
}
function myout(s){outputList.push(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
function isReturn(){return obj.isReturn();}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
	var t = nextInt();
	for(var i = 0; i < t; i++){
		var A = nextInt();
		var B = nextInt();
		var s = nextCharArray();
		var N = s.length;
		var isOK = true;
		for(var j = 0; j < N / 2; j++){
			if(s[j] == s[N - 1 - j]){
				if(s[j] == "0"){
					if(j == Math.ceil(N / 2) - 1 && N % 2 == 1){
						A--;
					}else{
						A -= 2;
					}
				}else if(s[j] == "1"){
					if(j == Math.ceil(N / 2) - 1 && N % 2 == 1){
						B--;
					}else{
						B -= 2;
					}
				}
			}else{
				if(s[j] == "?"){
					if(s[N - 1 - j] == "1"){
						s[j] = "1";
						B -= 2;
					}else{
						s[j] = "0";
						A -= 2;
					}
				}else if(s[N - 1 - j] == "?"){
					if(s[j] == "1"){
						s[N - 1 - j] = "1";
						B -= 2;
					}else{
						s[N - 1 - j] = "0";
						A -= 2;
					}
				}else{
					isOK = false;
				}
			}
		}
		for(var j = 0; j < N / 2; j++){
			if(s[j] == "?" && s[N - 1 - j] == "?"){
				if(A > 0){
					if(j == Math.ceil(N / 2) - 1 && N % 2 == 1){
						s[j] = "0";
						A--;
					}else if(A > 1){
						s[j] = "0";
						s[N - 1 - j] = "0";
						A -= 2;
					}
				}else if(B > 0){
					if(j == Math.ceil(N / 2) - 1 && N % 2 == 1){
						s[j] = "1";
						B--;
					}else if(B > 1){
						s[j] = "1";
						s[N - 1 - j] = "1";
						B -= 2;
					}
				}else{
					isOK = false;
				}
			}
		}
		for(var j = 0; j < N / 2; j++){
			if(s[j] != s[N - 1 - j]){
				isOK = false;
			}
		}
		if(A % 2 == 1 || B % 2 == 1 || A < 0 || B < 0){
			isOK = false;
		}
		if(isOK){
			myout(myconv(s, 0));
		}else{
			myout(-1);
		}
	}
}

//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
	input: process.stdin, output: process.stdout
});
var obj; var inLine = []; var outputList = [];var retcode = new Set();
read.on('line', function(input){
	var tmp = input.split(' ');
	for(var i = 0; i < tmp.length; i++){
		inLine.push(tmp[i]);
		if(i == tmp.length - 1){
			retcode.add(inLine.length);
		}
	}
});
read.on('close', function(){
	obj = init(inLine);
	console.error('\n↑入力 ↓出力');
	Main();
	console.log(myconv(outputList, 9));
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextArray(size, code){
	var ret = new Array(size);
	for(var i = 0; i < size; i++){
		if(code == 'int'){
			ret[i] = nextInt();
		}else{
			ret[i] = next();
		}
	}
	return ret;
}
function nextIntArray(size){return nextArray(size, 'int');} function nextStrArray(size){return nextArray(size, 'str');}
function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();} function nextInt(){return myconv(next(),1);}
function getCountMap(list){
	var map = {};
	for(var i = 0; i < list.length; i++){
		if(map[list[i]] == null){
			map[list[i]] = 0;
		}
		map[list[i]]++;
	}
	return map;
}
function init(input){
	return {
		list : input, index : 0, max : input.length,
		hasNext : function(){return (this.index < this.max);},
		next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException ‚There is no more input';}},
		isReturn : function(){return retcode.has(this.index);}
	};
}
function myout(s){outputList.push(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
function isReturn(){return obj.isReturn();}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
	var t = nextInt();
	for(var i = 0; i < t; i++){
		var A = nextInt();
		var B = nextInt();
		var s = nextCharArray();
		var N = s.length;
		var isOK = true;
		for(var j = 0; j < N / 2; j++){
			if(s[j] == s[N - 1 - j]){
				if(s[j] == "0"){
					if(j == Math.ceil(N / 2) - 1 && N % 2 == 1){
						A--;
					}else{
						A -= 2;
					}
				}else if(s[j] == "1"){
					if(j == Math.ceil(N / 2) - 1 && N % 2 == 1){
						B--;
					}else{
						B -= 2;
					}
				}
			}else{
				if(s[j] == "?"){
					if(s[N - 1 - j] == "1"){
						s[j] = "1";
						B -= 2;
					}else{
						s[j] = "0";
						A -= 2;
					}
				}else if(s[N - 1 - j] == "?"){
					if(s[j] == "1"){
						s[N - 1 - j] = "1";
						B -= 2;
					}else{
						s[N - 1 - j] = "0";
						A -= 2;
					}
				}else{
					isOK = false;
				}
			}
		}
		for(var j = 0; j < N / 2; j++){
			if(s[j] == "?" && s[N - 1 - j] == "?"){
				if(A > 0){
					if(j == Math.ceil(N / 2) - 1 && N % 2 == 1){
						s[j] = "0";
						A--;
					}else if(A > 1){
						s[j] = "0";
						s[N - 1 - j] = "0";
						A -= 2;
					}
				}else if(B > 0){
					if(j == Math.ceil(N / 2) - 1 && N % 2 == 1){
						s[j] = "1";
						B--;
					}else if(B > 1){
						s[j] = "1";
						s[N - 1 - j] = "1";
						B -= 2;
					}
				}else{
					isOK = false;
				}
			}
		}

		if(A % 2 == 1 || B % 2 == 1){
			isOK = false;
		}
		if(isOK){
			myout(myconv(s, 0));
		}else{
			myout(-1);
		}
	}
}

process.stdin.resume();

process.stdin.setEncoding('utf8');

var input = '';

process.stdin.on('data' , data=>{
    input += data;
});
process.stdin.on('end' , ()=>{
    main(input);
});

function main(input) {
    input = input.split("\n");
    let z = 0;
    let testCases = +input[z++];

    while(testCases--){
        let [a , b] = input[z++].split(' ');
        let str = input[z++].split('');
        let n = +a + +b;
        if(n % 2 === 0){
            if((a % 2 == 1) || (b % 2 == 1)){
                console.log(-1);
                continue;
            }
        }
        if(n % 2 === 1){
            if( (str[(n-1)/2]) == 0 && (a % 2 == 0)){
                console.log(-1);
                continue;
            }
            if( (str[(n-1)/2]) == 1 && (b % 2 == 0)){
                console.log(-1);
                continue;
            }
        }
        let flag = false;
        for (let i = 0; i < n; i++) {
            if(str[i] != "?" && str[n - i - 1] != "?"){
                if(str[i] != str[n - i - 1]){
                    console.log(-1);
                    flag = true;
                    break;
                }
            }
        }
        if(flag) continue
        let c = 0;
        let d = 0;
        for (let i = 0; i < n; i++) {
            if(str[i] == "?" && str[n-i-1] != "?"){
                str[i] = str[n-i-1];
            }
        }
        for (let i = 0; i < n; i++) {
            if(str[i] != "?" && str[n-i-1] == "?"){
                str[n-i-1] = str[i];
            }
        }
        for (let i = 0; i < n; i++) {
            if(str[i] == '0') c++;
            if(str[i] == '1') d++;
        }
        if(c > a || d > b){
            console.log(-1);
            continue;
        }
        let x = a - c;
        let  y = b - d;
        for (let i = 0; i < n; i++)
        {
            if (str[i] == '?' && x > 0)
            {
                str[i] = '0';
                str[n - i - 1] = '0';
                x-=2;
            }
            if (str[i] == '?' && y > 0)
            {
                str[i] = '1';
                str[n - i - 1] = '1';
                y-=2;
            }
            if (str[i] == '?')
            {
                if (a % 2 == 1)
                {
                    str[i] = '0';
                }
                else
                {
                    str[i] = '1';
                }
            }
        }
        console.log(str.join(''));
    }
}

process.stdin.resume();

process.stdin.setEncoding('utf8');

var input = '';

process.stdin.on('data' , data=>{
    input += data;
});
process.stdin.on('end' , ()=>{
    main(input);
});

function main(input) {
    input = input.split("\n");
    let z = 0;
    let testCases = +input[z++];

    while(testCases--){
        let [a , b] = input[z++].split(' ').map(Number);
        let str = input[z++].split('');
        let n = a + b;
        if(n % 2 === 0){
            if((a % 2 == 1) || (b % 2 == 1)){
                console.log(-1);
                continue;
            }
        }
        if(n % 2 === 1){
            if( (str[(n-1)/2]) == 0 && (a % 2 == 0)){
                console.log(-1);
                continue;
            }
            if( (str[(n-1)/2]) == 1 && (b % 2 == 0)){
                console.log(-1);
                continue;
            }
        }
        let flag = false;
        for (let i = 0; i < n; i++) {
            if(str[i] != "?" && str[n - i - 1] != "?"){
                if(str[i] != str[n - i - 1]){
                    console.log(-1);
                    flag = true;
                    break;
                }
            }
        }
        if(flag) continue
        let c = 0;
        let d = 0;
        for (let i = 0; i < n; i++) {
            if(str[i] == "?" && str[n-i-1] != "?"){
                str[i] = str[n-i-1];
            }
        }
        for (let i = 0; i < n; i++) {
            if(str[i] == '0') c++;
            if(str[i] == '1') d++;
        }
        if(c > a || d > b){
            console.log(-1);
            continue;
        }
        let x = a - c;
        let  y = b - d;
        let p, q;
            p = x / 2;
            q = y / 2;
        for (let i = 0; i < n; i++)
        {
            if (str[i] == '?' && p > 0)
            {
                str[i] = '0';
                str[n - i - 1] = '0';
                p--;
            }
            if (str[i] == '?' && q > 0)
            {
                str[i] = '1';
                str[n - i - 1] = '1';
                q--;
            }
            if (str[i] == '?')
            {
                if (a % 2 == 1)
                {
                    str[i] = '0';
                }
                else
                {
                    str[i] = '1';
                }
            }
        }
        console.log(str.join(''));
    }
}

"use strict";
const fs = require("fs");
//let filename = "0.txt";
let filename = 0;
const input = fs.readFileSync(filename, "utf8").trim().split("\n");
let line = 0;
function readline() {
  return input[line++];
}
function iInpArr() {
  return readline()
    .trim()
    .split(" ")
    .map((cur) => parseInt(cur));
}
function BInpArr() {
  return readline()
    .trim()
    .split(" ")
    .map((cur) => BigInt(cur));
}
function string() {
  return readline().trim();
}
function stringArr() {
  return readline().trim().split("");
}
function getValue() {
  return parseInt(readline());
}
let mod = BigInt(1e9 + 7);
const solve = () => {
  let t = getValue();
  while (t--) {
    let [a, b] = iInpArr();
    let str = stringArr();
    let to = a + b,
      i = 0,
      j = str.length - 1,
      flag = true;
    while (i <= j) {
      if (i === j) {
        if (str[i] === "0") a--;
        else if (str[j] === "1") b--;
      } else if (str[i] === str[j]) {
        if (str[i] === "1") b -= 2;
        else if (str[i] === "0") a -= 2;
      }
      i++;
      j--;
    }
    if (a < 0 || b < 0) {
      console.log(-1);
      continue;
    }
    if (a === 0 && b === 0) {
      console.log(str.join(""));
      continue;
    }
    (i = 0), (j = str.length - 1);
    while (i <= j) {
      if (i === j) {
        if (str[i] === "?") {
          if (a > 0) str[i] = "0";
          else if (b > 0) str[i] = "1";
          else flag = false;
        }
      } else if (str[i] === str[j]) {
        if (str[i] === "?") {
          if (b >= 2) {
            str[i] = str[j] = "1";
            b -= 2;
          } else if (a >= 2) {
            str[i] = str[j] = "0";
            a -= 2;
          } else {
            flag = false;
            break;
          }
        }
      } else {
        if (str[i] !== "?" && str[j] !== "?") {
          flag = false;
          break;
        } else {
          let k = str[i] !== "?" ? str[i] : str[j];
          if (k === "1") {
            if (b >= 2) {
              str[i] = str[j] = "1";
              b -= 2;
            } else {
              flag = false;
              break;
            }
          } else {
            if (a >= 2) {
              str[i] = str[j] = "0";
              a -= 2;
            } else {
              flag = false;
              break;
            }
          }
        }
      }
      i++;
      j--;
    }
    console.log(`${flag === true ? str.join("") : -1}`);
  }
};
solve();

"use strict";
const fs = require("fs");
//let filename = "0.txt";
let filename = 0;
const input = fs.readFileSync(filename, "utf8").trim().split("\n");
let line = 0;
function readline() {
  return input[line++];
}
function iInpArr() {
  return readline()
    .trim()
    .split(" ")
    .map((cur) => parseInt(cur));
}
function BInpArr() {
  return readline()
    .trim()
    .split(" ")
    .map((cur) => BigInt(cur));
}
function string() {
  return readline().trim();
}
function stringArr() {
  return readline().trim().split("");
}
function getValue() {
  return parseInt(readline());
}
let mod = BigInt(1e9 + 7);
const solve = () => {
  let t = getValue();
  while (t--) {
    let [a, b] = iInpArr();
    let str = stringArr();
    let to = a + b,
      i = 0,
      j = str.length - 1,
      flag = true;
    while (i <= j) {
      if (i === j) {
        if (str[i] === "1") {
          if (b <= 0) flag = false;
        } else if (str[j] === "0") {
          if (a <= 0) flag = false;
        } else {
          if (a > 0) str[i] = "0";
          else if (b > 0) str[i] = "1";
          else flag = false;
        }
      } else if (str[i] === str[j]) {
        if (str[i] === "?") {
          if (b >= 2) {
            str[i] = str[j] = "1";
            b -= 2;
          } else if (a >= 2) {
            str[i] = str[j] = "0";
            a -= 2;
          } else {
            flag = false;
            break;
          }
        } else {
          if (str[i] === "0" && a >= 2) a -= 2;
          else if (str[i] === "1" && b >= 2) b -= 2;
          else {
            flag = false;
            break;
          }
        }
      } else {
        if (str[i] !== "?" && str[j] !== "?") {
          flag = false;
          break;
        } else {
          let k = str[i] !== "?" ? str[i] : str[j];
          if (k === "1") {
            if (b >= 2) {
              str[i] = str[j] = "1";
              b -= 2;
            } else {
              flag = false;
              break;
            }
          } else {
            if (a >= 2) {
              str[i] = str[j] = "0";
              a -= 2;
            } else {
              flag = false;
              break;
            }
          }
        }
      }
      i++;
      j--;
    }
    console.log(`${flag === true ? str.join("") : -1}`);
  }
};
solve();

var dataitr;
var stdin_input = "";
process.stdin.resume();
process.stdin.setEncoding("ascii");
process.stdin.on("data", function (input) { stdin_input += input; });
process.stdin.on("end", function () { dataitr = stdin_input.split('\n').values(); main(); });

const rl = () => dataitr.next().value.trim();
const rn = () => Number(rl());
const ra = () => rl().split(' ');
const rna = () => ra().map(x => Number(x));

function main () {
	let t = rn();
	while (t--) {
		let [a, b] = rna();
		let s = rl();

		const n = s.length;
		const cnt = [a, b];
		let ans = Array(n).fill('?');

		let mp = new Map(
				[
				['??', '?'],
				['1?', '1'],
				['0?', '0'],
				['?0', '0'],
				['?1', '1'],
				['00', '0'],
				['11', '1'],
				['10', false],
				['01', false]
				]);

		let ok = true;
		for (let i = 0; ok && i < Math.ceil(n/2); i++) {
			let x = mp.get(s[i] + s[n-i-1]);
			if (x == '?'){
				continue;
			}
			else if (x === false) {
				ok = false;;
			}
			else {
				if (cnt[x] == 0) {
					ok = false;
				}else {
					ans[i] = ans[n-i-1] = x;
					cnt[x] -= i == n-i-1 ? 1 : 2;
				}
			}
		}

		if (!ok) {
			console.log(-1);
			continue;
		}

		for (let i = 0; ok && i < Math.ceil(n/2); i++) {
			if (ans[i] == '?') {
				const need = i == n - i - 1 ? 1 : 2;
				if (cnt[0] >= need) {
					ans[i] = ans[n - i - 1] = '0';
					cnt[0] -= need;
				}else if (cnt[1] >= need) {
					ans[i] = ans[n - i - 1] = '1';
					cnt[1] -= need;
				}else {
					ok = false;
				}
			}
		}

		if (!ok) {
			console.log(-1);
			continue;
		}

		ans = ans.join('');
		console.log(ans);
	}
}


There are n employees in Alternative Cake Manufacturing (ACM). They are now voting on some very important question and the leading world media are trying to predict the outcome of the vote.Each of the employees belongs to one of two fractions: depublicans or remocrats, and these two fractions have opposite opinions on what should be the outcome of the vote. The voting procedure is rather complicated:   Each of n employees makes a statement. They make statements one by one starting from employees 1 and finishing with employee n. If at the moment when it's time for the i-th employee to make a statement he no longer has the right to vote, he just skips his turn (and no longer takes part in this voting).  When employee makes a statement, he can do nothing or declare that one of the other employees no longer has a right to vote. It's allowed to deny from voting people who already made the statement or people who are only waiting to do so. If someone is denied from voting he no longer participates in the voting till the very end.  When all employees are done with their statements, the procedure repeats: again, each employees starting from 1 and finishing with n who are still eligible to vote make their statements.  The process repeats until there is only one employee eligible to vote remaining and he determines the outcome of the whole voting. Of course, he votes for the decision suitable for his fraction. You know the order employees are going to vote and that they behave optimal (and they also know the order and who belongs to which fraction). Predict the outcome of the vote.

The first line of the input contains a single integer n (1 ≤ n ≤ 200 000) — the number of employees.  The next line contains n characters. The i-th character is 'D' if the i-th employee is from depublicans fraction or 'R' if he is from remocrats.

Print 'D' if the outcome of the vote will be suitable for depublicans and 'R' if remocrats will win.

NoteConsider one of the voting scenarios for the first sample:   Employee 1 denies employee 5 to vote.  Employee 2 denies employee 3 to vote.  Employee 3 has no right to vote and skips his turn (he was denied by employee 2).  Employee 4 denies employee 2 to vote.  Employee 5 has no right to vote and skips his turn (he was denied by employee 1).  Employee 1 denies employee 4.  Only employee 1 now has the right to vote so the voting ends with the victory of depublicans.

readline();
var voters = readline().split( "" ).map( function( i ) { return { party: i, canVote: true }; } );

var dToRemove = 0;
var rToRemove = 0;
var dVoted = false;
var rVoted = false;
do {
  dVoted = false;
  rVoted = false;
  for ( var i = 0; i < voters.length; ++i ) {
    var voter = voters[ i ];
    if ( voter.party === "D" && voter.canVote ) {
      if ( dToRemove === 0 ) {
        ++rToRemove;
        dVoted = true;
      } else {
        voter.canVote = false;
        --dToRemove;
      }
    } else if ( voter.party === "R" && voter.canVote ) {
      if ( rToRemove === 0 ) {
        ++dToRemove;
        rVoted = true;
      } else {
        voter.canVote = false;
        --rToRemove;
      }
    }
  }
} while ( dVoted && rVoted );

print( dVoted ? "D" : "R" )