#include<bits/stdc++.h>

using namespace std;

#define endl "\n";

void solve();

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int t; 
    cin >> t;
    while (t--) solve();
    return 0;
}


void solve() {
    int a,b;
    string s;
    cin>>a>>b;
    cin>>s;
    int n=s.length();
    if(a+b != n){ 
      cout<<-1<<endl;
      return;
    }
    for(int i=0;i<n;i++){
      if(s[i]!='?' && s[n-1-i]!='?' && s[i]!=s[n-1-i]){cout<<-1<<endl;return;}
      if(s[i]=='0') a--;
      else if(s[i]=='1') b--;
      else if(s[n-1-i]!='?'){
        if(s[n-1-i]=='0') {
          s[i]='0';
          a--;
        } else{
          s[i]='1';
          b--;
        }
      }
    }
    for(int i=0;i<n;i++){
      if(s[i]=='?'){
        if(i==n-1-i){
          if(a&1){ s[i]='0';a--; }
          else if(b&1) { s[i]='1';b--; }
          else { cout<<-1<<endl;return; } 
        } else if(a>=2) {
          s[i]='0';s[n-1-i]='0';a-=2;
        } else if(b>=2) {
          s[i]='1';s[n-1-i]='1';b-=2;
        } else{
          cout<<-1<<endl;return;
        }
      } 
    }
    if(a!=0 && b!=0){ cout<<-1<<endl;return; }
    cout<<s<<endl;
    return;
}
