#include <bits/stdc++.h>
using namespace std;
const int dx[]={0,1,0,-1,1,-1,-1,1};
const int dy[]={-1,0,1,0,1,1,-1,-1};
const int INF = 1<<30;
const double EPS = 1e-15;
#define PB push_back
#define mk make_pair
#define fi first
#define se second
#define ll long long
#define reps(i,j,k) for(int i = (j); i < (k); i++)
#define rep(i,j) reps(i,0,j)
#define MOD 1000000007
typedef pair<int,int> Pii;
typedef pair<Pii,Pii> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
bool compare(string a,string b){
    if(b.size() > a.size())return true;
    if(b.size() < a.size())return false;
    rep(i,a.size()){
        if(b[i] > a[i])return true;
        if(b[i] < a[i])return false;
    }
    return false;
}
string divide(string a){
    int carry = 0;
    string ans = "";
    rep(i,a.size()){
        int tmp = a[i]-'0'+10*carry;
        if(tmp == 1){
            carry = 1;
            if(i != 0)ans += "0";
            continue;
        }
        ans += (tmp/2)+'0';
        if(tmp%2==1){
            carry = 1;
        }
        else{
            carry = 0;
        }
    }
    return ans;
}
string long_calc_p(string a,string b){
    string ans = "";
    reverse(a.begin(),a.end());
    reverse(b.begin(),b.end());
    int sz;
    int mi;
    if(a.size() > b.size()){
        sz = a.size();
        mi = b.size();
    }
    else{
        sz = b.size();
        mi = a.size();
    }
    int carry = 0;
    rep(i,sz){
        if(i >= mi){
            if(mi == a.size()){
                int tmp = b[i]-'0'+carry;
                if(tmp > 9){
                    carry = 1;
                    ans += tmp-10+'0';
                }
                else{
                    carry = 0;
                    ans += tmp+'0';
                }
            }
            else{
                int tmp = a[i]-'0'+carry;
                if(tmp > 9){
                    carry = 1;
                    ans += tmp-10+'0';
                }
                else{
                    carry = 0;
                    ans += tmp+'0';
                }
            }
        }
        else{
            int tmp = a[i]-'0'+b[i]-'0'+carry;
            if(tmp > 9){
                carry = 1;
                ans += tmp-10+'0';
            }
            else{
                carry = 0;
                ans += tmp+'0';
            }
        }
    }
    if(carry)ans+="1";
    reverse(ans.begin(),ans.end());
    return ans;
}
string long_calc_m(string a,string b){
    string ans = "";
    string l="",r="";
    l = "0";
    rep(i,1020)r+="9";
    while(long_calc_p(l,"1") != r){
        string med = divide(long_calc_p(l,r));
        string tmp = long_calc_p(med,b);
        if(tmp == a){
            ans = med;
            break;
        }
        if(compare(a,tmp)){
            r = med;
        }
        else{
            l = med;
        }
    }
    if(ans == "")ans = "0";
    return ans;
}
string long_calc_t(string a,string b){
    string ans = "0";
    if(b.size()>a.size())swap(a,b);
    reverse(a.begin(),a.end());
    rep(i,b.size()){
        int carry = 0;
        string res = "";
        rep(j,a.size()){
            int tmp = (a[j]-'0')*(b[i]-'0')+carry;
            res += (tmp%10)+'0';
            carry = tmp/10;
        }
        if(carry)res += carry+'0';
        reverse(res.begin(),res.end());
        rep(j,b.size()-i-1){
            res+="0";
        }
        ans = long_calc_p(ans,res);
    }
    return ans;
}
char unit[18][4]={"","Man","Oku","Cho","Kei","Gai","Jo","Jou","Ko","Kan",
             "Sei","Sai","Gok","Ggs","Asg","Nyt","Fks","Mts"};
int main(){
    int N,M;
    while(true){
        string  ans = "1";
        scanf("%d%d",&N,&M);
        if(N == 0 && M == 0)break;
        string base = "";
        while(N){
            base += N%10+'0';
            N/=10;
        }
        reverse(base.begin(),base.end());
        rep(i,M){
            ans = long_calc_t(ans,base);
        }
        reverse(ans.begin(),ans.end());
        int l = ans.size()%4==0?4:ans.size()%4;
        rep(i,4-l)ans+="0";
        int len = ans.size();
        reverse(ans.begin(),ans.end());
        for(int i = 0; i < len;i+=4){
            string tmp="";
            bool f = false;
            for(int j = i; j < i+4; j++){
                if(!f && ans[j] == '0')continue;
                f=true;
                tmp += ans[j];
            }
            if(tmp.size()){
                cout << tmp;
                cout << unit[len/4-i/4-1];
            }
        }
        puts("");
    }
    return 0;
}

Measured memory_bytes: 1216