#include <bits/stdc++.h>

#define FAST std::ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define DECIMAL(n)  std::cout << std::fixed;std::cout << std::setprecision(n);
#define hell 1000000007
#define PI 3.14159265358979323844
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define ALL(v) v.begin(), v.end()
#define SORT(v) sort(ALL(v))
#define REVERSE(v) reverse(ALL(v))
#define endl "\n"
#define maxc(v) max_element(all(v))
#define minc(v) min_element(all(v))
#define GCD(m,n) __gcd(m,n)
#define LCM(m,n) m*(n/GCD(m,n))
#define inputarr(a,n) for(int i=0;i<n;++i) cin>>a[i]
#define initarr(a,n,x) for (int i=0;i<n;++i) a[i]=x
#define rep(i, n)    for(int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
#define sz(a) (int)a.size()
#define sl(a) (int)a.length()
#define invect(data,n,commands) for(int i = 0;i<n;i++){int tmp;cin>>tmp;data.pb(tmp);commands}
#define inset(data,n,commands) for(int i = 0;i<n;i++){int tmp;cin>>tmp;data.insert(tmp);commands}
#define display(x) trav(a,x) cout<<a<<" ";cout<<endl

#define ll long long
#define ld long double
#define pii std::pair<int, int>
#define pll std::pair<ll, ll>
#define vi vector<int>
#define vvi vector<vi >
#define vii vector<pii >

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
     std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
     const char* comma = strchr(names + 1, ','); std::cerr.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}


pii operator+(pii a, pii b)
{
     return {a.fi + b.fi, a.se + b.se};
}
pll operator+(pll a, pll b)
{
     return {a.fi + b.fi, a.se + b.se};
}
std::ostream& operator<<(std::ostream& out, pii a)
{
     out << a.fi << " " << a.se << endl;
     return out;
}
std::ostream& operator<<(std::ostream& out, pll a)
{
     out << a.fi << " " << a.se << endl;
     return out;
}
std::istream& operator>>(std::istream& in, pii &a)
{
     in >> a.fi >> a.se;
     return in;
}
std::istream& operator>>(std::istream& in, pll &a)
{
     in >> a.fi >> a.se;
     return in;
}

ll bpow(ll x, ll v) {
     if (v == 0)
          return 1 % hell;

     if (v % 2 == 1)
          return (x * bpow(x, v - 1)) % hell;

     ll r = bpow(x, v / 2);

     return (r * r) % hell;
}

using namespace std;
bool ispal(string &s)
{
     int n=s.size();
     for (int i = 0; i < n/2; ++i)
     {
          if(s[i]!=s[n-i-1])
               return 0;
     }
     return 1;
}
void solve()
{
     int a, b;
     cin >> a >> b;
     string A;
     cin >> A;
     int n = A.size();
     for (int i = 0; i < n; ++i)
     {
          if (A[i] == '0')
               a--;
          else if (A[i] == '1')
               b--;
     }
     if (a < 0 || b < 0)
     {
          cout << -1 << endl;
          return;
     }
     for (int i = 0; i < n / 2; ++i)
     {
          if (A[i] == '?' && A[n - i - 1] != '?')
          {
               if (A[n - i - 1] == '1')
               {
                    b--;
                    A[i] = '1';
               }
               else
               {
                    a--;
                    A[i] = '0';
               }
          }
          else if (A[i] != '?' && A[n - i - 1] == '?')
          {
               if (A[i] == '1')
               {
                    b--;
                    A[n - i - 1] = '1';
               }
               else
               {
                    a--;
                    A[n - i - 1] = '0';
               }
          }

     }

     if (a < 0 || b < 0)
     {
          cout << -1 << endl;
          return;
     }
     for (int i = 0; i < n / 2; ++i)
     {
          if (A[i] == A[n - i - 1] && A[i] == '?')
          {
               if (a > 1) {
                    A[i] = '0';
                    A[n - i - 1] = '0';
                    a -= 2;
               }
               else if (b > 1)
               {
                    A[i] = '1';
                    A[n - i - 1] = '1';
                    b -= 2;

               }
               else
               {
                    cout << -1 << endl;
                    return;
               }
          }
     }

     if (n % 2 != 0)
     {
          if (A[n / 2] == '?')
          {
               if (b == 1)
               {
                    A[n / 2] = '1';
                    b--;
               }
               else if (a == 1)
               {
                    A[n / 2] = '0';
                    a--;
               }
               else
               {
                    cout << -1 << endl;
                    return;
               }
          }
     }
     if (a == 0 && b == 0 && ispal(A))
          cout << A << endl;
     else
     {
          cout << -1 << endl;
          return;

     }



}

int main()
{
     FAST
#ifndef ONLINE_JUDGE
     // for getting input from input.txt
     freopen("input.txt", "r", stdin);
     // for writing output to output.txt
     freopen("output.txt", "w", stdout);
#endif
     int t = 1;

     cin >> t;
     while (t--)
          solve();
}
