#include<bits/stdc++.h>
typedef long long ll;
typedef double db;
typedef long double ld;
#define stt string
#define ve vector<ll>
#define se set<ll>
using namespace std;
#define ar array
ld pi=3.1415926536;
ll mod=11;
ll  maxx = 1e10;
ll sieve[10000001];
ll gcd(ll x, ll y)
{
    if(y==0)
        return x;
    return gcd(y,x%y);
}
ll bpow(ll a,ll b)
{
    ll  ans=1;
    while(b>0)
    {
        if(b&1)
            ans=(ans*a)%mod;
        a=(a*a)%mod;
        b>>=1;
    }
    return ans;
}
ll p(ll n)
{
    for(ll i=2;i*i<=n;i++)
      {
          if(n%i==0)
          {
            return n/i;
          }
      }
    return 1;
}
// ____Z-Algorithm_____
vector<ll> z(string s)
{
   ll n = s.size();
    vector<ll> z(n);
    ll x = 0, y = 0,p=0;
           for(ll i= 1; i < n; i++)
          {
           z[i] = max(p,min(z[i-x],y-i+1));
         while(i+z[i] < n && s[z[i]] == s[i+z[i]])
              {
               x = i; y = i+z[i]; z[i]++;
              }
          }
return z;
}
void subset(ll a[],ll k)
{
    for (int i = 1; i < pow(2, k); i++)
    {
            ll x=0;
        for (int j = 0; j < k; j++)
        {
            if (i & 1 << j)
            {
                 cout<<a[j]<<" ";
            }
        }
        cout<<endl;
    }
}
void siv()
{
    for(ll i=2;i*i<=10000;i++)
    {
        if(!sieve[i])
        {
            for(ll j=i*i;j<=10000;j+=i)
            {
                sieve[j]=1;
            }
        }
    }
  /*  for(ll i=2;i<=10000000;i++)
    {
       sieve[i] ^=1,
       sieve[i] += sieve[i-1];
    }*/
}
// don't panic during contest !!
int main()
{
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
     ll t;
    cin>>t;
  while(t--)
   {
     ll a,b,x=0,y=0;
     string s;
     cin>>a>>b>>s;
     ll n=a+b;
     for(ll i=0;i<s.size();i++)
     {
       if(s[i]=='1' && s[n-i-1]=='?')
           s[n-i-1]='1';
      if(s[i]=='0' && s[n-i-1]=='?')
           s[n-i-1]='0';
     }
     for(ll i=0;i<s.size();i++)
     {
       if(s[i]=='1')
            x++;
      else if(s[i]=='0')
          y++;
     }
     if(a%2==1 && b%2==1)
     {
       cout<<-1;
     }
     else if(x>b || y>a)
     {
       cout<<-1;
     }
    else
     {
       ll p=(a+b)/2;
       bool f=0;
       if(a%2==1)
        {
          if(s[p]=='1')
          {
            f=1;
          }
        else
          {
             if(s[p]=='?')
             {
               s[p]='0';
               y++;
             }
           }
         }
         else if(b%2==1)
         {
           if(s[p]=='0')
           {
             f=1;
           }
         else
           {
              if(s[p]=='?')
              {
                s[p]='1';
                x++;
              }
            }
          }
            for(ll i=0;i<p;i++)
            {
              if(s[i]=='1')
              {
                if(s[n-i-1]=='0')
                     f=1;
              }
             else if(s[i]=='0')
             {
               if(s[n-i-1]=='1')
                   f=1;
             }
              else
                {
                  if(x<b)
                  {
                    s[i]='1';
                    s[n-i-1]='1';
                    x+=2;
                  }
                  else
                  {
                    s[i]='0';
                    s[n-i-1]='0';
                    y+=2;
                  }
                }
              }
            if(f)
               cout<<-1;
            else if(x!=b || y!=a)
            {
                cout<<-1;
            }
            else
              cout<<s;
        }
          cout<<endl;
      }
}
