// Problem Link: https://c...content-available-to-author-only...s.com/contest/1512/problem/C

#include <bits/stdc++.h>
#define INF 1e18
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define endl "\n";
#define _min(a) *min_element(a.begin(), a.end());
#define _max(a) *max_element(a.begin(), a.end());
#define _sort(x) sort(x.begin(), x.end())
#define _rsort(x) sort(x.rbegin(), x.rend())
#define _reverse(x) reverse(x.begin(), x.end())
#define _debug(x) cout << #x << " = " << x << endl;
#define debug(x, y) cout << #x " = " << x << " " << #y << " = " << y << endl;
#define _lower_bound(a, x) lower_bound(a.begin(), a.end(), x) - a.begin()
#define _upper_bound(a, x) upper_bound(a.begin(), a.end(), x) - a.begin()
typedef long long ll;
using namespace std;

vector<int> read_array(int n) {vector<int>a(n); for(int i=0; i<n;i++) cin>>a[i]; return a;}
vector<ll> read_array(ll n) {vector<ll>a(n); for(int i=0; i<n;i++) cin>>a[i]; return a;}
vector<pair<int,int>> read_pair(int n) {vector<pair<int, int>>a(n); for(int i=0; i<n; i++) {cin>>a[i].first>>a[i].second;} return a;}
void write_array(vector<int>a) {for(auto &u:a) cout<<u<< " "; cout<<endl;}

void solve() {  
	int a, b; cin >> a >> b; 
	string s; cin >> s;
	int n = s.length();
	if (n != a+b) {
		cout << "-1\n";
		return;
	}
	if (a % 2 == 1 && b % 2 == 1) {
		// puts("WARNING: 1");
		cout << "-1\n";
		return;
	}
	if (a % 2 == 1 && s[n/2] == '?') {
		s[n/2] = '0';
		// a--;
	}
	if (b % 2 == 1 && s[n/2] == '?') {
		s[n/2] = '1';
		// b--;
	}
	for (int i = 0; i < n; i++) {
		if (s[i] == '0') a--;
		if (s[i] == '1') b--;
	}
	if (a < 0 || b < 0) {
		// cout << a << b << endl;
		// puts("WARNING: 2");
		cout << "-1\n";
		return;
	}
	int i = 0, j = n - 1;
	while (i < j) {
		if (a < 0 || b < 0) {
			// puts("WARNING: 3");
			cout << "-1\n";
			return;
		}
		if (s[i] == '?' && s[j] != '?') {
			if (s[j] == '0') {
				s[i] = '0';
				a--;
			} else {
				s[i] = '1';
				b--;
			}
		} else if (s[i] != '?' && s[j] == '?') {
			if (s[i] == '0') {
				s[j] = '0';
				a--;
			} else {
				s[j] = '1';
				b--;
			}
		} else if (s[i] != '?' && s[j] != '?') {
			if (s[i] != s[j]) {
				// puts("WARNING: 4");
				cout << "-1\n";
				return;
			} else {

			}
		} else {
			if (a >= b) {
				s[i] = s[j] = '0';
				a -= 2;
			} else {
				s[i] = s[j] = '1';
				b -= 2;
			}
		}

		i++;
		j--;
	}
	if (a < 0 || b < 0) {
		cout << "-1\n";
		return;
	}
	i = 0, j = n - 1;
	while (i < j) {
		if (s[i] != s[j]) {
			cout << "-1\n";
			return;
		}
		i++;
		j--;
	}
	cout << s << endl;
}   

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

    int t; cin >> t;
    while(t--) {
    	solve();
    }
}  