#include<iostream>
#include<string>
using namespace std;
int main(){
string str;
int a,b;
while(cin>>str>>a>>b){
if(a==0&&b==0)
break;
else{
for(int i=0;i<a;i++){
cout<<"B";
for(int j=0;j<a;j++)
cout<<" ";
for(int k=0;k<b;k++)
cout<<str;
cout<<endl;
}
for(int t=0;t<b;t++){
cout<<"B";
for(int j=0;j<a;j++)
cout<<str;
for(int k=0;k<b;k++)
cout<<" ";
for(int h=0;h<a;h++)
cout<<str;
cout<<endl;
}
for(int r=0;r<a;r++){
cout<<"B";
for(int j=0;j<a;j++)
cout<<" ";
for(int k=0;k<b;k++)
cout<<str;
cout<<endl;
}
cout<<endl;
}
}
return 0;
}
#include<string>
using namespace std;
int main(){
string str;
int a,b;
while(cin>>str>>a>>b){
if(a==0&&b==0)
break;
else{
for(int i=0;i<a;i++){
cout<<"B";
for(int j=0;j<a;j++)
cout<<" ";
for(int k=0;k<b;k++)
cout<<str;
cout<<endl;
}
for(int t=0;t<b;t++){
cout<<"B";
for(int j=0;j<a;j++)
cout<<str;
for(int k=0;k<b;k++)
cout<<" ";
for(int h=0;h<a;h++)
cout<<str;
cout<<endl;
}
for(int r=0;r<a;r++){
cout<<"B";
for(int j=0;j<a;j++)
cout<<" ";
for(int k=0;k<b;k++)
cout<<str;
cout<<endl;
}
cout<<endl;
}
}
return 0;
}