#include<bits/stdc++.h>
using namespace std;

#define int long long
#define ff first
#define ss second
#define pb push_back
#define debug cout<<"Here\n"
#define debug1(i) cout<<i<<"\n"
#define debug2(x,y) cout<<x<<" "<<y<<"\n"
#define case(x)cout<<"Case"

//printing a vector
template<class T>
void printVector(vector<T>v)
{

    for (auto x : v)
        cout << x << " ";
    cout << endl;
}


//////////////////////////////////////////////////////////////////////////////////////


void solve()
{
    int a, b;
    cin >> a >> b;
    string s;
    cin >> s;
    int n = s.size();

    int flag=0;

    int zero,one;
    zero=one=0;
    for(int i=0;i<s.size();i++)
    {
        if(s[i]=='0')
        {
            zero++;
            
        }
        else if(s[i]=='1') one++;
    }

    a-=zero;
    b-=one;
    for (int i = 0; i < n / 2; i++)
    {
        //if both ? then deal later
        if (s[i] == s[n - i - 1])
            continue;
        if (s[i] == '?')
        {
            if (s[n - i - 1] == '0')
            {
                if (a > 0)
                {
                    s[i] = '0';
                    a--;
                }
                else
                {
                    cout << "-1\n";
                    return ;
                }
            }



            if (s[n - i - 1] == '1')
            {
                if (b > 0)
                {
                    s[i] = '1';
                    b--;
                }
                else
                {
                    cout << "-1\n";
                    return ;
                }
            }
        }

        else
        {

            if (s[i] == '0')
            {
                if (a > 0)
                {
                    s[n - 1 - i] = '0';
                    a--;
                }
                else
                {
                    cout << "-1\n";
                    return ;
                }
            }



            if (s[i] == '1')
            {
                if (b > 0)
                {
                    s[n - i - 1] = '1';
                    b--;
                }
                else
                {
                    cout << "-1\n";
                    return ;
                }
            }

        }
    }

        //now go with ?
        for (int i = 0; i < n / 2; i++)
        {
            if (s[i] == s[n - i - 1]&&s[i] == '?')
            {
                if (a >= 2)
                {
                    s[i] = s[n - i - 1] = '0';
                    a -= 2;
                }
                else if (b >= 2)
                {
                    s[i] = s[n - i - 1] = '1';
                    b -= 2;

                }
                else
                {
                    cout << "-1\n";
                    return;
                }
            }
        }

        //edge case
        if (n % 2 != 0)
        {
            int i = n / 2;
            if (s[i] == '?')
            {
                if (a > 0)
                {
                    s[i] = '0';
                    a--;
                }
                else if (b > 0)
                {
                    s[i] = '1';
                    b--;
                }
                else
                {
                    cout << "-1\n";
                    return;
                }
            }

        }
        if(a==0&&b==0)
        cout << s << endl;
    else cout<<-1<<endl;

    }




signed main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);

#endif // ONLINE_JUDGE
//////////////////////////////START CODE HERE//////////////////////////////////////////////

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


}