#include <bits/stdc++.h>
char moji[5][7] = {
    "afkpuz", "bglqv.", "chmrw?", "dinsx!", "ejoty ",
};
char retu[401];
char mes[201];
void Encode(void) {
  int i = 0;
  int num1, num2;
  int cnt = 0;
  int flg = 0;
  while (retu[i] != '\0') {
    num1 = retu[i] - 49;
    if (retu[i + 1] == '\0') {
      flg = 1;
      break;
    } else {
      num2 = retu[i + 1] - 49;
    }
    mes[cnt] = moji[num2][num1];
    cnt++;
    i += 2;
  }
  if (flg == 1) {
    printf("NA\n");
  } else {
    mes[cnt] = '\0';
    printf("%s\n", mes);
  }
}
int main(void) {
  int mes_num;
  scanf("%d", &mes_num);
  for (int i = 0; i < mes_num; i++) {
    scanf("%s", retu);
    Encode();
  }
  return 0;
}
