#include "bits/stdc++.h"
#include <cassert>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pi = pair<int, int>;
using pll = pair<ll, ll>;
using pd = pair<double, double>;
using pld = pair<ld, ld>;


int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);

    int t;
    cin >> t;

    while (t--)
    {
        int a, b;
        string s;
        cin >> a >> b >> s;
        const int len = a + b;

        int rem_a = a - count(begin(s), end(s), '0');
        int rem_b = b - count(begin(s), end(s), '1');
        if (rem_a < 0 || rem_b < 0)
        {
            cout << "-1\n";
            continue;
        }
        
        bool bad_from_beg{false};
        for (int i = 0; i < len && !bad_from_beg; ++i)
        {
            bad_from_beg = s[i] != '?' && s[len - 1 - i] != '?' && s[i] != s[len - 1 - i];
            if (s[i] != '?' && s[len - 1 - i] == '?')
            {
                s[len - 1 - i] = s[i];
                --(s[i] == '0' ? rem_a : rem_b);
            }
        }
        if (bad_from_beg)
        {
            cout << "-1\n";
            continue;
        }
        if (rem_a % 2 && rem_b % 2) // ?
        {
            cout << "-1\n";
            continue;
        }
        if (rem_a < 0 || rem_b < 0)
        {
            cout << "-1\n";
            continue;
        }

        // cerr << "rem_a, rem_b: " << rem_a << ", " << rem_b << endl;
        int nr_empty_places = count(begin(s), end(s), '?');
        if (nr_empty_places < rem_a + rem_b)
        {
            cout << "-1\n";
            continue;
        }

        if (nr_empty_places & 1)
        {
            if (rem_a % 2 == 0 && rem_b % 2 == 0)
            {
                cout << "-1\n";
                continue;
            }

            if (rem_a % 2)
            {
                --rem_a;
                assert(s[len / 2] == '?');
                s[len / 2] = '0';
            }
            else
            {
                --rem_b;
                assert(s[len / 2] == '?');
                s[len / 2] = '1';
            }
            --nr_empty_places;
        }
        assert(nr_empty_places % 2 == 0);
        assert(rem_a % 2 == 0 && rem_b % 2 == 0);
        if (rem_a + rem_b != nr_empty_places)
        {
            cout << "-1\n";
            continue;
        }

        for (int i = 0; i < len; ++i)
        {
            if (s[i] == '?')
            {
                assert(s[len - 1 - i] == '?');
                if (rem_a)
                {
                    rem_a -= 2;
                    s[i] = s[len - 1 - i] = '0';
                }
                else
                {
                    rem_b -= 2;
                    s[i] = s[len - 1 - i] = '1';
                }
            }
        }

        auto aux = s;
        reverse(begin(aux), end(aux));
        assert(aux == s);
        cout << s + "\n";
    }
}
