import std.stdio;
import std.bigint;
import std.conv;
import std.string;
import std.array;

void main(){
    auto c = array(["Man","Oku","Cho","Kei","Gai","Jo","Jou","Ko","Kan","Sei","Sai","Gok","Ggs","Asg","Nyt","Fks","Mts"][]);
    while(true){
	int m,n;
	auto s = readln().split().to!(int[]);
	m = s[0];
	n = s[1];
	if(m == 0 && n == 0) break;
	BigInt num = "1";
	BigInt p = to!string(m);
	for(int i=0;i<n;i++){
	    num *= p;
	}
	string ans = "";
	BigInt t = "100000000000000000000000000000000000000000000000000000000000000000000";
	for(int i=1;i<=17;i++){
	    auto syo = num / t;
	    
	    if(syo > 0){
		ans ~= to!string(syo) ~ c[17-i];
	    }
	    num %= t;
	    t /= 10000;
	}
	if(ans == "")
	    ans ~= to!string(num/t);
	ans.writeln();
    }
}