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 <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;
		}
		string ans="",t="z.?! ";
		rep(i,0,s.size()/2){
			if(s[2*i]!='6'){
				ans+='a'+5*(s[2*i]-'1')+s[2*i+1]-'1';
			}else{
				ans+=t[s[2*i+1]-'1'];
			}
		}
		o(ans);
	}
}

C++: #include <iostream>
#include <string>
using namespace std;
char m[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){
    int i,j,k,l = s.length();
    if(l % 2 == 1) {
      cout << "NA" << endl;
      continue;
    }
    char t[102];
    for(i=0; i<l/2; i++){
      j = s[i*2] - '0' - 1;
      k = s[i*2+1] - '0' - 1;
      if(j > 5 || k > 4) {
	cout << "NA" << endl;
	break;
      }
      t[i] = m[j][k];
    }
    if(i >= l/2) {
      t[i] = '\0';
      cout << t << endl;
    }
  }
  return 0;
}

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

char convert(int x) {
  int x1 = x/10;
  int x2 = x-x1*10;
  if(x1 == 1) {
    if(x2 == 1) return 'a';
    if(x2 == 2) return 'b';
    if(x2 == 3) return 'c';
    if(x2 == 4) return 'd';
    if(x2 == 5) return 'e';
  }
  if(x1 == 2) {
    if(x2 == 1) return 'f';
    if(x2 == 2) return 'g';
    if(x2 == 3) return 'h';
    if(x2 == 4) return 'i';
    if(x2 == 5) return 'j';
  }
  if(x1 == 3) {
    if(x2 == 1) return 'k';
    if(x2 == 2) return 'l';
    if(x2 == 3) return 'm';
    if(x2 == 4) return 'n';
    if(x2 == 5) return 'o';
  }
  if(x1 == 4) {
    if(x2 == 1) return 'p';
    if(x2 == 2) return 'q';
    if(x2 == 3) return 'r';
    if(x2 == 4) return 's';
    if(x2 == 5) return 't';
  }
  if(x1 == 5) {
    if(x2 == 1) return 'u';
    if(x2 == 2) return 'v';
    if(x2 == 3) return 'w';
    if(x2 == 4) return 'x';
    if(x2 == 5) return 'y';
  }
  if(x1 == 6) {
    if(x2 == 1) return 'z';
    if(x2 == 2) return '.';
    if(x2 == 3) return '?';
    if(x2 == 4) return '!';
    if(x2 == 5) return ' ';
  }
  return '1';
}

int main() {
  string str;
  bool r;
  char ans[200];
  while(cin >> str) {
    if(str.size() % 2 == 1) {
      cout << "NA" << endl;
    }
    else {
      int j=0;
      r = true;
      for(unsigned int i=0;i<str.size();i+=2) {
	int x = atoi(str.substr(i,2).c_str());
	ans[j] = convert(x);
	j++;
	if(convert(x) == '1') {
	  r=false;
	}
      }
      if(r) {
	ans[j] = '\0';
	cout << ans << endl;
      }
      else {
	cout << "NA" << endl;
      }
    }
  }
}

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(s[2*i]-'0'>7||s[2*i+1]-'0'>6) f=0;
			else 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'];
			}
		}
		if(f) o(ans);
		else o("NA");
	}
}

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

char m[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','.','?','!',' '}
};

char f(int i, int j){
	return m[i][j];
}

int main(){
	string s;
	while( cin >> s ){
		string ans;
		bool flag = false;
		if( s.size()%2 ){
			flag = true;
		}else{
			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.push_back( f(y,x) );
			}
			if( flag )
				cout << "NA" << endl;
			else
				cout << ans << endl;
		}
	}
}

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

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

C++: #include<iostream>
using namespace std;
int main(){
  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','.','?','!',' '}};
  string s;
  while(cin>>s){
    string ans="";
    if(s.size()%2==0){
      for(int i=0;i<s.size();i+=2)
        if(s[i]>='1'&&s[i]<='6'&&s[i+1]>='1'&&s[i+1]<='6')
        ans+=c[s[i]-'0'-1][s[i+1]-'0'-1];
      else goto L;
    cout<<ans<<endl;
}
    else L:cout<<"NA"<<endl;
  }
}

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

int main() {
  int i, p, q;
  bool b;
  char buf[201];
  char code[5][6] = {
    {'a', 'f', 'k', 'p', 'u', 'z'},
    {'b', 'g', 'l', 'l', 'q', 'v'},
    {'c', 'h', 'm', 'r', 'w', '?'},
    {'d', 'i', 'n', 's', 'x', '!'},
    {'e', 'j', 'o', 't', 'y', ' '},
  };

  while (cin.getline(buf, sizeof(buf))) {
    i = 0;
    b = true;
    while (buf[i]!='\0') {
      if (i&1) {
        if (buf[i]<'1'||buf[i]>'5') {
          b = false;
          break;
        }
      } else {
        if (buf[i]<'1'||buf[i]>'6') {
          b = false;
          break;
        }
      }
      ++i;
    }
    if (i&1) b = false;

    if (b) {
      i = 0;
      while (buf[i]!='\0') {
        p = buf[i++]-'1';
        q = buf[i++]-'1';
        cout << code[q][p];
      }
      cout << endl;
    } else {
      cout << "NA" << endl;
    }
  }
  return 0;
}