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<string>

using namespace std;

int Atoi(char);

int main(){
  int i, j, na , m, n;
  char c, data[5][6];
  string str, _str;

  c = 97;
  for(i=0; i<5; ++i){
    for(j=0; j<5; ++j){
      data[j][i] = c;
      ++c;
    }
  }
  data[0][5] = c;
  data[1][5] = '.';
  data[2][5] = '?';
  data[3][5] = '!';
  data[4][5] = ' ';

  while(cin >> str){
    if(str.size()%2 == 1){
      cout << "NA" << endl;
    }else{
      na = 0;
      for(i=0; i<str.size(); i+=2){
	if(str[i] > '6' || str[i+1] > '5'){
	  cout << "NA" << endl;
	  na = 1;
	  break;
	}

	n = Atoi(str[i]);
	m = Atoi(str[i+1]);
	_str.push_back(data[m-1][n-1]);
      }

      if(na == 0)
 	cout << _str << endl;

      _str.clear();
    }
  }

  return 0;
}

int Atoi(char c){
  int x;
  x = c - 48;
  return x;
}

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

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(){
	string s;
	while( cin >> s ){
		string ans;
		if( s.size()%2 ){
			cout << "NA" << endl;
		}else{
			bool flag = false;
			for(int i=1 ; i < s.size() ; i+=2 ){
				int y = s[i-1]-'0'-1;
				int x = s[i]-'0'-1;
				if( y < 0 || x < 0 || y >= 6 || x >= 5 ){
					flag = true;
					break;
				}
				ans += table[y][x];
			}
			if( flag )
				cout << "NA" << endl;
			else
				cout << ans << endl;
		}
	}
}

C++: #include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#include<complex>
#include<map>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vvc vector<vector<char>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define CC puts("-------ok--------");
#define all(in) in.begin(), in.end()
using namespace std;
typedef pair<int, int> pii;
#define MAX 99999999
int main(){
    char u[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){
        bool flag=true;
        if(s.length()%2){cout<<"NA"<<endl; flag=false;}
    if(flag){
    vector<pii>v(1000);
    rep(i,s.length()/2){
        v[i]=pii(s[2*i]-48,s[2*i+1]-48);
        if(v[i].first>6||v[i].second>5){cout<<"NA"<<endl;goto E;}
    }
    rep(i,s.length()/2)
    cout<<u[v[i].first-1][v[i].second-1];
    cout<<endl;
    }
    E:;
        s.clear();
    }
}

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

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

using namespace std;


int main() {
  string str;
  while(getline(cin, str)) {
    stringstream sin;
    bool flag = true;
    if((int)str.length() % 2 == 0) {
      for(int i = 0; i < str.length(); i+=2) {
	int tm1 = (int)str[i] - (int)'0';
	int tm2 = (int)str[i+1] - (int)'0';

	if(tm1 > 6 || tm2 > 5) {
	  flag = false;
	  break;
	}
	char c;
	if(tm1 == 6 && tm2 >= 2) {
	  switch(tm2) {
	  case 2:
	    c = '.'; break;
	  case 3:
	    c = '?'; break;
	  case 4:
	    c = '!'; break;
	  case 5:
	    c = ' '; break;
	  }
	} else {
	  c = (char)((tm1-1) * 5 + tm2 - 1 + (int)'a');
	}
	sin << c;
      }
    } else {
      flag = false;
    }

    if(!flag) {
      cout << "NA" << endl;
    } else {
      cout << sin.str() << endl;
    }
  }
  return 0;
}