#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rsort(arr,n) sort(arr, arr + n, greater<ll>());
#define pb push_back 
#define mp make_pair
#define forl(i,a,n) for(ll i=a;i<n;i++)
#define M1 1000000007
#define M2 1000000009
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
vector<ll>val;
ll max(ll a,ll b){
    if(a>=b) return a;
    else return b;
}
ll min(ll a, ll b){
    if(a>=b) return b;
    else return a;
}
ll checkprime(ll a){
    ll flag=1;
    for(ll i=2;i<=sqrt(a);i++){
        if(a%i==0){
            flag=0;
            break;
        }
    }
    return flag;
}
unsigned long long power(unsigned long long x, 
                                  ll y, ll p)
{
    unsigned long long res = 1; // Initialize result
 
    x = x % p; // Update x if it is more than or
    // equal to p
 
    while (y > 0) 
    {
     
        // If y is odd, multiply x with result
        if (y & 1)
            res = (res * x) % p;
 
        // y must be even now
        y = y >> 1; // y = y/2
        x = (x * x) % p;
    }
    return res;
}
 
// Returns n^(-1) mod p
unsigned long long modInverse(unsigned long long n,  
                                            ll p)
{
    return power(n, p - 2, p);
}
 
// Returns nCr % p using Fermat's little
// theorem.
unsigned long long nCrModPFermat(unsigned long long n,
                                 ll r, ll p)
{
    // If n<r, then nCr should return 0
    if (n < r)
        return 0;
    // Base case
    if (r == 0)
        return 1;
 
    // Fill factorial array so that we
    // can find all factorial of r, n
    // and n-r
    unsigned long long fac[n + 1];
    fac[0] = 1;
    for (ll i = 1; i <= n; i++)
        fac[i] = (fac[i - 1] * i) % p;
 
    return (fac[n] * modInverse(fac[r], p) % p
            * modInverse(fac[n - r], p) % p)
           % p;
}
ll factorial(ll n, ll p) 
{ 
    ll res = 1, i; 
    for (i = 2; i <= n; i++) 
        res =(ll)(res*i)%p; 
    return res; 
}
bitset<100000>b;
vector<ll>primes;
void Sieve(){
    b.set(); // all bits to 1
    b[0]=0;
    b[1]=0;
    forl(i,2,100000){
        if(b[i]){
            primes.pb(i);
            for(ll j=i*i;j<100000;j+=i){
                b[j]=0;
            }
        }
    }
}
ll check(string &s,ll a,ll b){
    int f=1;
    ll a1=0;
    ll b1=0;
    forl(i,0,s.length()){   
        if(s[i]=='1') b1++;
        if(s[i]=='0') a1++;
        if(s[i]!=s[s.length()-1-i]) f=0;

    }
    if(a1!=a || b1!=b) f=0;
    return f;
}

int main(){
   #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    fast();
    ll t;
    cin>>t;
    while(t--){
        ll a,b;
        cin>>a>>b;
        string s;
        cin>>s;
        if(s.length()%2){
            ll a1=0;
            ll b1=0;
            int f=1;
            forl(i,0,s.length()/2){
                //cout<<s[i]<<" "<<s[s.length()-1-i]<<endl;
                if(s[i]=='0' && (s[s.length()-1-i]=='?' || s[s.length()-1-i]=='0')){
                    a1+=2;
                    continue;
                }
                else if(s[s.length()-i-1]=='0' && (s[i]=='?' || s[i]=='0')){
                    a1+=2;
                    continue;
                }

                else if(s[i]=='1' && (s[s.length()-i-1]=='?' || s[s.length()-1-i]=='1')){
                    b1+=2;
                    continue;
                }
                else if(s[s.length()-i-1]=='1' && (s[i]=='?' || s[i]=='1')){
                    b1+=2;
                    continue;
                }
                else if(s[i]!=s[s.length()-1-i] && s[i]!='?' && s[s.length()-1-i]!='?') f=0;
                //cout<<a1<<" "<<b1<<endl;
            }
            if(s[s.length()/2]=='1') b1++;
            else if(s[s.length()/2]=='0') a1++;
            if(!f) cout<<-1<<endl;
            else{
                ll fa=a-a1;
                ll fb=b-b1;
                //cout<<fa<<" "<<fb<<endl;
                forl(i,0,s.length()/2){
                    if(s[i]=='1' || s[s.length()-1-i]=='1'){
                        s[i]='1';
                        s[s.length()-i-1]='1';
                    }
                    if(s[i]=='0' || s[s.length()-1-i]=='0'){
                        s[i]='0';
                        s[s.length()-i-1]='0';
                    }
                    if(s[i]=='?' && s[s.length()-1-i]=='?'){
                        if(fa>=2){
                            s[i]='0';
                            s[s.length()-i-1]='0';
                            fa-=2;
                        }
                        else if(fb>=2){
                            s[i]='1';
                            s[s.length()-i-1]='1';
                            fb-=2;
                        }

                    }

                }
                if(s[s.length()/2]=='?'){
                    if(fa>=1) s[s.length()/2]='0';
                    else if(fb>=1) s[s.length()/2]='1';
                }
                if(check(s,a,b)) cout<<s<<endl;
                else cout<<-1<<endl;

            }
        }
        else{
            ll a1=0;
            ll b1=0;
            int f=1;
            forl(i,0,s.length()/2){
                if(s[i]=='0' && (s[s.length()-1-i]=='?' || s[s.length()-1-i]=='0')){
                    a1+=2;
                    continue;
                }
                else if(s[s.length()-i-1]=='0' && (s[i]=='?' || s[i]=='0')){
                    a1+=2;
                    continue;
                }

                else if(s[i]=='1' && (s[s.length()-i-1]=='?' || s[s.length()-1-i]=='1')){
                    b1+=2;
                    continue;
                }
                else if(s[s.length()-i-1]=='1' && (s[i]=='?' || s[i]=='1')){
                    b1+=2;
                    continue;
                }
                else if(s[i]!=s[s.length()-1-i] && s[i]!='?' && s[s.length()-1-i]!='?') f=0;
            }
            if(!f) cout<<-1<<endl;
            else{
                ll fa=a-a1;
                ll fb=b-b1;
                forl(i,0,s.length()/2){
                    if(s[i]=='1' || s[s.length()-1-i]=='1'){
                        s[i]='1';
                        s[s.length()-i-1]='1';
                    }
                    if(s[i]=='0' || s[s.length()-1-i]=='0'){
                        s[i]='0';
                        s[s.length()-i-1]='0';
                    }
                    if(s[i]=='?' && s[s.length()-1-i]=='?'){
                        if(fa>=2){
                            s[i]='0';
                            s[s.length()-i-1]='0';
                            fa-=2;
                        }
                        else if(fb>=2){
                            s[i]='1';
                            s[s.length()-i-1]='1';
                            fb-=2;
                        }

                    }

                }
                if(check(s,a,b)) cout<<s<<endl;
                else cout<<-1<<endl;

            }

        }}}