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<bits/stdc++.h>
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',' '}
} ;

main(){
	string s ;
	while( cin >> s ){
		if( cin.eof() ) break ;
		if( s.size() % 2 ){
			cout << "NA" << endl ;
			continue ;
		}
		bool t = false ;
		for( int i=0 ; i<s.size() ; i+=2 ){
			if( s[i]-'0' >= 0 && s[i]-'0' <= 6 &&
				s[i+1]-'0' >= 0 && s[i+1]-'0' <= 5 ){}
			else t = true ;
		}
		
		if( t ){
			cout << "NA" << endl ;
			continue ;
		}
		
		for( int i=0 ; i<s.size() ; i+=2 ) cout << table[s[i+1]-'0'-1][s[i]-'0'-1] ;
		cout << endl ;
	}
}

C++: #include <iostream>
using namespace std;
int main(){
	char graph[6][7] = {{0,  0,  0,  0,  0,  0,  0},
											{0, 97,102,107,112,117,122},
											{0, 98,103,108,113,118,'.'},
											{0, 99,104,109,114,119,'?'},
											{0,100,105,110,115,120,'!'},
											{0,101,106,111,116,121,' '}};
	string s;
	while(cin >> s,!cin.eof()){
		string ans = "";
		if(s.size() % 2 == 1){cout << "NA" << endl;continue;};
		for(int i = 0;i < s.size();i += 2){
			if(s[i] - '0' <= 0 || s[i+1] - '0' <= 0 || s[i] - '0' > 6 || s[i+1] - '0' > 5){ans = "NA";break;}
			ans += graph[s[i+1]-'0'][s[i]-'0'];
		}
		cout << ans << endl;
	}	
}

C++: #include <iostream>
#include <string>
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;
    while(cin >> s){
        for(int i=0;i<s.size();i+=2){
            if(s.size() % 2 != 0) {
                cout << "NA";
                break;
            }
            if( (s[i]%'0'-1) > 6 || ((s[i]%'0'-1) < 1) || (s[i+1]%'0'-1) > 5 || ((s[i+1]%'0'-1) < 1) ){
                cout << "NA";
                break;
            }
            cout << moji[(s[i+1]%'0')-1][(s[i]%'0')-1];
        }
        cout << endl;
    }
}

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

char m[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','.','?','!',' '}
};

char f(int i, int j){
	return m[i][j];
}

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

C++: //03
#include<iostream>
#include<sstream>
#include<string>

using namespace std;

int main(){
  for(string s;getline(cin,s);){
    if(s.size()%2){
      goto err;
    }else{
      string o;
      for(int i=0;i*2<s.size();i++){
	const char *t="abcdefghijklmnopqrstuvwxyz.?! ";
	int idx=(s[i*2]-'1')*5+s[i*2+1]-'1';
	if(idx<0||idx>=30)goto err;
	o+=t[idx];
      }
      cout<<o<<endl;
      continue;
    }
  err:
    cout<<"NA"<<endl;
  }
  return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <sstream>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>

#define rep(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define all(v) (v).begin(), (v).end()
#define rev(s) (s).rbegin(), (s).rend()
#define MP make_pair
#define X first
#define Y second

using namespace std;

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

int main(){
	vector<string> t(6);
	string s = "afkpu";
	rep(i, 5) rep(j, 5){
		t[i].push_back(s[i]+j);
	}
	t[5] = "z.?! ";

	string in;
	while(cin >> in){
		string buf;
		bool ok = true;
		if(in.size()%2) ok = false;
		rep(i, in.size()){
			if(in[i] < '1' || in[i] > '6'-(i%2)) ok = false;
		}
		if(ok) for(int i = 0; i < in.size(); i+= 2){
			int a = in[i]-'1';
			int b = in[i+1]-'1';
			buf += t[a][b];
		}
		if(buf.size()) cout << buf << endl;
		else cout << "NA" << 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] && line[i * 2] <= '6' && '0' < line[i * 2 + 1] && line[i * 2 + 1] <= '6')
			ans += table[line[i * 2] - '1'][line[i * 2 + 1] - '1'];
		
		if(ans.size() * 2 == line.size())
			cout << ans << endl;
		else
			cout << "NA" << endl;
	}
}

C++: #include <iostream>
using namespace std;
char t[5][6];
int main()
{
    char c='a';
    for(int j=0;j<5;++j){
        for(int i=0;i<5;++i){
            t[i][j]=c;
            c++;
        }
    }
    t[0][5]='z';
    t[1][5]='.';
    t[2][5]='?';
    t[3][5]='!';
    t[4][5]=' ';
    string ns;
    while(cin>>ns)
    {
        if(ns.length()%2){
            cout<<"NA"<<endl;
        }else{
            for(int i=0;i<ns.length()-1;i+=2){
                cout<<t[ns[i+1]-'1'][ns[i]-'1'];
            }
            cout<<endl;
        }
    }
    return 0;
}

C++: #include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <iostream>
#include <sstream>
#include <climits>
#include <cfloat>

typedef long long ll;

using namespace std;

int main()
{
	char* table = "abcdefghijklmnopqrstuvwxyz.?! ";
	char buf[512];
	while (cin.getline(buf, sizeof(buf)))
	{
		if (strlen(buf) & 1)
		{
			puts("NA");
			continue;
		}

		char decode[256];
		memset(decode, 0, sizeof(decode));
		bool ok = true;
		for (int i = 0; buf[i] != '\0'; i += 2)
		{
			int c = buf[i] - '0' - 1;
			int r = buf[i+1] - '0' - 1;
			if (c < 0 || r < 0 || c > 5 || c > 5)
			{
				ok = false;
				break;
			}

			decode[i/2] = table[c*5 + r];
		}
		if (ok)
			puts(decode);
		else
			puts("NA");
	}

	return 0;
}