#include <bits/stdc++.h>
using namespace std;
using namespace std;
int main() {
  string s;
  int n;
  char mozi[10][10] = {"abcde", "fghij", "klmno", "pqrst", "uvwxy", "z.?! "};
  bool flag = true;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> s;
    if (s.size() % 2 == 1) {
      puts("NA");
      continue;
    } else {
      char str[201], kari[200];
      long int length = s.length();
      s.copy(str, length, 0);
      for (int i = 0; i < s.size(); i += 2) {
        if (0 <= (int)str[i] - 49 <= 5 && 0 <= (int)str[i + 1] - 49 <= 4)
          kari[i] = mozi[(int)str[i] - 49][(int)str[i + 1] - 49];
        else
          flag = false;
      }
      if (flag == true) {
        for (int i = 0; i < s.size(); i += 2) {
          cout << kari[i];
        }
      } else {
        cout << "NA";
      }
      puts("");
    }
  }
  return 0;
}
