#include <bits/stdc++.h>
#define endl '\n'
#define ll long long
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(s)    (int)(s.si ze())
#define INF 2000'000'000
using namespace std;

void Go()
{
    ios_base::sync_with_stdio(0), cin.tie(0);
#ifndef ONLINE_JUDGE
    freopen("C:\\Users\\Laptop Market\\Desktop\\input.in", "r", stdin);
    freopen("C:\\Users\\Laptop Market\\Desktop\\output.out", "w", stdout);
#else
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
#endif
}
ll mod = 1e9 + 7;
void DeathRoad(){
	int a,b; cin >> a >> b;
	string s; cin >> s;
	a -= count(all(s), '0');
	b -= count(all(s), '1');
	if(a < 0 || b < 0){
		cout << -1 << endl;
		return;
	}
	for(int i = 0, j = (int)s.size() - 1; i <= j; j--, i++){
		if(s[i] == '?' && s[j] == '1' && b)
		{
			s[i] = '1';
			b--;
		}
		else if(s[i] == '1' && s[j] == '?' && b)
		{
			s[j] = '1';
			b--;
		}
		if(s[i] == '?' && s[j] == '0' && a)
		{
			s[i] = '0';
			a--;
		}
		else if(s[i] == '0' && s[j] == '?' && a)
		{
			s[j] = '0';
			a--;
		}
	}
	for(int i = 0, j = (int)s.size() - 1; i <= j; j--, i++){
		if(i == j){
			if(s[i] == '?' && a)
			{
				s[i] = '0';
				a--;
			}
			else if(s[i] == '?' && b){
				s[i] = '1';
				b--;
			}
		}
		else if(s[i] == '?' && a > 1){
			a -= 2;
			s[i] = s[j] = '0';
		}
		else if(s[i] == '?' && b > 1){
			b -= 2;
			s[i] = s[j] = '1';
		}
	}
	if(a == 0 && b == 0 && s == string(rall(s)) && count(all(s), '?') == 0)
		cout << s << endl;
	else
		cout << -1 << endl;
}
int main(){
    Go();


    int T = 1;
    cin >> T;
    while (T--)
        DeathRoad();
    return 0;
}

/***
        We're here for death, so let's go to it together!
***/
