#include<bits/stdc++.h>
using namespace std;
#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());
const int M = 3e5+ 7, N = 500;
int fact[1001];
int power(int x, int y){
    int res = 1;
    x = x % mod;
    if (x == 0) return 0;
    while (y > 0){
        if (y & 1)
            res = (res*x) % mod;
        y = y>>1;
        x = (x*x) % mod;
    }
    return res;
}
int ad(int a, int b){
    return((a % mod + b % mod) % mod);
}
int sub(int a, int b){
    return((a % mod - b % mod + mod) % mod);
}
int mul(int a, int b){
    return(((a % mod) * (b % mod)) % mod);
}
int divi(int a, int b){
    return(mul(a, power(b, mod - 2)) % mod);
}
 
int ncr(int n, int r){
    if(r > n)
        return 0;
    return divi(fact[n], mul(fact[n - r], fact[r]));
}
void c_p_c(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}
int po(int n,int exp){
  if(exp==0)return 1%mod;
  int n2=po(n,(exp>>1))%mod;
  return (exp&1)==0?(n2*n2)%mod:(n*n2*n2)%mod;
}
vi primeNum;
bool prime[10000000];
unordered_set<int>s;
void Sieve(){
     int N=10000000;
     for(int i=4;i<N;i+=2)prime[i]=true;
     primeNum.push_back(2);
     s.insert(2);
     for(int i=3;i<N;i++){
          if(!prime[i]){
               s.insert(i);
               primeNum.push_back(i);
               for(int j=i*i;j<N;j+=2*i){
                    prime[j]=true;
               }
          }
     }
     return;
}
void solve(){
int a,b;
cin>>a>>b;
string s;
cin>>s;
int n=s.size();
if(n==1){
    if(s[0]=='?'){
    if(a>0)
       cout<<"0"<<endl;
    else if(b>0)
       cout<<"1"<<endl;
    }
    else if(s[0]=='0'){
          if(b==1)
             cout<<"-1"<<endl;
          else
            cout<<s<<endl;
    }
    else{
        if(a==1)
             cout<<"-1"<<endl;
          else
            cout<<s<<endl;
    }
return;
}
int l=n/2-1,m=n/2;
vector<pair<int,int>>k(n);
int count2=0,count3=0;
while(l>=0){
    if(s[l]=='0')
         count2++;
    else if(s[l]=='1')
         count3++; 
    k[l]={count2,count3};
 //   cout<<count2<<" "<<count3<<endl;
    l--;
}
count2=0,count3=0;
while(m<s.size()){
    if(s[m]=='0')
         count2++;
    else if(s[m]=='1')
         count3++; 
    k[m]={count2,count3};
   // cout<<count2<<" "<<count3<<endl;
    m++;
}
int i=0,j=n-1;
int count=a,count1=b;
for(int k=0;k<n;k++){
    if(s[k]=='0')
        count--;
    if(s[k]=='1')
       count1--;
}
while(i<=j){
    if(s[i]!='?'&&s[j]=='?'){
            s[j]=s[i];
            if(s[i]=='0'&&count>=1)
              count--;
           else if(s[i]=='0'&&count<1){
               cout<<"-1"<<endl;
               return;
           }
           if(s[i]=='1'&&count1>=1)
             count1--;
           else if(s[i]=='1'&&count1<1){
               cout<<"-1"<<endl;
               return;
           }
        }
        else if(s[i]=='?'&&s[j]!='?'){
            s[i]=s[j];
            if(s[j]=='0'&&count>=1)
              count--;
           else if(s[j]=='0'&&count<1){
               cout<<"-1"<<endl;
               return;
           }
           if(s[j]=='1'&&count1>=1)
             count1--;
           else if(s[j]=='1'&&count1<1){
               cout<<"-1"<<endl;
               return;
           }
        }
  i++,j--;
}
i=0,j=n-1;
while(i<j){
    if(s[i]!='?'&&s[j]!='?'&&s[i]!=s[j]){
        cout<<"-1"<<endl;
        return;
    }
    else if(s[i]=='?'&&s[j]=='?') {
            if(count>=2){
                 s[i]='0';
                 s[j]='0';
                 count-=2;
             }
             else if(count1>=2){
                 s[i]='1';
                 s[j]='1';
                 count1-=2;
             }
             else{
                 cout<<"-1"<<endl;
                 return;
             }
    }
    i++,j--;
}
if(count==0&&count1==0){
  cout<<s<<endl;
   return;
}
else if(count==0&&count1==1){
    s[i]='1';
    cout<<s<<endl;
    return;
}
else if(count==1&&count1==0){
    s[i]='0';
    cout<<s<<endl;
    return;
}
cout<<"-1"<<endl;
}
int32_t main(){
    //c_p_c();
    //Sieve();
  //  fact[0]=1;
  //   for(int i = 1; i < 1001; i++){
   //     fact[i] = (fact[i - 1] * i)%mod;
   //  }
 //   prime[10000000]={false};
    w(x)
    solve();
    return 0;
}