#include<iostream>
#include<cstdio>
#include<algorithm>

using namespace std;
const int N = 1e7 + 10;
char s[N];
int mp[N];

bool judge(int n) {
	for(int i = 1; i <= n / 2; i++) {
		if(s[i] != s[n - i + 1]) return false;
	}
	return true;
}

int main() {
	int t, n;
	cin >> t;
	while(t--) {
		int a, b;
		cin >> a >> b;
		int n = a + b;
		scanf("%s", s + 1);
		for(int i = 1; i <= n; i++) {
			mp[i] = 0;
			if(s[i] == '?') {
				mp[i] = 1;
				s[i] = '1';
			}
		}
		if(b == 0) {
			int f = 1;
			for(int i = 1; i <= n; i++) {
				if(!mp[i] && s[i] == '1') {
					f = 0; break;
				}
			}
			if(f) {
				for(int i = 1; i <= n; i++) {
					printf("0");
				}
				printf("\n");
			} else {
				printf("-1\n");
			} 
			continue;
		}
		int sum = 0;
		for(int i = 1; i <= n; i++) {
			if(!mp[i] && mp[n - i + 1]) {
				s[n - i + 1] = s[i];
				mp[i] = mp[n - i + 1] = 0;
			}
		}
		for(int i = 1; i <= n; i++) {
			if(s[i] == '0') sum++;
		}
		if(sum == a) {
			if(judge(n))
				printf("%s\n", s + 1);
			else 
				printf("-1\n");
			continue;
		}
		if(a % 2 && sum % 2 == 0) {
			if(n % 2 && mp[(n / 2) + 1]) {
				sum++; s[n / 2 + 1] = '0';
			} else {
				cout << -1 << endl;
				continue;
			}
		}
		for(int i = 1; i <= n / 2; i++) {
			if(mp[i]) {
				if(sum < a) {
					s[i] = s[n - i + 1] = '0';
					sum += 2;
				} else {
					s[i] = s[n - i + 1] = '1';
				}
			}

		} 
		if(sum == a && judge(n)) printf("%s\n", s + 1);
		else cout << -1 << endl;
	}	
	return 0;
} 
/*
1
3 4
???????
*/