#include <iostream>
#include <math.h>
#include <climits>
#include <vector>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <sstream>
using namespace std;


bool compare(long long int s,long long int r){

    return s > r;
}

long long int sumOfDigits(long long int n){

    int x;
    while(n>0){
        int r = n%10;
        x +=r;
        n = n/10;
    }
    return x;
}

long long int gcd(long long int a,long long  int b)
{
    if (b == 0)
    {
        return a;
    }

    return gcd(b, a % b);
}
int main(){
    int t;
    cin >> t;
    while(t--){
        int a,b;
        string s;
        map<char, int> m;
        cin >> a>>b;
        m['0'] = 0;
        m['1'] = 0;
        int n = a+b;
        cin >> s;
        int ans =0;
        if(a%2 ==1 && b%2 ==1){
            ans =-1;
        }
        for(int i=0;i<n;i++){
            if(s[i] =='0'){
                m['0']++;
            }
            else if(s[i] == '1'){
                m['1']++;
            }
        }
        if (m['1'] > b)
        {
            ans = -1;
           
        }
        else if (m['0'] > a)
        {
            ans = -1;
          
        }
        if(ans!= -1){
            int l=0, h = s.size()-1;
            while(h>=l){
                if((s[l] !='?') && (s[h] !='?') && (s[l] != s[h])){
                    ans =-1;
                    break;
                }else{
                    if(s[l] == '?' && s[h] !='?'){
                        s[l] = s[h];
                        m[s[h]]++;
                        if(m['1'] >b){
                            ans =-1;
                            break;
                        }else if(m['0'] > a){
                            ans = -1;
                            break;
                        }
                        l+=1;
                        h-=1;
                    }
                    else if (s[l] != '?' && s[h] == '?'){
                        s[h] = s[l];
                        m[s[l]]++;
                        if (m['1'] > b)
                        {
                            ans = -1;
                            break;
                        }
                        else if (m['0'] > a)
                        {
                            ans = -1;
                            break;
                        }
                        l += 1;
                        h -= 1;
                    }
                    else{
                        l += 1;
                        h -= 1;
                    }
                }
            }
            l=0;
            h=n-1;
            while(h>=l){
                if (l == h && s[l] == '?')
                {
                    if (m['0'] != a)
                    {
                        s[l] = '0';
                        m['0']++;
                    }
                    else if (m['1'] != b)
                    {
                        s[l] = '1';
                        m['1']++;
                    }
                    if (m['1'] > b)
                    {
                        ans = -1;
                        break;
                    }
                    else if (m['0'] > a)
                    {
                        ans = -1;
                        break;
                    }
                    l += 1;
                    h -= 1;
                }
                if (s[l] == '?' && s[h] == '?')
                {
                    if (m['0'] < a - 1)
                    {
                        s[l] = '0';
                        s[h] = '0';
                        m['0'] += 2;
                    }
                    else if (m['1'] < b - 1)
                    {
                        s[l] = '1';
                        s[h] = '1';
                        m['1'] += 2;
                    }
                    else
                    {
                        ans = -1;
                        break;
                    }
                    l += 1;
                    h -= 1;
                }
                else
                {
                    l += 1;
                    h -= 1;
                }
            }
        }

        int ones = 0;
        int zeros = 0;

        for (int i = 0; i < n; i++)
        {
            if (s[i] == '0')
            {
                zeros+=1;
            }
            else if (s[i] == '1')
            {
                ones+=1;
            }
        }
        if( zeros != a || ones != b){
            ans =-1;
        }

        if(ans !=-1){
            cout << s << endl;
        }
        else{
            cout << -1 << endl;
        }
        
        
        

    }
}