// Author:- Pratik Kinger
// Birla Institute of Technology
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define pii pair<ll, ll>
#define vi vector<ll>
#define vii vector<pii>
#define mi map<ll, ll>
#define mii map<pii, ll>
#define f(i, a, b) for (ll i = (ll)a; i < (ll)b; i++)
#define rf(i, a, b) for (ll i = (ll)a; i >= (ll)b; i--)
#define FIO                           \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define all(a) (a).begin(), (a).end()
#define fi first
#define si second
#define sz(x) (ll) x.size()
#define endl '\n'
#define mod 1000000007
#define mset(m, v) memset(m, v, sizeof(m))
using namespace std;
const ll MOD = 1000000000 + 7;
//------------------------------CODE--HERE--------------------------
//----------global--variables-------------------
//------------end-------------------------------
bool check_palind(string s)
{
    int n = s.length();
    for(int i = 0; i<n/2; i++)
    {
        if(s[i] != s[n - i - 1])
        {
            return false;
        }
        if(s[i] == '?' || s[n - i - 1] == '?')
            return false;
    }
    return true;
}
void solve()
{
    int a, b;
    cin>>a>>b;
    string s;
    cin>>s;
    int n = a + b;
    for(int i = 0; i<n; i++)
    {
        if(s[i] == '?' && s[n - i - 1] != '?')
        {
            s[i] = s[n - i - 1];
        }
    }
    // cout<<s<<endl;
    int needed_0 = 0, needed_1 = 0;
    int coun_0 = 0, coun_1 = 0, coun_q = 0;
    for(int i = 0; i<n; i++)
    {
        if(s[i] == '0')
        coun_0++;
        if(s[i] == '1')
        coun_1++;
    }
    coun_q = n - coun_0 - coun_1;
    needed_0 = a - coun_0;
    needed_1 = b - coun_1;
    if(needed_0 < 0 || needed_1 < 0)
    {
        cout<<-1<<endl;
        return;
    }
    if(n%2 == 1 && s[n/2] == '?')
    {
        if(needed_0%2 == 0 && needed_1%2 == 0)
        {
            cout<<-1<<endl;
            return;
        }
        else if(needed_0%2 == 1)
        {
            s[n/2] = '0';
            needed_0--;
        }
        else if(needed_1%2 == 1)
        {
            s[n/2] = '1';
            needed_1--;
        }
    }
    if(needed_0%2 != 0 || needed_1%2 != 0)
    {
        cout<<-1<<endl;
        return;
    }
    for(int i = 0; i<n; i++)
    {
        if(s[i] == '?')
        {
            if(needed_0 > 1)
            {
                s[i] = '0';
                s[n - i - 1] = '0';
                needed_0 -= 2;
            }
            else if(needed_1 > 1)
            {
                s[i] = '1';
                s[n - i - 1] = '1';
                needed_1 -= 2;
            }
        }
    }
    if(check_palind(s))
    cout<<s<<endl;
    else
    cout<<-1<<endl;
    





}
//------------------------------
int main()
{
    //FAST INPUT OUTPUT
    FIO;

//INPUT OUTPUT
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    int t;
    cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}