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 <vector>
#include <queue>
#include <stack>
#include <string>
#include <functional>
#include <algorithm>
#include <cctype>
using namespace std;

typedef long long ll;

string 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 main()
{
    string str;
    while(cin >> str) {
        if(str.size() % 2 == 1) {
            cout << "NA" << endl;
            continue;
        }

        bool ok = true;
        string ret = "";
        int a, b;
        for(int i = 0; i < str.size(); i++) {
            if(!isdigit(str[i])) {
                ok = false;
                break;
            }
            if(i % 2 == 0) {
                a = str[i] - '1';
            } else {
                b = str[i] - '1';
                if(a < 0 || a >= 6 || b < 0 || b >= 5) {
                    ok = false;
                    break;
                }
                ret += table[a][b];
            }
        }
            if(ok) {
                cout << ret << endl;
            } else {
                cout << "NA" << endl;
            }
    }
}

C++: #define _USE_MATH_DEFINES
#include <iostream>
#include <complex>
#include <algorithm>
#include <vector>
#include <stack>
#include <string>
#include <queue>
#include <cmath>
#include <math.h>
#include <numeric>
#include <list>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <climits>
#include <set>
#include <memory.h>
#include <memory>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cassert>
#include <map>
#include <cassert>
#include <time.h>

using namespace std;

typedef complex<double> xy_t;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int , P> PP;
typedef pair<int, string> Ps;
typedef vector<int> vec;
typedef vector<vec> mat;
const int INF= 1 << 30;
const double EPS = 1e-9;
const double PI = 3.1415926535897932384626433832795;

#define rep(i, n) for(int i = 0; i < n; i++)
string data = "afkpuzbglqv.chmrw?dinsx!ejoty ";

int main(){
	string s;
	while(cin >> s){
		if(s.size() % 2 != 0){
			cout << "NA" << endl;
			continue;
		}
		bool ok = true;
		string res(s.size()/2,' ');
		rep(i, (int)s.size()/2){
			int a = s[i*2] - '1';
			int b = s[i*2+1] - '1';
			if(a < 0 || 5 < a || b < 0 || 4 < b) {
				ok = false;
				break;
			}
			res[i] = data[b*6+a];
		}
		if(ok) cout << res << endl;
		else cout << "NA" << endl;
	}
	return 0;
}

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

int main(){

	int cnt, list[6][7];
	string str, s;

	for(int i=1; i<7; i++){
		for(int j=1; j<6; j++){
			if(i == 6 && j > 1){
				switch(j){
					case 2 : list[j][i] = '.'; break;
					case 3 : list[j][i] = '?'; break;
					case 4 : list[j][i] = '!'; break;
					case 5 : list[j][i] = ' '; break;
				}
			}
			else {
				list[j][i] = 'a' + 5 * (i - 1) + j - 1;
			}
		}
	}

	while(cin >> str){
		if(str.length() % 2 == 1){
			cout << "NA" << endl;
			continue;
		}
		
		s = "";
		for(int i=0; i<str.length(); i+=2){
			if(str[i] - '0' > 0 && str[i] - '0' < 7 && str[i+1] - '0' > 0 && str[i+1] - '0' < 6){
				s += list[str[i+1]-'0'][str[i]-'0'];
			}
			else {
				cout << "NA" << endl;
				break;
			}
			if(i == str.length() - 2) cout << s << endl;
		}
	}

	return 0;

}

C++: #include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctype.h>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
#include<string>
#include <sstream>
using namespace std;

//4方向ベクトル→↑←↓
int dx[] ={1,0,-1,0};
int dy[] ={0,-1,0,1};
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
string str;
char mozi[66];
string d;
int e;
int use;
char i ='a';
int main()
{
  for(int j = 1; j <=6;j++){
    for(int l = 1;l <=5;l++){
      if(j ==6&&l >=2)
	break;
      mozi[j*10+l] =i++;
	 }
      }
    mozi[62] ='.';
    mozi[63] ='?';
    mozi[64] ='!';
    mozi[65] =' ';
  while(cin>>str){
    string ans;
    if(str.size()%2){
      cout <<"NA"<<endl;
    }else{
      for(int i = 0;i <str.size();i+=2){
      d = str.substr(i, 2);
      e =toInt(d);
      if(e >=11&&e <=65)
	ans +=mozi[e];
      }
      cout <<ans<<endl;;
    }
  }
  return 0;
}

C++: #include <iostream>
#include <string>

using namespace std;
string table[66];

void solve()
{
	table[11] = "a";
	table[12] = "b";
	table[13] = "c";
	table[14] = "d";
	table[15] = "e";

	table[21] = "f";
	table[22] = "g";
	table[23] = "h";
	table[24] = "i";
	table[25] = "j";

	table[31] = "k";
	table[32] = "l";
	table[33] = "m";
	table[34] = "n";
	table[35] = "o";

	table[41] = "p";
	table[42] = "q";
	table[43] = "r";
	table[44] = "s";
	table[45] = "t";

	table[51] = "u";
	table[52] = "v";
	table[53] = "w";
	table[54] = "x";
	table[55] = "y";

	table[61] = "z";
	table[62] = ".";
	table[63] = "?";
	table[64] = "!";
	table[65] = " ";
	string s;
	while(cin >> s)
	{
		if(s.size() % 2 == 1)
		{
			cout << "NA" << endl;
			continue;
		}
		string ans = "";
		for(int i = 0; i < s.size() - 1; i += 2)
		{
			int a = (s[i] - '0') * 10 + (s[i + 1] - '0');
			if(!((11 <= a && a <= 15) || (21 <= a && a <= 25) || (31 <= a && a <= 35) ||(41 <= a && a <= 45) ||(51 <= a && a <= 55) ||(61 <= a && a <= 65)))
			{
				ans = "";
				break;
			}
			ans += table[a];
		}
		if(ans == "")
		{
			cout << "NA" << endl;
		}
		else
		{
			cout << ans << endl;
		}
	}
}

int main()
{
	solve();
	return(0);
}

C++: #include<bits/stdc++.h>
using namespace std;

int main(){
  string s;
  char data[5][7]={
    "afkpuz",
    "bglqv.",
    "chmrw?",
    "dinsx!",
    "ejoty "
  };

  while(cin>> s){
    if(s.size()%2){
      cout<< "NA"<< endl;
      continue;
    }
    string ans="";
    for(int i=0;i<s.size();i+=2){
      int y=s[i+1]-'1';
      int x=s[i]-'1';
      if(y<0 || y>4 || x<0 || x>5){
	ans="NA";
	break;
      }
      else ans+=data[y][x];
    }
    cout<< ans;     
    cout<< endl;
  }
}