#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i=0;i<n;i++)
#define IOS ios::sync_with_stdio(false);cin.tie(0);
#define F first
#define S second
void solve() {
    int a, b;
    cin>>a>>b; //a zero, b one
    char c[a+b+1];
    cin>>c;
    int n=a+b;
    int q=0;
    rep(i, n) {
        if(c[i]=='0') a--;
        else if(c[i]=='1') b--;
        else q++;
    }
    if(a<0 || b<0) {cout<<"-1\n"; return; }
    rep(i, n) {
        if(c[i]!='?' && c[n-i-1]=='?') {
            c[n-i-1]=c[i];
            q--;
            if(c[i]=='0') a--;
            else b--;
        }
    }
    if(a<0 || b<0) {cout<<"-1\n"; return; }
    /*rep(i, n) cout<<c[i];
    cout<<endl;*/
    bool ok=0;
    rep(i, n) {
        if(c[i]!='?') continue;
        if(i==(n-1)/2 && n%2==1) {
            if(a%2==1) {
                c[i]='0';
                a--;
            }
            else {c[i]='1'; b--;}
        }
        else {
            //if(a==0 && b==0) break;
            if(a>=2) {
                c[i]='0';
                c[n-i-1]='0';
                a-=2;
            }
            else if(b>=2) {
                c[i]='1';
                c[n-i-1]='1';
                b-=2;
            }
            else {
                ok=1;
                break;
            }
        }
    }
    rep(i, (n+1)/2) {
        if(c[i]!=c[n-i-1]) {
            ok=1;
            break;
        }
    }
    if(!ok) rep(i, n) cout<<c[i];
    else cout<<-1;
    cout<<"\n";
    return;
}

signed main() {
    IOS
    int t;
    cin>>t;
    while(t--) solve();
}
