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 <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    string s;
    map<string, int> m;
    for (int i = 0; i < 26; ++i) {
        m[string{char(i/5+'1'), char(i%5+'1')}] = 'a'+i;
    }
    m["62"] = '.';
    m["63"] = '?';
    m["64"] = '!';
    m["65"] = ' ';
    while(getline(cin, s)){
        if(s.size()&1){
            puts("NA");
            continue;
        }
        string ans;
        for (int i = 0; i < s.size(); i += 2) {
            if(m.count(s.substr(i, 2))){
                ans += m[s.substr(i, 2)];
            }else{
                ans.clear();
                break;
            }
        }
        if(ans.empty()) puts("NA");
        else cout << ans << "\n";
    }
    return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

char c[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(true){
		cin >> str;
		if(cin.eof()){
			break;
		}
		
		for(int i = 0; i < str.size(); i++){
			if(str[i] < '1' || str[i] > '6'){
				while(true);
			}
		}
		
		if(str.size() % 2 != 0){
			printf("NA\n");
			continue;
		}
		for(int i = 0; i < str.size(); i += 2){
			if(str[i + 1] - '0' - 1 >= 5){
				printf("NA");
				break;
			}
			printf("%c", c[str[i] - '0' - 1][str[i + 1] - '0' - 1]);
		}
		printf("\n");
	}
	
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
int main(){
	string data[6]={""," afkpuz"," bglqv."," chmrw?"," dinsx!"," ejoty "};
	string s;
	while(cin>>s){
		string ans="";
		if(s.size()%2!=0){
			cout<<"NA"<<endl;
			continue;
		}
		for(int i=0;i<s.size();i+=2){
			int x=s[i]-'0',y=s[i+1]-'0';
			if(1<=x&&x<=6&&1<=y&&y<=5){
				ans+=data[y][x];
			}else{
				cout<<"NA"<<endl;
				continue;
			}
		}
		cout<<ans<<endl;
	}
}

C++: #include <iostream>

using namespace std;

int main(void)
{
	string str;
	
	char data[10][10];
	
	char cnt = 'a';
	for (int i = 1; i <= 6; i++){
		for (int j = 1; j <= 5; j++){
			data[j][i] = cnt;
			cnt++;
		}
	}
	
	data[2][6] = '.';
	data[3][6] = '?';
	data[4][6] = '!';
	data[5][6] = ' ';
	
	while (cin >> str){
		if (str.length() % 2 == 1){
			cout << "NA" << endl;
			continue;
		}
		string ret = "";
		bool ef = true;
		for (int i = 0; i < str.length(); i++){
			if ('1' <= str[i] && str[i] <= '6'){
				i++;
				if ('1' <= str[i] && str[i] <= '5'){
					ret += data[str[i] - '0'][str[i - 1] - '0'];
					// printf("data[%d][%d] = %c\n", str[i] - '0', str[i - 1] - '0', data[str[i] - '0'][str[i - 1] - '0']);
				}
				else {
					ef = false;
					break;
				}
			}
			else {
				ef = false;
				break;
			}
		}
		if (ef) cout << ret << endl;
		else  cout << "NA" << endl;
	}
	
	return 0;
}

C++: /*
	0127:Pocket Pager Input
*/
#include	<iostream>
#include	<string>

using namespace std;

const char WORDS[30] = "abcdefghijklmnopqrstuvwxyz.?! ";

int main(void) {
	char WORDSET[6][5];
	int w = 0;
	
	for(int i = 0; i < 6; i++) {
		for(int j = 0; j < 5; j++) {
			WORDSET[i][j] = WORDS[w];
			w++;
		}
	}
	
	while(1) {
		string str;
		string ans;
		bool fl = true;
		
		cin >> str;
		
		if( cin.eof() ) { break; }
			else if( (int)str.size() % 2 != 0 ) { cout << "NA" << endl; continue; }
		string::iterator it = str.begin();
		while( it != str.end() ) {
			int a, b;
			
			a = *it - '0' - 1;
			it++;
			b = *it - '0' - 1;
			it++;
			
			if(0 <= a && a < 6 && 0 <= b && b < 5) {
				ans += WORDSET[a][b];
			} else {
				fl = false;
				break;
			}
		}
		if(fl) {
			cout << ans << endl;
		} else {
			cout << "NA" << endl;
		}
	}
	return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)

int main() {
	string str[5] = {"afkpuz","bglqv.","chmrw?","dinsx!","ejoty "};
	string in;
	
	while (cin >> in) {
		string ans = "";
		
		if (in.size() & 1) {
			puts("NA");
			continue;
		}
		REP(i, in.size() / 2) {
			int pos = i * 2;
			int a = in[pos] - '0', b = in[pos + 1] - '0';
			if (!(a >= 1 && a <= 6 && b >= 1 && b <= 5)) {
				ans = "NA";
				break;
			}
			a--; b--;
			ans += str[b][a];
		}
		
		cout << ans << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

char c[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(true){
		cin >> str;
		if(cin.eof()){
			break;
		}
		
		for(int i = 0; i < str.size(); i++){
			if(str[i] < '1' || str[i] > '6'){
				while(true);
			}
		}
		
		if(str.size() % 2 != 0){
			printf("NA\n");
			continue;
		}
		for(int i = 0; i < str.size(); i += 2){
			if(str[i + 1] - '0' - 1 >= 5){
				printf("NA");
				break;
			}
			printf("%c", c[str[i] - '0' - 1][str[i + 1] - '0' - 1]);
		}
		printf("\n");
	}
	
	return 0;
}

C++: #include<iostream>
#include<string>
using namespace std;
int main() {
 char a[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 b;
 while (cin >> b) {
  string c = "";
  if (b.length() % 2 == 1) {
   cout << "NA" << endl;
   goto stop;
  }
  int h, w;
  for (int i = 0; i < b.length() ; ) {
   h = (int)b[i++] - '0';
   w = (int)b[i++] - '0';
   if (h > 6 || w > 5) {
    cout << "NA" << endl;
    goto stop;
   }
   h--; w--;
   c += a[h][w];
   h = 0; w = 0;
  }
  cout << c << endl;
  stop:;
 }
}

C++: #include<cstdio>
#include<cstring>
using namespace std;
int main(){
  char c[201];
  char hyou[6][7];
  hyou[1][6] = 'z';
  hyou[2][6] = '.';
  hyou[3][6] = '?';
  hyou[4][6] = '!';
  hyou[5][6] = ' ';
  for(int i=1;i<=5;i++){
    for(int j=1;j<=5;j++){
      hyou[i][j] = 'a'+(j-1)*5+i-1;
    }
  }
  
  while(scanf("%s",c) != EOF){
    if(strlen(c)%2 != 0){
      printf("NA\n");
      continue;
    }
    for(int i=0;i<strlen(c);i+=2){
      printf("%c",hyou[c[i+1]-'0'][c[i]-'0']);
    } putchar('\n');
  }

  return (0);
}