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])
			// log.Println(table[row-1][col-1])
			ret = append(ret, table[row-1][col-1])
		}
		fmt.Println(strings.Join(ret, ""))
	}
}

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

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }

string str;

char conv(int i, int j) {
  int ord = (i-1) * 5 + (j-1);
  if (ord >= 0 && ord < 26) return 'a' + ord;
  if (ord == 26) return '.';
  if (ord == 27) return '?';
  if (ord == 28) return '!';
  if (ord == 29) return ' ';
  if (ord >= 30) return 'N';
}


string solve() {
  int n = str.size();
  if (n & 1) return "NA";
  string res = "";
  for (int i = 0; i < n; i += 2) {
    int a = str[i] - '0', b = str[i+1] - '0';
    //cout << a << ", " << b << endl;
    if (a < 1 || a > 6) return "NA";
    if (b < 1 || b > 5) return "NA";
    char c = conv(a, b);
    res += c;
  }
  return res; 
}

int main() {
  while (cin >> str) {
    cout << solve() << endl;
  }
}

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

int main()
{
	char tb[9][9];
	for(int i=1; i<=7; i++)
	for(int j=1; j<=6; j++)
		tb[i][j]='a'+(5*(i-1)+j-1);
		
	tb[6][2]='.';
	tb[6][3]='?';
	tb[6][4]='!';
	tb[6][5]=' ';
	
	string b;
	while(cin >> b)
	{
		string res;
		bool g=true;
		if(b.size()%2==1) g=false;
		else
		{
			for(int i=0; i<b.size(); i+=2)
			{
				int f=b[i]-'0', s=b[i+1]-'0';
				if(f<1&&f>6||s<1&&s>5)
				{
					g=false;
					break;
				}
				res+=tb[f][s];
			}
		}
		
		if(g) cout << res << endl;
		else cout << "NA" << endl;
		
	}
}

C++: #include<iostream>
using namespace std;
char M[6][6]={
	"abcde",
	"fghij",
	"klmno",
	"pqrst",
	"uvwxy",
	"z.?! "
};
string s;
main()
{
	while(cin>>s)
	{
		if(s.size()%2)
		{
			cout<<"NA"<<endl;
			continue;
		}
		bool f=1;
		for(int i=1;i<s.size();i+=2)if(s[i]>'5')f=0;
		if(!f)
		{
			cout<<"NA"<<endl;
			continue;
		}
		for(int i=0;i<s.size();i+=2)
		{
			cout<<M[s[i]-'1'][s[i+1]-'1'];
		}
		cout<<endl;
	}
}

C++: #include <iostream>

using namespace std;

char table[5][6] = {

  {'a','f','k','p','u','z'},
  {'b','g','l','q','v','.'},
  {'c','h','m','r','w','?'},
  {'d','i','n','s','x','!'},
  {'e','j','o','t','y',' '}

};

int main() {

  string buf;


  while(getline(cin,buf)) {

    if(buf.size()%2==1) goto NA;

    for(int i=0;i<buf.size();i++) {

      if(i%2==0 && (buf[i]-'0')<1 && (buf[i]-'0')>6) goto NA;

      if(i%2==1 && (buf[i]-'0')<1 && (buf[i]-'0')>5) goto NA;

    }

    for(int i=0;i<buf.size()/2;i++) {

      cout << table[(buf[2*i+1]-'0'-1)][(buf[2*i]-'0'-1)];

    }

    cout << endl;

    continue;

  NA:
    cout << "NA" << endl;

  }

  return 0;

}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstring>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(n) rep(i,n)
#define all(n) n.begin(),n.end()

string res[6];

const char OFS = '1';
int main()
{
    res[0] = "abcde";
    res[1] = "fghij";
    res[2] = "klmno";
    res[3] = "pqrst";
    res[4] = "uvwxy";
    res[5] = "z.?! ";

    string s;
    while(getline(cin, s))
    {
        bool na = false;
        int l = s.size();
        if(l%2) na = true;
        s = s + "z";
        REP(l/2)
        {
            if(s[i * 2] >= '7' || s[i*2] == '0') na = true;
            if(s[i * 2 + 1] >= '6' || s[i*2] == '0') na = true;
        }

        if(na){ cout << "NA" << endl; continue;}
        
        int v, h;
        REP(l/2){
            v = (int)(s[i*2] - OFS);
            h = (int)(s[i*2 +1] - OFS);
            cout << res[v][h] ;
            //cout << res[(char)(s[i*2] - OFS)][(char)(s[i*2+1] - OFS)];
        
        }
        cout << endl;

    }
    return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <complex>
#include <fstream>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }

int main()
{
    string table[6] = {	"abcde", "fghij", "klmno", "pqrst", "uvwxy", "z.?! "	};
	
	for(string line; cin >> line;)
	{
		if(line.size() % 2)
		{
			cout << "NA" << endl;
			continue;
		}
		
		string ans;
		rep(i, line.size() / 2) if('0' < line[i * 2] && '0' < line[i * 2 + 1])
			ans += table[line[i * 2] - '1'][line[i * 2 + 1] - '1'];
		
		if(ans.size() * 2 == line.size())
			cout << ans << endl;
		else
			cout << "NA" << endl;
	}
}