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 <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 || C <= 0)
			{
				ans = "NA";
				break;
			}
			ans += a[C];
		}
		cout << ans << endl;
	}
}

C++: #include<iostream>
#include<string>
using namespace std;
int main() {
	string s;
	while (cin >> s){
		if (s.size() % 2 != 0) { 
			cout << "NA"; 
			goto P;
		}
		for (int i = 0; i < s.size(); i += 2){
			if (s[i] == '1'){
				if (s[i + 1] == '1')cout.put('a');
				else if (s[i + 1] == '2')cout.put('b');
				else if (s[i + 1] == '3')cout.put('c');
				else if (s[i + 1] == '4')cout.put('d');
				else if (s[i + 1] == '5')cout.put('e');
			}
			else if (s[i] == '2'){
				if (s[i + 1] == '1')cout.put('f');
				else if (s[i + 1] == '2')cout.put('g');
				else if (s[i + 1] == '3')cout.put('h');
				else if (s[i + 1] == '4')cout.put('i');
				else if (s[i + 1] == '5')cout.put('j');
			}
			else if (s[i] == '3'){
				if (s[i + 1] == '1')cout.put('k');
				else if (s[i + 1] == '2')cout.put('l');
				else if (s[i + 1] == '3')cout.put('m');
				else if (s[i + 1] == '4')cout.put('n');
				else if (s[i + 1] == '5')cout.put('o');
			}
			else if (s[i] == '4'){
				if (s[i + 1] == '1')cout.put('p');
				else if (s[i + 1] == '2')cout.put('q');
				else if (s[i + 1] == '3')cout.put('r');
				else if (s[i + 1] == '4')cout.put('s');
				else if (s[i + 1] == '5')cout.put('t');
			}
			else if (s[i] == '5') {
				if (s[i + 1] == '1')cout.put('u');
				else if (s[i + 1] == '2')cout.put('v');
				else if (s[i + 1] == '3')cout.put('w');
				else if (s[i + 1] == '4')cout.put('x');
				else if (s[i + 1] == '5')cout.put('y');
			}
			else if (s[i] == '6'){
				if (s[i + 1] == '1')cout.put('z');
				else if (s[i + 1] == '2')cout.put('.');
				else if (s[i + 1] == '3')cout.put('?');
				else if (s[i + 1] == '4')cout.put('!');
				else if (s[i + 1] == '5')cout.put(' ');
			}
		}
	P:
		cout << endl;
	}
}

C++: #include<stdio.h>
#include<string>
#include<stdlib.h>
#include<math.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<numeric>
#include<string.h>
#include<map>

using namespace std;

typedef pair<int,int> pii;

#define rep(i,j) for(int i=0;i<(j);i++)
#define reps(i,j,k) for(int i=j;i<=k;i++)


int main(){
	char s[5][7]={
		"afkpuz",
		"bglqv.",
		"chmrw?",
		"dinsx!",
		"ejoty ",
	};
	char t[201],o[101];;
	int l,f,x,y;
	while(~scanf("%s",t)){
		f=0;
		l=strlen(t);
		if(l%2==1){
			puts("NA");
			continue;
		}
		for(int i=0;i<l;i+=2){
			y=t[i+1]-'1';
			x=t[i]-'1';
			if(y<0 || y>4 || x<0 || x>5)f=1;
			if(f)break;
			o[i/2]=s[y][x];
		}
		o[l/2]=0;
		puts(f?"NA":o);
	}

	return 0;
}

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

int main(){
	string chg = "abcdefghijklmnopqrstuvwxyz.?! ",s;
	while(cin >> s){
		if(s.length() % 2) {
			cout << "NA" << endl;
			continue;
		}
		string to = "";
		bool flag = true;
		for(int i = 0;i < s.length() / 2;i++){
			char a = s[i * 2],b = s[i * 2 + 1];
			if(a >= '1' && a <= '6' && b >= '1' && b <= '5'){
				int aa = a - '1',bb = b - '1';
				to += chg.substr(aa * 5 + bb,1);
			}
			else flag = false;
		}
		if(!flag) cout << "NA" << endl;
		else cout << to << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
#include <cassert>
#include <vector>
#include <string>
#include <cmath>
#include <map> 
using namespace std;
 
const int MAX= 10000100;

#define loop(i,a,b) for(int i = a ; i < b ; i ++)
#define rep(i,a) loop(i,0,a)
#define all(a) (a).begin(),(a).end()
#define ll long long int
#define gcd(a,b) __gcd(a,b)

int GCD(int a, int b) {if(!b) return a; return gcd(b, a%b);}
int lcm(int a, int b) {return a*b / gcd(a, b);}

char maze[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',' '}
  };

int main(void){
  string in;
  while(cin>>in){
    //cout<<in.size()<<endl;
    if(in.size()%2==0){
      rep(i,in.size()){
  if(in[i] == '\n')break;
	cout<<maze[in[i+1]-'0'-1][in[i]-'0'-1];
	i ++;
      }
      cout<<endl;
    }else
      cout<<"NA"<<endl;
  }
}

C++: #include<stdio.h>
#include<string.h>
int main(void)
{
	int i,j=0;
	char N[200],Mo[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','.','?','!',' '};
	for(i=0;i<8;i++){
		scanf("%s",N);
		if(strlen(N) % 2 == 1){
			printf("NA\n");
		}
		else{
			j=0;
			while( N[j] != '\0' && N[j+1] != '\0'){
				printf("%c",Mo[N[j]-49][N[j+1]-49]);
				j += 2;
			}
			printf("\n");
		}
	}
	return 0;
}

C++: #include<iostream>
#include<string.h>
#include<vector>
#include<list>
#include<stdio.h>
#include<math.h>
#include<iomanip>
#include<map>
#include<stack>
#include<queue>
#include<algorithm>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << "debug " << x << endl;
using namespace std;

int main(){
    string s, ans;
    while(cin >> s){
        int i = 0;
        char a;
        ans = "";
        while(i < s.size()){
            if(s.size() % 2 || s[i] > '6' || s[i + 1] > '5' || s[i] < '1' || s[i + 1] < '1'){
                ans = "NA";
                break;
            }
            if(s[i] == '6'){
                if(s[i + 1] == '1')
                    a = 'z';
                else if(s[i + 1] == '2')
                    a = '.';
                else if(s[i + 1] == '3')
                    a = '?';
                else if(s[i + 1] == '4')
                    a = '!';
                else if(s[i + 1] == '5')
                    a = ' ';
            }else{
                a = 'a' + (s[i + 1] - '1') + 5 * (s[i] - '1');
            }
            ans+= a;
            i+= 2;
        }
        cout << ans << endl;
    }
}