import java.util.Scanner;
public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   String YM = sc.next();
   
   boolean YYMM = false;
   boolean MMYY = false;
   
   
   if(YM.charAt(0)=='0'){
    if(YM.charAt(1)!='0'){
     MMYY = true;
    }
   }
     
   if(YM.charAt(0)=='1'){
    if(YM.charAt(1)=='0' || YM.charAt(1)=='1' || YM.charAt(1)=='2'){
     MMYY = true;
    }     
   }

     
      if(YM.charAt(2)=='0'){
    if(YM.charAt(3)!='0'){
     YYMM = true;
    }
   }
     
   if(YM.charAt(2)=='1'){
    if(YM.charAt(3)=='0' || YM.charAt(3)=='1' || YM.charAt(3)=='2'){
     YYMM = true;
    }     
   }
     if(YYMM && MMYY){
         System.out.println("AMBIGUOUS");
     }
      else if(YYMM && !(MMYY)){
         System.out.println("YYMM");
     }
      else if(!(YYMM) && MMYY){
         System.out.println("MMYY");
     }
      else{
         System.out.println("NA");
     }
   
 }
}
/tmp/hf-datasets-cache/medium/datasets/42704881117311-config-parquet-and-info-qiankunmu-Project_CodeNet-896c9d36/hub/datasets--qiankunmu--Project_CodeNet_Python800_and_Java250/snapshots/c899fde44a77ba1cc14973ed3de064e4ff3aadc7/Project_CodeNet_Java250.tar.gz