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;
        }
        bool flag=true;
        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");
                flag=false;
                break;
            }
            ans[i/2]=l[v1][v2];
        }
        if(flag)printf("%s\n",ans);
    }
    return 0;
}

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

const string hyou[] = {"afkpuz",
		       "bglqv.",
		       "chmrw?",
		       "dinsx!",
		       "ejoty "};
int main(){
  string in;
  while(cin >> in){
    cin.ignore();
    if(in.size()%2 == 1){
      cout << "NA" << endl;
      continue;
    }
    bool flag = true;
    string ans = "";
        for(int i = 0 ; i < in.size()-1 ; i+=2 ){
	  if(!('1' <= in[i+1] && in[i+1] <= '6')||
	     !('1' <= in[i] && in[i] <= '6')){
	    flag = false; 
	    break;
	  }
	  ans += hyou[in[i+1]-'0'-1][in[i]-'0'-1];
    }
	if(flag)cout << ans <<endl;
	else cout << "NA" << endl;
  }
  return 0;
}

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

int main(){
    string msg;
    while(cin >> msg){
        if( msg.length()%2 ){
            cout << "NA" << endl;
            continue;
        }
        string res = "";
        bool OK = true;
        for(int i = 0; i < msg.length(); i+=2){
            int x = msg[i]-'0', y = msg[i+1]-'0';
            if( x < 1 || x > 6 || y < 1 || y > 6 ){
                OK = false;
                break;
            }
            char z = (x-1)*5+(y-1)+'a';
            if( 'a' <= z && z <= 'z' ) res.append(1, z);
            else{
                if( z-'a' == 26 ) res.append(1,'.');
                if( z-'a' == 27 ) res.append(1,'?');
                if( z-'a' == 28 ) res.append(1,'!');
                if( z-'a' == 29 ) res.append(1,' ');
            }
        }
        if( OK ){
            cout << res << endl;
        }else{
            cout << "NA" << endl;
        }
    }
    return 0;
}

C++: #include<iostream>

using namespace std;
string str,ans;
char t[6][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',' '}
};
bool check(char a,char b){
  if('1'<=a&&a<='6'){}else return false;
  if('1'<=b&&b<='5'){}else return false;
  return true;
}

int main(){
  while(cin>>str){
    ans="";
    for(int i=0;i<(int)str.size();i+=2){
      if(check(str[i],str[i+1])){
	ans.push_back(t[str[i+1]-'0'][str[i]-'0']);
      }else{
	ans="NA";
	break;
      }
    }
    cout<<ans<<endl;
  }
  return 0;
}

C++: #include <iostream>

const char 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()
{
	std::string input;
	while (getline(std::cin, input)) {
		std::string ans;
		bool na = (input.length() & 1) == 1;
		for (int i=0; !na && i<input.length(); i+=2) {
			int c = input[i] - '0';
			int d = input[i+1] - '0';
			if (c < 1 || 6 < c || d < 1 || 5 < d) {
				na = true;
			}
			else ans += TABLE[c-1][d-1];
		}
		if (na) std::cout << "NA" << std::endl;
		else std::cout << ans << std::endl;
	}
	return 0;
}

C++: #include<iostream>
#include<string>
using namespace std;
int main()
{
	string s,r;
	int i;
	const char *a[7] = 
	{
		"afkpuz",
		"bglqv.",
		"chmrw?",
		"dinsx!",
		"ejoty ",
	};
	while(cin >> s)
	{
		r="";
		for(i=0;i+1<s.size();i+=2)
		{
			if(s[i]>'6' || s[i+1]>'5') break; 
			r+=a[s[i+1]-'1'][s[i]-'1'];
		}
		if(i != s.size())
			cout << "NA"<<endl;
		else
			cout << r << endl;
	}
	return 0;
}

C++: #include<iostream>
#include<string>
using namespace std;
int main(){
  string nums,text,ch;
  ch = "abcdefghijklmnopqrstuvwxyz.?! ";
  while(cin>>nums){
    text = "";
    if(nums.size()%2){
      cout<<"NA"<<endl;
    }
    else{
      for(int i=0;i<nums.size()/2;i++){
	if('0'<nums[i*2]&&nums[i*2]<'7'&&'0'<nums[i*2+1]&&nums[i*2+1]<'7')
	  text=text+ch[5*(nums[i*2]-49)+(nums[i*2+1]-49)];
	else{
	  text="NA";
	  break;
	}
      }
      cout<<text<<endl;
    }
  }
  return 0;
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <map>
#include <set>
#include <cstdio>
#include <cmath>
#define rep(i,l,n) for(lint i=l;i<n;i++)
#define rer(i,l,n) for(lint i=l;i<=n;i++)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define pb(a) push_back(a)
#define mk(a,b) make_pair(a,b)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef vector<int> vi;
typedef vector<lint> vli;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

int main(){
	string s;
	while(cin>>s){
		if(s.size()%2){
			o("NA"); continue;
		}
		bool f=1;
		string ans="",t="z.?! ";
		rep(i,0,s.size()/2){
			if(1<=s[2*i]-'0' && s[2*i]-'0'<=6 && 1<=s[2*i+1]-'0' && s[2*i+1]-'0'<=5){
				if(s[2*i]!='6'){
					ans+='a'+5*(s[2*i]-'1')+s[2*i+1]-'1';
				}else if(s[i*2]=='6'){
					ans+=t[s[2*i+1]-'1'];
				}
			}else f=0;
		}
		if(f) o(ans);
		else o("NA");
	}
}

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

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;

string ans, s;
string table[] = { "afkpuz", "bglqv.",
"chmrw?", "dinsx!", "ejoty " };

int main(){
	while (cin >> s){
		bool f = 0;
		ans = "";
		if (s.size() % 2 != 0){
			cout << "NA" << endl;
			continue;
		}
		if (s.size() == 0)cout << "NA" << endl;
		for (int i = 0; i < s.size(); i += 2){
			if (s[i]>'6' || s[i]<'1' || s[i + 1]>'5' || s[i] < '1'){
				f = 1;
				break;
			}
			ans += table[s[i + 1] - '1'][s[i] - '1'];
		}
		if (f)cout << "NA" << endl;
		else cout << ans << endl;
		ans.clear();
	}
}