#include<iostream>
#include<bits/stdc++.h>
#define ll long long int
int INF = 1e9+5;
const int mod=1e9+7;
const int N=1e5+1;
int wi[101],p[101];
int dp[3001][3001];
using namespace std;
 
int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
 
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
    int t;
    cin>>t;
    while(t--){
        int a,b;
        cin>>a>>b;
        string s;
        cin>>s;
        int n=a+b,flag=0;
        if(a%2 && b%2){
            cout<<"-1\n";
            continue;
        }
        else{
            if(n%2){
                if(a%2){
                    if(s[n/2]=='?')
                    s[n/2]='0';
                    else if(s[n/2]=='1')
                    flag=1;
                }
                else{
                    if(s[n/2]=='?')
                    s[n/2]='1';
                    else if(s[n/2]=='0')
                    flag=1;
                }
            }
            for(int i=0;i<=(n/2);i++){
                if(s[i]==s[n-i-1])
                continue;
                else if(s[i]=='?')
                s[i]=s[n-i-1];
                else if(s[n-i-1]=='?')
                s[n-i-1]=s[i];
                else
                flag=1;
            }
            int c1=0,c0=0;
            for(int i=0;i<n;i++){
                if(s[i]=='1')
                c1++;
                else if(s[i]=='0')
                c0++;
            }
            if(c0>a||c1>b)
            flag=1;
            for(int i=0;i<=n/2;i++){
                if(s[i]=='?'&&s[n-i-1]=='?'){
                    if((c0+2)<=a){
                        s[i]='0';
                        s[n-i-1]='0';
                        c0+=2;
                    }
                    else if((c1+2)<=b){
                        s[i]='1';
                        s[n-i-1]='1';
                        c1+=2;
                    }
                    else
                    flag=1;
                }
            }
            if(flag==1)
            cout<<"-1\n";
            else
            cout<<s<<endl;
        }
    }
    return 0;     
}