import java.util.*;
public class Main{
   public static void main(String[] args) {
     Scanner sc = new Scanner(System.in);
     int S = sc.nextInt();
     boolean YYMM,MMYY;
     YYMM = ((S%100>0) &&(S%100<=12));
     MMYY = ((S/100>0) &&(S/100<=12));
     if(YYMM && MMYY){
       System.out.println("AMBIGUOUS");
     }else if(YYMM){
        System.out.println("YYMM");
     }else if(MMYY){
        System.out.println("MMYY");
     }else {
        System.out.println("NA");
      }
   }
} import java.util.*; util.* java public class Main{
   public static void main(String[] args) {
     Scanner sc = new Scanner(System.in);
     int S = sc.nextInt();
     boolean YYMM,MMYY;
     YYMM = ((S%100>0) &&(S%100<=12));
     MMYY = ((S/100>0) &&(S/100<=12));
     if(YYMM && MMYY){
       System.out.println("AMBIGUOUS");
     }else if(YYMM){
        System.out.println("YYMM");
     }else if(MMYY){
        System.out.println("MMYY");
     }else {
        System.out.println("NA");
      }
   }
} Main public static void main(String[] args) {
     Scanner sc = new Scanner(System.in);
     int S = sc.nextInt();
     boolean YYMM,MMYY;
     YYMM = ((S%100>0) &&(S%100<=12));
     MMYY = ((S/100>0) &&(S/100<=12));
     if(YYMM && MMYY){
       System.out.println("AMBIGUOUS");
     }else if(YYMM){
        System.out.println("YYMM");
     }else if(MMYY){
        System.out.println("MMYY");
     }else {
        System.out.println("NA");
      }
   } main {
     Scanner sc = new Scanner(System.in);
     int S = sc.nextInt();
     boolean YYMM,MMYY;
     YYMM = ((S%100>0) &&(S%100<=12));
     MMYY = ((S/100>0) &&(S/100<=12));
     if(YYMM && MMYY){
       System.out.println("AMBIGUOUS");
     }else if(YYMM){
        System.out.println("YYMM");
     }else if(MMYY){
        System.out.println("MMYY");
     }else {
        System.out.println("NA");
      }
   } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int S = sc.nextInt(); S sc.nextInt() sc.nextInt sc boolean YYMM YYMM MMYY; MMYY YYMM = ((S%100>0) &&(S%100<=12)) YYMM ((S%100>0) &&(S%100<=12)) (S%100>0) S%100 S 100 0 (S%100<=12) S%100 S 100 12 MMYY = ((S/100>0) &&(S/100<=12)) MMYY ((S/100>0) &&(S/100<=12)) (S/100>0) S/100 S 100 0 (S/100<=12) S/100 S 100 12 if(YYMM && MMYY){
       System.out.println("AMBIGUOUS");
     }else if(YYMM){
        System.out.println("YYMM");
     }else if(MMYY){
        System.out.println("MMYY");
     }else {
        System.out.println("NA");
      } YYMM && MMYY YYMM MMYY {
       System.out.println("AMBIGUOUS");
     } System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" if(YYMM){
        System.out.println("YYMM");
     }else if(MMYY){
        System.out.println("MMYY");
     }else {
        System.out.println("NA");
      } YYMM {
        System.out.println("YYMM");
     } System.out.println("YYMM") System.out.println System.out System System.out "YYMM" if(MMYY){
        System.out.println("MMYY");
     }else {
        System.out.println("NA");
      } MMYY {
        System.out.println("MMYY");
     } System.out.println("MMYY") System.out.println System.out System System.out "MMYY" {
        System.out.println("NA");
      } System.out.println("NA") System.out.println System.out System System.out "NA" String[] args args public class Main{
   public static void main(String[] args) {
     Scanner sc = new Scanner(System.in);
     int S = sc.nextInt();
     boolean YYMM,MMYY;
     YYMM = ((S%100>0) &&(S%100<=12));
     MMYY = ((S/100>0) &&(S/100<=12));
     if(YYMM && MMYY){
       System.out.println("AMBIGUOUS");
     }else if(YYMM){
        System.out.println("YYMM");
     }else if(MMYY){
        System.out.println("MMYY");
     }else {
        System.out.println("NA");
      }
   }
} public class Main{
   public static void main(String[] args) {
     Scanner sc = new Scanner(System.in);
     int S = sc.nextInt();
     boolean YYMM,MMYY;
     YYMM = ((S%100>0) &&(S%100<=12));
     MMYY = ((S/100>0) &&(S/100<=12));
     if(YYMM && MMYY){
       System.out.println("AMBIGUOUS");
     }else if(YYMM){
        System.out.println("YYMM");
     }else if(MMYY){
        System.out.println("MMYY");
     }else {
        System.out.println("NA");
      }
   }
} Main
import java.util.*;
public class Main{
   public static void main(String[] args) {
     Scanner sc = new Scanner(System.in);
     int S = sc.nextInt();
     boolean YYMM,MMYY;
     YYMM = ((S%100>0) &&(S%100<=12));
     MMYY = ((S/100>0) &&(S/100<=12));
     if(YYMM && MMYY){
       System.out.println("AMBIGUOUS");
     }else if(YYMM){
        System.out.println("YYMM");
     }else if(MMYY){
        System.out.println("MMYY");
     }else {
        System.out.println("NA");
      }
   }
}
