const rl = require("readline").createInterface({ input: process.stdin });
var iter = rl[Symbol.asyncIterator]();
const readline = async () => (await iter.next()).value;
void (async function () {
const m = Number(await readline());
const n = Number(await readline());
const seq = await readline();
const tags = [];
for (let i = 0; i < n; i++) {
const tag = new Array(m).fill(0);
tags.push(tag);
}
for (let i = 0; i < seq.length; i++) {
const c = seq[i];
switch (c) {
case "A": {
for (const tag of tags) {
if (tag.indexOf(0) !== -1) {
tag[tag.indexOf(0)] = 1;
break;
}
}
break;
}
case "B": {
for (const tag of tags) {
const idx = tag.indexOf(0);
if (idx <= tag.length - 2) {
tag[idx] = 1;
tag[idx + 1] = 1;
break;
}
}
break;
}
case "C": {
for (const tag of tags) {
const idx = tag.indexOf(0);
if (idx <= tag.length - 8) {
tag[idx] = 1;
tag[idx + 1] = 1;
tag[idx + 2] = 1;
tag[idx + 3] = 1;
tag[idx + 4] = 1;
tag[idx + 5] = 1;
tag[idx + 6] = 1;
tag[idx + 7] = 1;
break;
}
}
break;
}
}
}
for (const tag of tags) {
console.log(tag.join(""));
}
})();