#include <bits/stdc++.h>
using namespace std;
int main()
{
	int t, n, k, a, b, l; cin>>t;
	while(t-- and cin>>a>>b){
		string str; cin>>str;
		n = a+b;
		for(int i=0; i<n; i++){
			if(str[i]=='?')str[i] = str[n-i-1];
		}
		
		a -= count(str.begin(), str.end(), '0');
		b -= count(str.begin(), str.end(), '1');
		for(int i=0; i<=n/2; i++){
			if(i!=n-i-1 and str[i]=='?'){
				if(a>1)str[i]=str[n-i-1]='0', a-=2;
				else if(b>1)str[i]=str[n-i-1]='1', b-=2;
			}
			else if(str[i]=='?'){
				if(a)str[i]='0',a--;
				else str[i]='1',b--;
			}
		}
		
		string vec=str;
		reverse(vec.begin(), vec.end());
		if(vec==str and a==0 and b==0)cout<<str<<'\n';
		else cout<<"-1\n";
	}
}