//                 上昇
//              tiger tiger ...
#include<bits/stdc++.h>
using namespace std ;
#define int long long
#define double long double 
#define endl "\n"
#define PB push_back
#define MP make_pair  
#define F first 
#define S second 
#define P push
#define vvi vector<vector<int>>
#define vi vector<int>  
#define vpi vector< pair<int, int> >  
#define sz(a) (int)a.size()
#define all(a)   a.begin() , a.end()  
#define allr(a)   a.rbegin() , a.rend()  
#define YES {cout<<"YES\n";return;} 
#define NO {cout<<"NO\n";return;} 
#define mem(a,x) memset(a,x,sizeof(a))
// #define forn(i, n) for (int i = 0; i < int(n); i++)
#define PI 3.14159265
typedef long long LL;   
typedef double ld;

#define forn(i,n,q) for(int i=q ; i<n ; i++)
inline void io(){ 
// #ifndef ONLINE_JUDGE                                                                 
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
// #endif
 }

void PV(vi v) { for (int i = 0 ; i < sz(v) ; i++) cout << v[i]  << " " ; cout << endl;}
void PA(int v[], int n, int x = 0) { for (int i = x ; i < n + x; i++)cout << v[i] <<" "  ; cout << endl;}
void IA(int a[], int n, int x = 0) {for (int i = x; i < n + x; i++)cin >> a[i];}
//**********************************************************************************************************************************************************************************
const int N =  1e5+7, MOD = 1e9+7 , INF = 1e17+7 ; // 10000

void solve() {
	int a[2]   ; cin >> a[0] >> a[1] ;		/// 0 1 
	string s ; cin >> s ;
	int n = sz(s) ;
	for(int i=0 ;i <n/2;i++){
		if(s[i] == '?'){
			if(s[n-1-i]!='?'){
				s[i] = s[n-1-i] ;
				a[s[i]-'0'] -=2 ;
			continue ;
			}
		}
		else if(s[n-1-i] == '?'){
			if(s[i]!='?'){
				s[n-1-i] = s[i] ;
				a[s[i]-'0'] -=2 ;
			continue ;
			}
		}
		if(s[i]==s[n-1-i] && s[i]!='?')
			a[s[i]-'0'] -= 2 ;
	}
	for(int i=0 ;i <n/2 ; i++){
		if(s[i]=='?'){
			if(a[0]>1){
				s[i] = '0' ;
				s[n-1-i] = '0' ;
				a[0] -=2 ;
			}
			else {
				s[i] = '1' ;
				s[n-1-i] = '1' ;
				a[1] -=2 ;
			}
		}
	}
	if(n&1){
		if(s[(n/2)]=='?'){
		if(a[0]>0){
				s[n/2] = '0' ;
				a[0] -- ;
			}
			else {
				s[n/2] = '1' ;
				a[1] -- ;
			}	
		}
		else{
			a[s[n/2]-'0'] -- ;
		}
	}
	int ct = 0 ;
	for(int i=0 ;i <n/2 ; i++){
		if(s[i]=='?') { ct++;  continue ;}
		if(s[i]!=s[n-1-i]){ct++ ; }
	}
	if(n&1){
		if(s[n/2 ]=='?') ct ++ ;
	}
	if(ct || a[0]!=0 || a[1]!=0  ){
		cout << -1<<endl ; return ;
	}
	cout << s << endl;


}

signed main () {
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    // io();
    int t1 = 1 , x0=1 ;
    cin >> t1 ;
    // cout << fixed << setprecision(11);
    while(t1--){   
        // cout <<"Case #"<<x0++<<": ";
        solve( ) ;
    }    
}

