Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	table := [6][5]string{
		{"a", "b", "c", "d", "e"},
		{"f", "g", "h", "i", "j"},
		{"k", "l", "m", "n", "o"},
		{"p", "q", "r", "s", "t"},
		{"u", "v", "w", "x", "y"},
		{"z", ".", "?", "!", " "},
	}
	for scanner.Scan() {
		input := strings.Split(scanner.Text(), "")
		if len(input)%2 != 0 {
			fmt.Println("NA")
			continue
		}
		ret := make([]string, 0)
		for i := 0; i < len(input); i += 2 {
			row, _ := strconv.Atoi(input[i])
			col, _ := strconv.Atoi(input[i+1])
			ret = append(ret, table[row-1][col-1])
		}
		fmt.Println(strings.Join(ret, ""))
	}
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <map>
#include <set>
#include <cstdio>
#include <cmath>
#define rep(i,l,n) for(lint i=l;i<n;i++)
#define rer(i,l,n) for(lint i=l;i<=n;i++)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define pb(a) push_back(a)
#define mk(a,b) make_pair(a,b)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef vector<int> vi;
typedef vector<lint> vli;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

int main(){
	string s;
	while(cin>>s){
		if(s.size()%2){
			o("NA"); continue;
		}
		string ans="",t={"z.?! "};
		rep(i,0,s.size()/2){
			if(s[2*i]!='6'){
				ans+='a'+5*(s[2*i]-'1')+s[2*i+1]-'1';
			}else{
				ans+=t[s[2*i+1]-'1'];
			}
		}
		o(ans);
	}
}

C++: #include <iostream>
#include <algorithm>
using namespace std;

const string T= "abcdefghijklmnopqrstuvwxyz.?! ";

string conv(const string &s) {
  int n = s.size();
  if(n % 2 != 0) return "NA";
  string res;
  for(int i = 0; i < n; i += 2) {
    int a = s[i] - '0';
    int b = s[i+1] - '0';
    if(1 <= a && a <= 6) ; else return "NA";
    if(1 <= b && b <= 5) ; else return "NA";
    int k = (a-1)*5 + (b-1);
    res += T[k];
  }
  return res;
}

int main() {
  string s;
  while(cin >> s) {
    cout << conv(s) << endl;
  }
  return 0;
}

C++: #include <iostream>
#include <string>

using namespace std;
char table[7][6];
int main(){
	int i,j,x,y,f;
	char a,b;
	string str,t;
	for(i = 1;i <= 6;i++){
		for(j = 1;j <= 5;j++){
			if(i == 1){
				if(j == 1) table[i][j] = 'a';
				else if(j == 2) table[i][j] = 'b';
				else if(j == 3) table[i][j] = 'c';
				else if(j == 4) table[i][j] = 'd';
				else if(j == 5) table[i][j] = 'e';
			}
			else if(i == 2){
				if(j == 1) table[i][j] = 'f';
				else if(j == 2) table[i][j] = 'g';
				else if(j == 3) table[i][j] = 'h';
				else if(j == 4) table[i][j] = 'i';
				else table[i][j] = 'j';
			}
			else if(i == 3){
				if(j == 1) table[i][j] = 'k';
				else if(j == 2) table[i][j] = 'l';
				else if(j == 3) table[i][j] = 'm';
				else if(j == 4) table[i][j] = 'n';
				else table[i][j] = 'o';
			}
			else if(i == 4){
				if(j == 1) table[i][j] = 'p';
				else if(j == 2) table[i][j] = 'q';
				else if(j == 3) table[i][j] = 'r';
				else if(j == 4) table[i][j] = 's';
				else table[i][j] = 't';
			}
			else if(i == 5){
				if(j == 1) table[i][j] = 'u';
				else if(j == 2) table[i][j] = 'v';
				else if(j == 3) table[i][j] = 'w';
				else if(j == 4) table[i][j] = 'x';
				else table[i][j] = 'y';
			}
			else {
				if(j == 1) table[i][j] = 'z';
				else if(j == 2) table[i][j] = '.';
				else if(j == 4) table[i][j] = '!';
				else if(j == 3) table[i][j] = '?';
				else table[i][j] = ' ';
			}
		}
	}
	while(cin >> str){
		t = "\0";
		f = 1;
		if(str.size() % 2 == 0){
			for(i = 0;i < str.size();i += 2){
				a = str[i];
				b = str[i+1];
				x = (int)(a - '0');
				y = (int)(b - '0');
				if(x > 6 || y > 5 || x == 0 || y == 0){
					cout << "NA" << endl;
					f = 0;
					break;
				}
				if(f) t += table[x][y];
			}
			cout << t << endl;
		}
		else{
			cout << "NA" << endl;
		}
	}
	return 0;
}

C++: #include<iostream>
#include<string>

const char symbol[4] = { '.', '?', '!', ' ' };

int main()
{
	std::string s;
	while( std::cin >> s )
	{
		if( s.size() & 1 )
			std::cout << "NA" << std::endl;
		else
		{
			std::string res;
			bool f = true;

			for( int i = 0; i < s.size(); i += 2 )
			{
				if( s[i] < '0' || s[i] > '9' || s[i+1] < '0' || s[i+1] > '9' )
				{
					f = false; 
					break;
				}

				int n = ( s[i] - '1' ) * 5 + s[i+1] -'1';
	
				if( n > 29 )
				{
					f = false;
					break;
				}
				else
					res += n >= 26 ? symbol[n-26] : 'a' + n;
			}

			std::cout << ( f ? res : "NA" ) << std::endl;
		}
	}

	return 0;
}

C++: #include<iostream>
#include<string>

using namespace std;

string str[6];

void make(){
  str[1] = "afkpuz";
  str[2] = "bglqv.";
  str[3] = "chmrw?";
  str[4] = "dinsx!";
  str[5] = "ejoty ";
}
int main(){
  make();
  string in;
  while(cin >> in){
    if(in.length()%2){
      cout << "NA" << endl;
      continue;
    }
    for(int i = 0; i < in.length()-1; i+=2){
      cout << str[in[i+1]-'0'][in[i]-'0'-1];
    }
    cout << endl;
  }
  return 0;
}

C++: #include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctype.h>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
#include<string>
#include <sstream>
using namespace std;

//4方向ベクトル→↑←↓
int dx[] ={1,0,-1,0};
int dy[] ={0,-1,0,1};
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
string str;
char mozi[66];
string d;
int e;
int use;
char i ='a';
bool flag;
int main()
{
  for(int j = 1; j <=6;j++){
    for(int l = 1;l <=5;l++){
      if(j ==6&&l >=2)
	break;
      mozi[j*10+l] =i++;
	 }
      }
    mozi[62] ='.';
    mozi[63] ='?';
    mozi[64] ='!';
    mozi[65] =' ';
  while(cin>>str){
    string ans;
    if(str.size()%2){
      cout <<"NA"<<endl;
    }else{
      flag = false;
      for(int i = 0;i <str.size();i+=2){
      d = str.substr(i, 2);
      e =toInt(d);
      ans +=mozi[e];
      if(e<11||(e >15&&e <=20)||(e >25&&e <=30)||(e>35&&e <=40)||(e>45&&e <=50)||(e >55&&e <=60)||(e >65)){
	flag = true;
	break;
      }
      }
      if(flag){
	cout <<"NA"<<endl;
      }else{
	cout <<ans<<endl;
      }
    }
    ans.clear();
  }
  return 0;
}

C++: #include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
using namespace std;

typedef istringstream ISS;
typedef ostringstream OSS;
typedef vector<string> VS;
typedef int INT;
typedef vector<INT> VI;
typedef vector<VI> VVI;
typedef pair <INT, INT> II;
typedef vector <II> VII;

template<class T> ostream& operator << ( ostream& os, vector<T> v ) {
    for ( typename vector<T>::iterator it_i = v.begin(); it_i != v.end(); ++it_i ) {
        os << *it_i << ", ";
    }
    return os;
}


const string NA = "NA";
string s;

bool isValid( char c, char l, char r ) {
    return l <= c && c <= r;
}

const string T[6] = {
    "abcde",
    "fghij",
    "klmno",
    "pqrst",
    "uvwxy",
    "z.?! "
};

string solve() {
    string res;
    int n = s.size();
    for ( int i = 0; i < n; i += 2 ) {
        if ( i + 1 >= n ) return NA;
        if ( ! isValid( s[i], '1', '6' ) ) return NA;
        if ( ! isValid( s[i+1], '1', '5' ) ) return NA;
        int a = s[i] - '1';
        int b = s[i+1] - '1';
        res += T[a][b];
    }
    return res;
}

int main() {
    while ( getline( cin, s ) ) cout << solve() << endl;
    return 0;
}