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

constexpr int N = 200000 + 10;
typedef long long ll;

int T;

string solve(string s, int a, int b) {
    if (s.empty()) return "";


    for (auto const& v : s)
        if (v == '0')
            a--;
        else if (v == '1')
            b--;
    const int n = s.size();
    for (int i = 0; i < n; i++) {
        if (s[i] != '?' && s[n - i - 1] == '?') { 
            if (s[i] == '1') b--;
            else a--;
            s[n - i - 1] = s[i];

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

            if (s[i] != s[n - i - 1])
                return "-1";
        }
        else if (s[i] == '?' && s[n - i - 1] == '?') {
            if (a >= b) {
                s[i] = s[n - i - 1] = '0';
                a -= 2; 
            }
            else {
                s[i] = s[n - i - 1] = '1';
                b -= 2;
            }
        }
    }

    if (n % 2 && s[n / 2] == '?')
            if (a > b) {
                s[n / 2] = '0';
                a--;
            }
            else {
                s[n / 2] = '1';
                b--;
            }
        
    
    if (a != 0 || b != 0)
        return "-1";
    else return s;
}

int main()
{

    vector<string> res;
    for (cin >> T; T; --T) {
        int a, b;
        cin >> a >> b;
        string s;
        cin >> s;
        // if (T == 10000 - 42 + 1) cout << a << " " << b << " " << s << endl;
        res.push_back(solve(s, a, b));
        ;
    }
    for (auto const v : res)
        cout << v << endl;
    return 0;
}