#include <algorithm>
#include <cmath>
#include <cstring>
#include <iostream>
typedef long long LL;
#define MAXN 1000009
// #define MAXN 109
#define INF 0x3f3f3f3f
#define LLINF 0x3f3f3f3f3f3f3f3f
using namespace std;
int T, a, b, n, cnt1, cnt0;
char s[MAXN];
bool checkValid()
{
    if ((a & 1) && (b & 1)) return false;
    return true;
}
bool checkOneValid()
{
    if (a & 1)
    {
        if (s[(1 + n) / 2] == '?') s[(1 + n) / 2] = '0';
        if (s[(1 + n) / 2] == '0') return true;
        return false;
    }
    if (b & 1)
    {
        if (s[(1 + n) / 2] == '?') s[(1 + n) / 2] = '1';
        if (s[(1 + n) / 2] == '1') return true;
        return false;
    }
    return true;
}
bool makeValid()
{
    for (int i = 1; i <= n; i++)
    {
        if (s[i] == '?') continue;
        if (s[i] == s[n + 1 - i]) continue;
        if (s[n + 1 - i] == '?')
            s[n + 1 - i] = s[i];
        else
            return false;
    }
    return true;
}
void getCnt(int &cnt0, int &cnt1)
{
    for (int i = 1; i <= n; i++)
    {
        if (s[i] == '0')
            cnt0++;
        else if (s[i] == '1')
            cnt1++;
    }
    cnt0 = a - cnt0;
    cnt1 = b - cnt1;
}
void fillLast(int cnt0, int cnt1)
{
    for (int i = 1; i <= n / 2; i++)
    {
        if (s[i] != '?') continue;
        if (cnt1)
        {
            s[i] = s[n + 1 - i] = '1';
            cnt1 -= 2;
        }
        else if (cnt0)
        {
            s[i] = s[n + 1 - i] = '0';
            cnt0 -= 2;
        }
    }
}
int main()
{
    // freopen("C.in", "r", stdin);
    // freopen("C2.out", "w", stdout);
    cin >> T;
    while (T--)
    {
        cin >> a >> b;
        n = a + b;
        cin >> (s + 1);
        if (!checkValid() || !checkOneValid())
        {
            cout << -1 << endl;
            continue;
        }
        if (!makeValid())
        {
            cout << -1 << endl;
            continue;
        }
        int cnt1 = 0, cnt0 = 0;
        getCnt(cnt0, cnt1);
        if (cnt0 < 0 || cnt1 < 0)
        {
            cout << -1 << endl;
            continue;
        }
        fillLast(cnt0, cnt1);
        cout << (s + 1) << endl;
    }
    return 0;
}