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<vector>
#include<string>
using namespace std;

int main() {
	string a;
	while (1) {
	k:;
		cin >> a;
		if (cin.fail())break;
		if (a.length() % 2) { cout << "NA" << endl; continue;}
		for (int b = 0; b < a.length(); b += 2) {
			if (a[b]<'1' || a[b]>'6' || a[b + 1]<'1' || a[b + 1]>'5') { cout << "NA" << endl; goto k; }
			int s = (a[b] - 49) * 5 + (a[b + 1] - 49);
			if ((s + 97) < '{')	cout << (char)(s + 97);
			else {
				switch (s + 97) {
				case 123:cout << '.'; break;
				case 124:cout << '?'; break;
				case 125:cout << '!'; break;
				case 126:cout << ' '; break;
				}
			}
		}
		cout << endl;
	}
}

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){
	if (s.size() % 2) cout << "NA" << endl;
	else {
	    for (int i = 0; i < s.size()-1; i+=2){
		cout << map[s[i]-'0'-1][s[i+1]-'0'-1];
	    }
	    cout << endl;
	}
    }
}

C++: #define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;

//#define int long long
#define DBG 0
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)
#define all(c) c.begin(),c.end()
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);

signed main() {
	string s;
	vector<vector<char>>v(7, vector<char>(7));
	char a = 'a';
	rep(j, 1, 7) {
		rep(i, 1, 6) {
			v[i][j] = a++;
		}
	}

	v[2][6] = '.'; v[3][6] = '?'; v[4][6] = '!'; v[5][6] = ' ';
	rep(i, 0, 6)dumpc(v[i]);
	while (cin >> s) {
		string ans;
		if (s.size() & 1) {
			cout << "NA" << endl;
			continue;
		}
		bool f(false);
		rep(i, 0, s.size()) {
			if (!('1' <= s[i] && s[i] <= '6')) {
				cout << "NA" << endl;
				goto here;
			}
		
		}
		for (int i = 0; i + 1 < s.size(); i += 2) {
			ans += v[s[i + 1] - '0'][s[i] - '0'];
		}
		cout << ans << endl;
	here:
		;
	}
	return 0;
}

C++: #include <iostream>

#include <vector>

#include <algorithm>

#include <sstream>

#include <string>

#include <cmath>

#include <list>

#include <set>
#include <cstdlib>
using namespace std;

int in() {int x; cin >> x; return x;}

template <typename T> class SegTree

{

public:

	int n;

	T T_max;

	vector<T> dat;

	SegTree(int n_, T t_max)

	{

		int n = 1;

		T_max = t_max;

		while (n < n_)n *= 2;

		for (int i = 0; i < 2 * n - 1; i++)dat.push_back(t_max);

	}

	void update(int k, T a)

	{

		k += n - 1;

		dat[k] = a;

		while (k > 0)

		{

			k = (k - 1) / 2;

			dat[k] = min(dat[k * 2 + 1], dat[k * 2 + 2]);

		}

	}



	//[a,b)

	T query(int a, int b)

	{

		return _query(a, b, 0, 0, n);

	}



private:

	T _query(int a, int b, int k, int l, int r)

	{

		if (r <= a || b <= l)return T_max;

		if (a <= l && r <= b)return dat[k];

		else

		{

			T vl = _query(a, b, k * 2 + 1, l, (l + r) / 2);

			T vr = _query(a, b, k * 2 + 2, (l + r) / 2, r);

			return min(vr, vl);

		}

	}

};

int main()
{
	string a = " abcdefghijklmnopqrstuvwxyz.?! ";
	string b;
	while (cin >> b)
	{
		string ans;
		if (b.size() % 2)
		{
			cout << "NA" << endl;
			continue;
		}
		for (int i = 0; i < b.size(); i += 2)
		{
			int A = b[i] - '0';
			int B = b[i + 1] - '0';
			if (A < 0 || A > 6)
			{
				ans = "NA";
				break;
			}
			if (B < 0 || B > 5)
			{
				ans = "NA";
				break;
			}
			A--;
			int C = A * 5 + B;
			if (C > 30)
			{
				ans = "NA";
				break;
			}
			ans += a[C];
		}
		cout << ans << endl;
	}
}

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

char s[6][6] = {
	"abcde",
	"fghij",
	"klmno",
	"pqrst",
	"uvwxy",
	"z.?! "
};

int main(void){
	string str;

	while(cin>>str){
		if(str.length() % 2 == 1){
			cout<<"NA\n";
			continue;
		}
		string ans = "";
		bool flg = false;
		for(int i=0;i<str.length();i+=2){
			int a = str[i] - '1';
			int b = str[i+1] - '1';
			if(a >= 6 || b >= 5){
				cout<<"NA\n";
				flg = true;
				break;
			}
			else{
				ans += s[a][b];
			}
		}
		if(flg) continue;
		cout<<ans<<endl;
	}

	return 0;
}

C++: #include<iostream>
#include<string>
using namespace std;
int main() {
	const char r[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) {
		string str;
		bool b = true;
		if (s.size() % 2 == 1) { b = false; }
		else for (int i = 0; i < s.size(); i += 2) {
			int a, bc;
			a = s[i] - '0';
			bc = s[i + 1] - '0';
			if (a >= 7 || bc >= 6) {
				b = false;
			}
			else str += r[a - 1][bc - 1];
		}
		if (b) {
			cout << str << endl;
		}
		else cout << "NA" << endl;
	}
}

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

using namespace std;
const int dx[] = {1,0,-1,0},dy[] = {0,1,0,-1};
#define INF 1e+9
#define EPS 1e-9
#define rep(i,j) for(int i = 0; i < (j); i++)
#define reps(i,j,k) for(int i = j; i < (k); i++)
typedef long long ll;
char num[256];
char decode[][7] = {{0,0,0,0,0},
                   {0,'a','b','c','d','e'},
                   {0,'f','g','h','i','j'},
                   {0,'k','l','m','n','o'},
                   {0,'p','q','r','s','t'},
                   {0,'u','v','w','x','y'},
                   {0,'z','.','?','!',' '}};
string change(){
    if(strlen(num)%2 == 1)return "NA";
    string ans = "";
    for(int i = 0; i < strlen(num); i+=2){
        if(num[i] == '0' || num[i+1] == '0' || num[i] > '6' || num[i+1] > '6')return "NA";
        ans += decode[num[i]-48][num[i+1]-48];
    }
    return ans;
}
int main(){
    while(~scanf("%s",num)){
        cout << change() << endl;
    }
    return 0;
}

C++: #include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt"
int main() {
	string st;
	while (getline(cin,st)) {
		string ans;
		bool ok = true;
		if (st.size() % 2)ok = false;
		for (int i = 0; i < st.size() / 2; ++i) {
			string ast = st.substr(2 * i, 2);
			int num = (ast[0] - '1') * 5 + (ast[1] - '1');
			if (0<=num&&num <= 25)ans += 'a' + num;
			else if (num == 26)ans += '.';
			else if (num == 27)ans += '?';
			else if (num == 28)ans += '!';
			else if (num == 29)ans += " ";
			else {
				ok = false;
				break;
			}
		}
		if (ok) {
			cout << ans << endl;
		}
		else {
			cout << "NA" << endl;
		}
	}
	return 0;
}