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<cstdio>
#include<vector>
#include<algorithm>
#include<cstring>
using namespace std;
int main(){
    char l[6][6]={{0}};
    for(int i=0;i<5;i++){
        for(int j=0;j<5;j++)
            l[i][j]='a'+i*5+j;
    }
    strcpy(l[5],"z.?! ");

    char str[256];
    while(scanf("%s",str)!=EOF){
        if(strlen(str)&1){
            puts("NA");
            continue;
        }
        char ans[128]={0};
        for(int i=0;str[i];i+=2){
            int v1=str[i]-'0'-1,v2=str[i+1]-'0'-1;
            if(v1<0||v1>=6||v2<0||v2>=5){
                puts("NA");
                break;
            }
            ans[i/2]=l[v1][v2];
        }
        printf("%s\n",ans);
    }
    return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

char c[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 main(){
	
	bool checker;
	
	string str;
	
	while(true){
		cin >> str;
		if(cin.eof()){
			break;
		}
		
		checker = false;
		
		for(int i = 0; i < str.size(); i++){
			if(str[i] < '1' || str[i] > '6'){
				printf("NA\n");
				checker = true;
				break;
			}
		}
		
		if(checker){
			continue;
		}
		
		if(str.size() % 2 != 0){
			printf("NA\n");
			continue;
		}
		for(int i = 0; i < str.size(); i += 2){
			if(str[i + 1] - '0' - 1 >= 5){
				printf("NA");
				break;
			}
			printf("%c", c[str[i] - '0' - 1][str[i + 1] - '0' - 1]);
		}
		printf("\n");
	}
	
	return 0;
}

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 = ' ';
	else { cout << "NA" << endl; goto EXIT; }
      }
      output += ch;
    }
    cout << output << endl;
    
  EXIT:;
  }
  
  return 0;
}

C++: #include "bits/stdc++.h"

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;

#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back

int main(){
    char ch[10][10]={ {'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 s;
    while(cin>>s){
        int len=s.size();
        string ans="";
        
        try{
            if(len%2==1)throw 1;
            for(int i=0;i<len;i+=2){
                int a,b;
                if(s[i]<'1' || '6'<s[i] || s[i+1]<'1' || '5'<s[i+1] )throw 1;
                a=s[i]-'0'-1;
                b=s[i+1]-'0'-1;
            
                ans+=ch[a][b];
            }
        }catch(int a){
            cout<<"NA"<<endl;
            goto next;
        }
        cout<<ans<<endl;
        next:;
    }
}

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


int main(){
    char map[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 s;
    while (cin >> s){
	bool err = false;
	for (int i = 0; i < s.size(); i++){
	    if (i % 2 && (s[i] > '5' || s[i] < '0')) err = true;
	    else if (i % 2 == 0 && (s[i] > '6' || s[i] < '0')) err = true;
	}
	if (s.size() % 2 || err) cout << "NA" << endl;

	else {
	    for (int i = 0; i < s.size(); i+=2){
		cout << map[s[i]-'0'-1][s[i+1]-'0'-1];
	    }
	    cout << endl;
	}
    }
}

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

int main()
{
	string table[6] = { "abcde", "fghij", "klmno", "pqrst", "uvwxy", "z.?! " };
	string s;
	int a,b;
	while (cin>>s)
	{
		int flg = 0;
		string ans;
		if (s.size()%2==1)		//?????????????\???°?????´???
		{
			cout << "NA" << endl;
		}
		else
		{
			for (int i = 0; i < s.size(); i += 2)
			{
				if ((s[i] >= '1') && (s[i] <= '6') && (s[i + 1] >= '1') && (s[i + 1] <= '5'))	//??¨???????????§????????´???
				{
					a = s[i] - '0'-1;
					b = s[i + 1] - '0'-1;
					flg = 1;
					ans += table[a][b];
				}
			}
			if (flg)
			{
				cout << ans <<endl;
			}
			else
			{
				cout << "NA" <<endl;		//1????????§???????????§???????????´???
			}
		}
	}

	return 0;
}

C++: #include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#include<complex>
#include<map>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vvc vector<vector<char>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define CC puts("-------ok--------");
#define all(in) in.begin(), in.end()
using namespace std;
typedef pair<int, int> pii;
#define MAX 99999999
int main(){
    char u[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 s;
    while(cin>>s,1){
        bool flag=true;
        if(s.length()%2){cout<<"NA"<<endl; flag=false;}
    if(flag){
    vector<pii>v(1000);
    rep(i,s.length()/2){
        v[i]=pii(s[2*i]-48,s[2*i+1]-48);
        if(v[i].first>=7||v[i].second>=6){goto E;}
    }
    rep(i,s.length()/2)
    cout<<u[v[i].first-1][v[i].second-1];
    cout<<endl;
    }
    E:;
}
}