#include <iostream>
#include <string>
using namespace std;

int main()
{
string c1,c2,k;
int a1,a2,l1,l2;
cin>>k;
cin>>a1>>a2;
c1=k.at(0);
c2=k.at(1);
l1=a1;
l2=a2;
if ((a1-a2)>2||(a2-a1)>2)
    cout<<"nemoguce";
else
while(a1!=0 && a2!=0)
{
    cout<<c1;
    a1=a1-1;
    cout<<c2;
    a2=a2-1;

}
;

cout<<endl;
while(l1!=0 && l2!=0)
{
    cout<<c2;
    l2=l2-1;
    cout<<c1;
    l1=l1-1;

}



    return 0;
}