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 <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;

string ans, s;
char table[6][8] = { "@@@@@@@", "@afkpuz", "@bglqv.", 
"@chmrw?", "@dinsx!", "@ejoty " };

int main(){
	while (cin >> s){
		ans = "";
		if (s.size() % 2 == 1){
			cout << "NA" << endl;
			continue;
		}
		for (int i = 0; i < s.size(); i += 2){
			ans += table[s[i + 1] - '0'][s[i] - '0'];
		}
		cout << ans << endl;
	}
}

C++: #include <stdio.h>
#include <math.h>
#include <string.h>
int main(){
	char table[7][6],moji,chara[5]={'z','.','?','!',' '},s[256];
	moji='a';
	for(int i=1;i<7;i++){
		for(int j=1;j<6;j++){
			if(i<6) table[i][j]=moji++;
			else table[i][j]=chara[j-1];
		}
	}
	while(~scanf("%s",s)){
		int length=strlen(s);
		if(length%2!=0) printf("NA");
		else{
			int i;
			for(i=1;i<length;i+=2) if(s[i-1]-48>6||s[i]-48>5) break;
			if(i>length) for(i=1;i<length;i+=2) printf("%c",table[s[i-1]-48][s[i]-48]);
			else printf("NA");
		}
		printf("\n");
	}
	return 0;
}

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

int main(){
char moji[5][7] = {{'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;
    char ans[1000];
    bool judge;
    while(cin >> s){
        memset(ans,0,sizeof(ans));
        judge = false;
        for(int i=0,j=0;i<s.size();i+=2,j++){
            if(s.size() % 2 != 0) {
                cout << "NA" << endl;
                judge = true;
                break;
            }
            if(!(s[i] >= '1' && s[i] <= '6' && s[i+1] >= '1' && s[i+1] <= '5')){
                cout << "NA" << endl;
                judge = true;
                break;
            }
            ans[j] =  moji[(s[i+1]%'0')-1][(s[i]%'0')-1];
        }
        if(!judge) cout << ans << endl;
    }
}

C++: #include <bits/stdc++.h>
using namespace std;
 
// infty
#define ULLINF (ULLONG_MAX)
#define LLINF  (LLONG_MAX)
#define IINF   (INT_MAX)
#define INF    (1<<29)
 
// math
#define Sq(x) ((x)*(x))
 
// container utility
#define ALL(x) (x).begin(), (x).end()
#define MP make_pair
#define PB push_back
#define EACH(it,c) for(__typeof((c).begin())it=(c).begin();it!=(c).end();it++)
 
// rep
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
 
// typedef
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<PII> VII;
typedef vector<VI> VVI;
 
typedef long long ll;
 
// pair util
#define FST first
#define SND second
 
// range validator
#define CK(n,a,b) (a<=n && n<b)
 
// conversion
template<class T> inline string toStr(T a) { ostringstream oss_; oss_ << a; return oss_.str(); }
inline int toInt(string s) { return atoi(s.c_str()); }
 
// prime
bool isPrime(int a) { for(int i=2; i*i <=a; i++) if(a%i == 0) return false; return true; }
 
int const dx[] = {-1,0,1,0,-1,1,1,-1};
int const dy[] = {0,-1,0,1,-1,-1,1,1};
 
//////////////////////////////////////////////////////////////
 
 
int main() {
   
  string s;
  while(cin >> s) {
     
    int const N = s.size();
     
    if(N%2) {
      cout << "NA" << endl;
      continue;
    }
     
    string output;
     
    for(int i=0; i<N; i+=2) {
      int a = s[i]-'0'-1; if(!CK(a, 0, 6)) { cout << "NA" << endl; goto EXIT; }
      int b = s[i+1]-'0'-1; if(!CK(b, 0, 5)) { cout << "NA" << endl; goto EXIT; }
       
      char ch = (char)('a' + a*5+b);
      if(!CK(ch,'a','z'+1)) {
    if(b == 1 && a == 5) ch = '.';
    else if(b == 2 && a == 5) ch = '?';
    else if(b == 3 && a == 5) ch = '!';
    else if(b == 4 && a == 5) ch = ' ';
      }
      output += ch;
    }
    cout << output << endl;
     
  EXIT:;
  }
   
  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 == 3) table[i][j] = '!';
				else if(j == 4) 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 <cstdio>
#include <string>
using namespace std;

int main(){
	string s;
	while(cin >> s){
		if(s.size()%2!=0) {
			printf("NA\n");
			continue;
		}
		
		int now=0;
		bool flag=false;
		string ans="";
		
		while(now<s.size()){
			int a=s[now]-'0', b=s[now+1]-'0';
			int p=(a-1)*5+b-1;
			
			//printf("a,b,p=%d,%d,%d\n",a,b,p);
			
			if(a<1 || 6<a || b<1 || 5<b){
				flag=true;
				break;
			}
			else if(p<=25) {
				string tmp(1,p+'a');
				ans.append(tmp);
			}
			else if(p==26) ans.append(".");
			else if(p==27) ans.append("?");
			else if(p==28) ans.append("!");
			else if(p==29) ans.append(" ");
			 
			now+=2;	
		}
		
		if(flag) printf("NA\n");
		else cout << ans << endl;
	}
	return 0;
}