// 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();
}
}
Ly8gUHJvYmxlbSBMaW5rOiBodHRwczovL2MuLi5jb250ZW50LWF2YWlsYWJsZS10by1hdXRob3Itb25seS4uLnMuY29tL2NvbnRlc3QvMTUxMi9wcm9ibGVtL0MKCiNpbmNsdWRlIDxiaXRzL3N0ZGMrKy5oPgojZGVmaW5lIElORiAxZTE4CiNkZWZpbmUgRVBTIDFlLTkKI2RlZmluZSBQSSAzLjE0MTU5MjY1MzU4OTc5MzIzODQ2MjY0MzM4MzI3OTUKI2RlZmluZSBNT0QgMTAwMDAwMDAwNwojZGVmaW5lIGVuZGwgIlxuIjsKI2RlZmluZSBfbWluKGEpICptaW5fZWxlbWVudChhLmJlZ2luKCksIGEuZW5kKCkpOwojZGVmaW5lIF9tYXgoYSkgKm1heF9lbGVtZW50KGEuYmVnaW4oKSwgYS5lbmQoKSk7CiNkZWZpbmUgX3NvcnQoeCkgc29ydCh4LmJlZ2luKCksIHguZW5kKCkpCiNkZWZpbmUgX3Jzb3J0KHgpIHNvcnQoeC5yYmVnaW4oKSwgeC5yZW5kKCkpCiNkZWZpbmUgX3JldmVyc2UoeCkgcmV2ZXJzZSh4LmJlZ2luKCksIHguZW5kKCkpCiNkZWZpbmUgX2RlYnVnKHgpIGNvdXQgPDwgI3ggPD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