// One local replacement trial on a 2x4 board. No external placement API.
#include <array>
#include <iostream>
#include <string>
using namespace std;
int main() {
    int removeMask,reward;
    if (!(cin>>removeMask>>reward) || (removeMask!=1 && removeMask!=3) || reward<0 || reward>1000) return 1;
    const array<string,2> original={".AB.",".AB."};
    auto candidate=original;
    int candidateScore=6;
    for (int id=0;id<2;++id) if (removeMask&(1<<id)) {
        for (auto &row:candidate) for (char &cell:row) if (cell=='A'+id) cell='.';
        candidateScore-=3;
    }
    bool placed=false;
    for (int x=0;x+3<=4;++x) {
        bool free=true;
        for (int y=0;y<2;++y) for (int c=x;c<x+3;++c) if (candidate[y][c]!='.') free=false;
        if (!free) continue;
        for (int y=0;y<2;++y) for (int c=x;c<x+3;++c) candidate[y][c]='C';
        candidateScore+=reward;
        placed=true;
        break;
    }
    bool accepted=placed && candidateScore>6;
    const auto &result=accepted?candidate:original;
    cout<<placed<<' '<<accepted<<' '<<candidateScore<<' '<<(accepted?candidateScore:6)<<'\n';
    for (const auto &row:result) cout<<row<<'\n';
}
