#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1e9+7
#define pb push_back
bool check(string s, ll n)
{
// cout<<n<<"\n";
ll ptr1=0 , ptr2 = n-1;
while(ptr1<=ptr2)
{
if(s[ptr1]!=s[ptr2])
return 0;
ptr1++;
ptr2--;
}
return 1;
}
void solve()
{
int a,b;
cin>>a>>b;
string s;cin>>s;
ll n = s.size();
ll cnt0=0,cnt1=0;
for(ll i=0;i<n;i++)
{
if(s[i]=='0')
cnt0++;
if(s[i]=='1')
cnt1++;
}
int aa=a;
int bb=b;
a-=cnt0;
b-=cnt1;
ll ptr1=0,ptr2=n-1;
while(ptr1<=ptr2)
{
// cout<<s<<"\n";
// cout<<ptr1<<" "<<ptr2<<"\n";
if(s[ptr1]=='?' && s[ptr2]=='?')
{
if(a>b)
{
s[ptr1]='0';
s[ptr2]='0';
ptr1==ptr2 ? a-=1 : a-=2;
ptr1++;
ptr2--;
continue;
}
if(b>a)
{
s[ptr1]='1';
s[ptr2]='1';
ptr1==ptr2 ? b-=1 : b-=2;
ptr1++;
ptr2--;
continue;
}
s[ptr1]='1';
s[ptr2]='1';
ptr1==ptr2 ? b-=1 : b-=2;
ptr1++;
ptr2--;
continue;
}
if(s[ptr1]=='?' && s[ptr2] == '1')
{
s[ptr1] = '1';
ptr1++;
ptr2--;
b-=1;
continue;
}
if(s[ptr1]=='?' && s[ptr2] == '0')
{
s[ptr1] = '0';
ptr1++;
ptr2--;
a-=1;
continue;
}
if(s[ptr1]=='1' && s[ptr2] == '?')
{
s[ptr2] = '1';
// cout<<s[ptr2];
ptr1++;
ptr2--;
b-=1;
continue;
}
if(s[ptr1]=='0' && s[ptr2] == '?')
{
s[ptr2] = '0';
ptr1++;
ptr2--;
a-=1;
continue;
}
ptr1++;
ptr2--;
}
// cout<<a<<" "<<b<<"\n";
if(a<0 || b<0){
cout<<"-1\n";
return ;
}
ll mn = aa+bb;
if(check(s , mn))
{
cout<<s<<"\n";
}
else
cout<<"-1\n";
// cout<<s;
}
int main()
{
int t=1;
cin>>t;
while(t--)
{
solve();
}
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKI2RlZmluZSBsbCBsb25nIGxvbmcKI2RlZmluZSBtb2QgMWU5KzcKI2RlZmluZSBwYiBwdXNoX2JhY2sKCgpib29sIGNoZWNrKHN0cmluZyBzLCBsbCBuKQp7CgogICAgLy8gY291dDw8bjw8IlxuIjsKICAgIGxsIHB0cjE9MCAsIHB0cjIgPSBuLTE7CgogICAgd2hpbGUocHRyMTw9cHRyMikKICAgIHsKICAgICAgICBpZihzW3B0cjFdIT1zW3B0cjJdKQogICAgICAgICAgICByZXR1cm4gMDsKCiAgICAgICAgcHRyMSsrOwogICAgICAgIHB0cjItLTsKCiAgICB9CgogICAgcmV0dXJuIDE7Cn0KCiAKdm9pZCBzb2x2ZSgpCnsKICAgIGludCBhLGI7CiAgICBjaW4+PmE+PmI7CgogICAgc3RyaW5nIHM7Y2luPj5zOwoKICAgIGxsIG4gPSBzLnNpemUoKTsKCiAgICBsbCBjbnQwPTAsY250MT0wOwoKICAgIGZvcihsbCBpPTA7aTxuO2krKykKICAgIHsKICAgICAgICBpZihzW2ldPT0nMCcpCiAgICAgICAgICAgIGNudDArKzsKICAgICAgICBpZihzW2ldPT0nMScpCiAgICAgICAgICAgIGNudDErKzsKICAgIH0KCiAgICBpbnQgYWE9YTsKICAgIGludCBiYj1iOwoKICAgIGEtPWNudDA7CiAgICBiLT1jbnQxOwoKCgogICAgbGwgcHRyMT0wLHB0cjI9bi0xOwoKICAgIHdoaWxlKHB0cjE8PXB0cjIpCiAgICB7CiAgICAgICAgIC8vIGNvdXQ8PHM8PCJcbiI7CiAgICAgICAgIC8vIGNvdXQ8PHB0cjE8PCIgIjw8cHRyMjw8IlxuIjsKCiAgICAgICAgaWYoc1twdHIxXT09Jz8nICYmIHNbcHRyMl09PSc/JykKICAgICAgICB7CiAgICAgICAgICAgIGlmKGE+YikKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgc1twdHIxXT0nMCc7CiAgICAgICAgICAgICAgICBzW3B0cjJdPScwJzsKICAgICAgICAgICAgICAgIHB0cjE9PXB0cjIgPyBhLT0xIDogYS09MjsKCiAgICAgICAgICAgICAgICBwdHIxKys7CiAgICAgICAgICAgICAgICBwdHIyLS07CiAgICAgICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBpZihiPmEpCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIHNbcHRyMV09JzEnOwogICAgICAgICAgICAgICAgc1twdHIyXT0nMSc7CiAgICAgICAgICAgICAgICBwdHIxPT1wdHIyID8gYi09MSA6IGItPTI7CgogICAgICAgICAgICAgICAgcHRyMSsrOwogICAgICAgICAgICAgICAgcHRyMi0tOwogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgICAgfQoKICAgICAgICAgICAgICAgIHNbcHRyMV09JzEnOwogICAgICAgICAgICAgICAgc1twdHIyXT0nMSc7CiAgICAgICAgICAgICAgICBwdHIxPT1wdHIyID8gYi09MSA6IGItPTI7CgogICAgICAgICAgICAgICAgcHRyMSsrOwogICAgICAgICAgICAgICAgcHRyMi0tOwogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICBjb250aW51ZTsKICAgICAgICB9CgogICAgICAgIGlmKHNbcHRyMV09PSc/JyAmJiBzW3B0cjJdID09ICcxJykKICAgICAgICB7CiAgICAgICAgICAgIHNbcHRyMV0gPSAnMSc7CiAgICAgICAgICAgIHB0cjErKzsKICAgICAgICAgICAgcHRyMi0tOwogICAgICAgICAgICBiLT0xOwogICAgICAgICAgICBjb250aW51ZTsKICAgICAgICB9CgogICAgICAgIGlmKHNbcHRyMV09PSc/JyAmJiBzW3B0cjJdID09ICcwJykKICAgICAgICB7CiAgICAgICAgICAgIHNbcHRyMV0gPSAnMCc7CiAgICAgICAgICAgIHB0cjErKzsKICAgICAgICAgICAgcHRyMi0tOwogICAgICAgICAgICBhLT0xOwogICAgICAgICAgICBjb250aW51ZTsKICAgICAgICB9CgogICAgICAgIGlmKHNbcHRyMV09PScxJyAmJiBzW3B0cjJdID09ICc/JykKICAgICAgICB7CiAgICAgICAgICAgIHNbcHRyMl0gPSAnMSc7CiAgICAgICAgICAgIC8vIGNvdXQ8PHNbcHRyMl07CiAgICAgICAgICAgIHB0cjErKzsKICAgICAgICAgICAgcHRyMi0tOwogICAgICAgICAgICBiLT0xOwogICAgICAgICAgICBjb250aW51ZTsKICAgICAgICB9CgogICAgICAgIGlmKHNbcHRyMV09PScwJyAmJiBzW3B0cjJdID09ICc/JykKICAgICAgICB7CiAgICAgICAgICAgIHNbcHRyMl0gPSAnMCc7CiAgICAgICAgICAgIHB0cjErKzsKICAgICAgICAgICAgcHRyMi0tOwogICAgICAgICAgICBhLT0xOwogICAgICAgICAgICBjb250aW51ZTsKICAgICAgICB9CgogICAgICAgIHB0cjErKzsKICAgICAgICBwdHIyLS07CiAgICB9CgogICAgLy8gY291dDw8YTw8IiAiPDxiPDwiXG4iOwoKICAgIGlmKGE8MCB8fCBiPDApewogICAgICAgIGNvdXQ8PCItMVxuIjsKICAgICAgICByZXR1cm4gOwogICAgfQoKICAgIGxsICBtbiA9IGFhK2JiOwoKICAgIGlmKGNoZWNrKHMgLCBtbikpCiAgICB7CiAgICAgICAgY291dDw8czw8IlxuIjsKICAgIH0KICAgIGVsc2UKICAgICAgICBjb3V0PDwiLTFcbiI7CgogICAgLy8gY291dDw8czsKfQogCmludCAgbWFpbigpCnsKICAgIGludCB0PTE7CiAgICBjaW4+PnQ7CgogICAgd2hpbGUodC0tKQogICAgewogICAgICAgIHNvbHZlKCk7CiAgICB9Cn0=