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>
using namespace std;
 
int main(){
    char p[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',' '}};
    string s;   
    while(cin >> s){
        bool flag = false;
        for(size_t i=0;i<s.size();i+=2){
            if(s[i]>'6' || s[i]<'1' || s[i+1]>'5' || s[i]<'1')
                flag = true;
        }
        if(flag||s.size()%2){
            cout << "NA" << endl;
        }else{
            for(size_t i=0;i<s.size();i+=2){
                cout << p[s[i+1]-'0'-1][s[i]-'0'-1];
            }
            cout << endl;
        }
    }
}

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

int main() {
    string line;
    while (cin >> line) {
        if (line.size() % 2 != 0) {
            cout << "NA" << endl;
            continue;
        }
        string result;
        while (line.empty() != true) {
            if (line[0] < '1' || '6' < line[0] || line[1] < '1' || '5' < line[1]) {
                result = "NA";
                break;
            }
            char ch[3], add;
            ch[0] = line[0];
            ch[1] = line[1];
            if (ch[0] != '6') {
                add = 'a' + (line[0] - '1') * 5 + (line[1] - '1');
            } else {
                switch (ch[1]) {
                case '1':
                    add = 'z';
                    break;
                case '2':
                    add = '.';
                    break;
                case '3':
                    add = '?';
                    break;
                case '4':
                    add = '!';
                    break;
                case '5':
                    add = ' ';
                    break;
                default:
                    break;
                }
            }
            result += add;
            line.erase(0, 2);
        }
        cout << result << endl;
    }
}

C++: #include <iostream>

using namespace std;

char table[6][5] = {

{'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','.','?','!',' '}
};
int temp[2];

int main() {

    string mes;

    while (cin>>mes) {

        if (mes.length()%2!=0) cout << "NA" << endl;

        else {

            string res="";

            bool flag=false;
            for (int i=0; i<mes.length(); i++) {

                if (i%2!=0) {

                    temp[1] = mes[i] - '0';

                    if (temp[0]<1||temp[1]<1||temp[0]>6||temp[1]>5) {
                        flag = true;
                        break;
                    } else {
                        res += table[temp[0]-1][temp[1]-1];
                    }

                } else temp[0] = mes[i] - '0';

            }
            if (flag) cout << "NA" << endl;

            else cout << res << endl;

        }

    }

}

C++: #include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <cfloat>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>

using namespace std;

typedef unsigned int UI;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int,int> PII;
typedef istringstream ISS;
typedef ostringstream OSS;

#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); ++i )
#define EACH( v, c ) for ( auto &v : c )

#define ITER( c ) __typeof( (c).begin() )
#define IREP( c, it ) for ( ITER(c) it = c.begin(); it != c.end(); ++it )
#define ALL( c ) (c).begin(), (c).end()

#define PB( n ) push_back( n )
#define MP( a, b ) make_pair( ( a ), ( b ) )
#define EXIST( c, e ) ( (c).find( e ) != (c).end() )

#define fst first
#define snd second

#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define DEBUG( x ) cerr << __FILE__ << ":" << __LINE__ << ": " << #x << " = " << ( x ) << endl

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

string solve( string src )
{
	if ( src.size() % 2 )
	{
		return "NA";
	}

	string res;

	for ( int i = 0; i < src.size(); i += 2 )
	{
		int idx1 = src[i] - '1', idx2 = src[ i + 1 ] - '1';
		if ( !( 0 <= idx1 && idx1 < 6 && 0 <= idx2 && idx2 < 5 ) )
		{
			return "NA";
		}
		res += table[ idx1 ][ idx2 ];
	}

	return res;
}

int main()
{
	cin.tie( 0 );
	ios::sync_with_stdio( false );

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

	return 0;
}

C++: #include <stdio.h>
#include <string.h>
#pragma warning(disable : 4996)
char c[201], d[101];
int main() {
	while (~scanf("%s", c)) {
		if (strlen(c) % 2 == 1) {
			printf("NA\n");
		}
		else {
			bool flag = false;
			for (int i = 0; i < strlen(c); i += 2) {
				int a = c[i] - 48, b = c[i + 1] - 48;
				if (a == 0 || a > 6 || b == 0 || b > 5) {
					printf("NA"); flag = true; break;
				}
				else {
					int e = (a - 1) * 5 + (b - 1);
					switch (e) {
					case 26: d[i / 2] = '.'; break;
					case 27: d[i / 2] = '?'; break;
					case 28: d[i / 2] = '!'; break;
					case 29: d[i / 2] = ' '; break;
					default: d[i / 2] = (char)(e + 97); break;
					}
				}
			}
			if (!flag) {
				for (int i = 0; i < strlen(c) / 2; i++) {
					printf("%c", d[i]);
				}
			}
			printf("\n");
		}
	}
	return 0;
}

C++: #include<iostream>
#include<string>
using namespace std;
int main() {
	char a[6][5] = { {'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','.','?','!',' '} };
	string b;
	while (cin >> b) {
		string c = "";
		if (b.length() % 2 == 1) {
			cout << "NA" << endl;  goto stop;
		}
		int h, w;
		for (int i = 0; i < b.length() ; ) {
			h = (int)b[i++] - '0';
			w = (int)b[i++] - '0';
			if (h > 6 || w > 5) {
				cout << "NA" << endl;
				goto stop;
			}
			h--; w--;
			c += a[h][w];
			h = 0; w = 0;
		}
		cout << c << endl;
	stop:;
	}
}