#include <bits/stdc++.h>
using namespace std;
int main() {
#ifdef DEBUG
  freopen("a.in", "r", stdin);
#endif
  ios_base::sync_with_stdio(false), cin.tie(0);
  int T;
  cin >> T;
  while (T--) {
    int a[2];
    cin >> a[0] >> a[1];
    string s;
    cin >> s;
    int n = a[0] + a[1];
    vector<pair<int, int>> x;
    for (int i = 0; i < n / 2; ++i) {
      if (s[i] == '?' && s[n - 1 - i] == '?') {
        x.emplace_back(i, n - 1 - i);
      } else if (s[i] == '?') {
        a[s[n - 1 - i] - '0'] -= 2;
        s[i] = s[n - 1 - i];
      } else if (s[n - 1 - i] == '?') {
        a[s[i] - '0'] -= 2;
        s[n - 1 - i] = s[i];
      } else {
        if (s[i] != s[n - 1 - i]) {
          a[0] = -1;
        } else {
          a[s[i] - '0'] -= 2;
        }
      }
    }
    if (a[0] < 0 || a[1] < 0) {
      cout << -1 << "\n";
      continue;
    }
    for (int i = 0; i < x.size(); ++i) {
      if (a[0] >= 2) {
        s[x[i].first] = s[x[i].second] = '0';
        a[0] -= 2;
      } else if (a[1] >= 2) {
        s[x[i].first] = s[x[i].second] = '1';
        a[1] -= 2;
      } else {
        a[0] = -1;
      }
    }
    if (a[0] < 0 || a[1] < 0) {
      cout << -1 << "\n";
      continue;
    }
    if ((n & 1) && s[n / 2] != '?') a[s[n / 2] - '0']--;
    if ((n & 1) && s[n / 2] == '?') s[n / 2] = a[0] ? '0' : '1';
    if (a[0] < 0 || a[1] < 0)
      cout << -1 << "\n";
    else
      cout << s << '\n';
  }
  return 0;
}