#define _CRT_SECURE_NO_WARNINGS
#pragma comment (linker, "/STACK:10000000000")
//#pragma GCC optimize("O3")
#include <iostream>
#include <stdio.h>
#include <cmath>
#include <math.h>
#include <iomanip> 
#include <cstring>
#include <string>
#include <string.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <deque>
#include <queue>
#include <stack>

using namespace std;

typedef long long ll;
typedef long double ld;

#define fr(i, l, r) for(int i = l; i < r; ++i)
#define rf(i, r, l) for(int i = r; i > l; --i)
#define fr_au(i, l, r) for(auto i = l; i != r; ++i)
//#define len(a) a.size()
#define elif else if
#define mp make_pair
#define pb push_back
//#define or ||
//#define and &&

int inf = 1000000007;
int n, m, v, mx, k, a, b, c;
string s;

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#endif
	scanf("%d", &k);
	while (k--) {
		scanf("%d%d", &a, &b);
		cin >> s;
		fr(i, 0, s.size() / 2) {
			if (s[i] == '?' && s[s.size() - 1 - i] != '?') {
				s[i] = s[s.size() - 1 - i];
				s[i] == '0' ? a -= 2 : b -= 2;
			}
			elif(s[i] != '?' && s[s.size() - 1 - i] == '?') {
				s[s.size() - 1 - i] = s[i];
				s[i] == '0' ? a -= 2 : b -= 2;
			}
			elif(s[i] != '?' && s[s.size() - 1 - i] != '?') {
				if(s[i] == s[s.size() - 1 - i])
					s[i] == '0' ? a -= 2 : b -= 2;
				else {
					a = -1;
					b = -1;
				}
			}
		}
		if (s.size() % 2 == 1) {
			if(s[s.size() / 2] != '?')
				s[s.size() / 2] == '0' ? a -= 1 : b -= 1;
		}
		if (a < 0 || b < 0) {
			printf("-1\n");
		}
		else {
			fr(i, 0, s.size() / 2) {
				if (s[i] == '?') {
					if (a > 1) {
						a -= 2;
						s[i] = '0';
						s[s.size() - 1 - i] = '0';
					}
					elif(b > 1) {
						b -= 2;
						s[i] = '1';
						s[s.size() - 1 - i] = '1';
					}
				}
			}
			if (s.size() % 2 == 1) {
				if (s[s.size() / 2] == '?')
					if (a > 0) {
						s[s.size() / 2] = '0';
						--a;
					}
					elif (b > 0) {
						s[s.size() / 2] = '1';
						--b;
					}
			}
			if (a != 0 || b != 0) {
				printf("-1\n");
			}
			else {
				cout << s << '\n';
			}
		}
	}
	
	return 0;
}