#include <bits/stdc++.h> 	
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pb push_back
#define all(x)  (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
const ll INF = 2e18;
/* Two pointers = greedy --> dp, BS */

int main() {
	FAST;
	ll t; cin >> t;
	while(t--) {
		ll a[2] = {0}, i;
		ll  intero = 0; cin >> a[0] >> a[1]; 
		string s; cin >> s;
		ll n = s.size();
		bool ok = true;	
		for(i = 0; i < n; i++) {
			if(s[i] != '?' && s[n - i - 1] != '?' && s[i] != s[n - i - 1]) {
				ok = false;
			}
			if(s[i] == '1') a[1]--;
			else if(s[i] == '0') a[0]--;
			else intero++;
		}
		for(i = 0; i < n; i++) {
			if(s[i] == '?' && s[n - i - 1] != '?') {
				s[i] = s[n - i - 1];
				a[s[i] - '0']--;
				intero--;
			}
		}
		if(a[0] + a[1] != intero) ok = false;
		for(i = 0; i < n; i++) {
			if(s[i] == '?' && i == n - i - 1) {
				if(a[0]) {
					s[i] = '0';
					a[0]--;
				}
				else if(a[1]) {
					s[i] = '1';
					a[1]--;
				}
				break;
			} 
			else if(s[i] == '?' && a[0] >= 2) {
				s[i] = s[n - i - 1] = '0';
				a[0] -= 2;
			}
			else if(s[i] == '?' && a[1] >= 2) {
				s[i] = s[n - i - 1] = '1';
				a[1] -= 2;
			}
		}
		if(a[0] || a[1]) ok = false;
		for(i = 0; i < n; i++) {
			if(s[i] == '?') ok = false;
		}
		if(!ok) {
			cout << "-1\n";
			continue;
		}
		cout << s << "\n";
	} 
 	return 0; 
}