table = ((?a..?z).to_a + [?., ??, ?!, ' ']).each_slice(5).map{|a| a}

while gets
    s = ""
    if $_.size.even?
        puts 'NA'
        next
    end
    catch :exit do
        $_.chomp.split("").each_slice(2) do |i, j|
            begin
                s += table[i.to_i-1][j.to_i-1]
            rescue
                puts 'NA'
                throw :exit
            end
        end
        puts s
    end
end