#include<bits/stdc++.h>
#include<iostream>
# define int long long
using namespace std;
bool isPrime(int n) 
{  
    if (n<=1) 
        return false; 
  	for(int i=2;i<n;i++) 
        if(n%i==0) 
            return false; 
    return true; 
} 
bool isPalindrome(string str){



    for(int i = 0; i <= str.length()-1; i++){
        if(str[i] != str[str.length()-1-i]){
            return false;
        }else {
            return true;
        }
    }
}
int gcd(int a,int b)
{
    if (a==0)
       return b;
    if (b==0)
       return a;
  	if (a == b)
        return a;
  	if (a > b)
        return gcd(a-b, b);
    return gcd(a, b-a);
}
int fib(int n) 
{ 
    if (n <= 1) 
        return n; 
    return fib(n-1) + fib(n-2); 
} 
int LCSubStr(string X, string Y, int m, int n)
{
    
    int LCSuff[m + 1][n + 1];
    int result = 0;
    for (int i = 0; i <= m; i++)
    {
        for (int j = 0; j <= n; j++)
        {
             
            if (i == 0 || j == 0)
                LCSuff[i][j] = 0;
 
            else if (X[i - 1] == Y[j - 1]) {
                LCSuff[i][j] = LCSuff[i - 1][j - 1] + 1;
                result = max(result, LCSuff[i][j]);
            }
            else
                LCSuff[i][j] = 0;
        }
    }
    return result;
}
void solve()
{
	int a,b;
	string s;
	cin>>a>>b>>s;
	int n;
	n=s.size();
	for(int i=0;i<n;i++)
		if(s[i]=='0') 
			a--;
		else if(s[i]=='1') 
			b--;
		else 
			continue;
	int i,j;
	for(i=0,j=n-1;i<j;i++,j--)
	{
		if(s[i]!='?'&&s[j]!='?')
		{
			if(s[i]!=s[j])
			{
				cout<<"-1"<<endl;
				return;
			}
			else 
				continue;
		}
		if(s[i]=='?'&&s[j]=='?') 	
			continue;
		else if(s[i]=='?')
		{
			s[i]=s[j];
			if(s[j]=='0') 	
				a--;
			else 
				b--;
		}
		else
		{
			s[j]=s[i];
			if(s[i]=='0') 
				a--;
			else 
				b--;
		}
	}
	for(i=0,j=n-1;i<j;i++,j--)
	{
		if(s[i]=='?'&&s[j]=='?')
		{
			if(a>=2)
			{
				s[i]='0',s[j]='0',a-=2;
			}
			else if(b>=2)
			{
				s[i]='1',s[j]='1';
				b-=2;
			}
			else
			{
				cout<<"-1"<<endl;	return;
			}
		}
	}
	if(n%2)
	{
		if(s[i]=='?')
		{
			if(a==1)
			{
				s[i]='0';
				a--;
			}
			else if(b==1)
			{
				s[i]='1';
				b--;
			} 
			else
			{
				cout<<"-1"<<endl;
				return;
			}
		}
	}
	if(a==0&&b==0)
		cout<<s<<endl;
	else
		cout<<"-1"<<endl;
}	
int32_t main()
{
	int t=1;
	cin>>t;
	while(t--)
		solve();
	return 0;
}
/*
	{
	if(a>=2)
	{
	s[i]='0';
	s[j]='0';
	a-=2;
	}
else if(b>=2)
{
s[i]='1';
s[j]='1';
b-=2;*/