unit = ['', 'Man', 'Oku', 'Cho', 'Kei', 'Gai', 'Jo', 'Jou', 'Ko', 'Kan', 'Sei', 'Sai', 'Gok', 'Ggs', 'Asg', 'Nyt', 'Fks', 'Mts']
while 1
  a,b = gets.split()
  if a=='0' then break end
  p = a.to_i**b.to_i
  s = ''
  for i in 0..17
    rem = p%10000
    if rem then s = rem.to_s + unit[i] + s end
    p /= 10000
  end
  puts s
end