var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var arr=input.trim().split("\n");
while(true){
   var mn=arr.shift();
   if(mn=="0 0")break;
   mn=mn.split(" ").map(Number);
   var m=mn[0];
   var n=mn[1];
   var ary=[];
   for(var i=0;i<18;i++)ary[i]=0;
   ary[0]=m;
   for(var j=1;j<=n;j++){
      if(j==n)m=1;
      var plus=[];
      for(var i=0;i<18;i++)plus[i]=0;
      ary.forEach(function(v,i){
         var k=v*m;
         if(k>=10000){
            ary[i]=k%10000;
            plus[i+1]+=Math.floor(k/10000);
         }else{
            ary[i]=k;
         }
      });
      ary.forEach(function(v,i){
         ary[i]=ary[i]+plus[i];
      });
   }
   var us=["","Man","Oku","Cho","Kei","Gai","Jo","Jou","Ko","Kan","Sei","Sai","Gok","Ggs","Asg","Nyt","Fks","Mts"];
   var str="";
   ary.forEach(function(v,i){
      if(v!=0)str=v+us[i]+str;
   });
   if(str=="")str=0;
   console.log(str);
}