import java.util.*;

public class Main {
    public static void main(String[] args) {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        
        String strf = s.substring(0,2);
        String strb = s.substring(2); 
        
        int sf = Integer.parseInt(strf);
        int sb = Integer.parseInt(strb);
        
        String ans = "NA";
        
        if(1 <= sf && sf <= 12 && 1 <= sb && sb <= 12){
            ans = "AMBIGUOUS";
        }else if(1 <= sf && sf <= 12){
            ans = "MMYY";
        }else if(1 <= sb && sb <= 12){
            ans = "YYMM";    
        }
        System.out.println(ans);  
       
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        
        String strf = s.substring(0,2);
        String strb = s.substring(2); 
        
        int sf = Integer.parseInt(strf);
        int sb = Integer.parseInt(strb);
        
        String ans = "NA";
        
        if(1 <= sf && sf <= 12 && 1 <= sb && sb <= 12){
            ans = "AMBIGUOUS";
        }else if(1 <= sf && sf <= 12){
            ans = "MMYY";
        }else if(1 <= sb && sb <= 12){
            ans = "YYMM";    
        }
        System.out.println(ans);  
       
    }
} Main public static void main(String[] args) {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        
        String strf = s.substring(0,2);
        String strb = s.substring(2); 
        
        int sf = Integer.parseInt(strf);
        int sb = Integer.parseInt(strb);
        
        String ans = "NA";
        
        if(1 <= sf && sf <= 12 && 1 <= sb && sb <= 12){
            ans = "AMBIGUOUS";
        }else if(1 <= sf && sf <= 12){
            ans = "MMYY";
        }else if(1 <= sb && sb <= 12){
            ans = "YYMM";    
        }
        System.out.println(ans);  
       
    } main {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        
        String strf = s.substring(0,2);
        String strb = s.substring(2); 
        
        int sf = Integer.parseInt(strf);
        int sb = Integer.parseInt(strb);
        
        String ans = "NA";
        
        if(1 <= sf && sf <= 12 && 1 <= sb && sb <= 12){
            ans = "AMBIGUOUS";
        }else if(1 <= sf && sf <= 12){
            ans = "MMYY";
        }else if(1 <= sb && sb <= 12){
            ans = "YYMM";    
        }
        System.out.println(ans);  
       
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc String strf = s.substring(0,2); strf s.substring(0,2) s.substring s 0 2 String strb = s.substring(2); strb s.substring(2) s.substring s 2 int sf = Integer.parseInt(strf); sf Integer.parseInt(strf) Integer.parseInt Integer strf int sb = Integer.parseInt(strb); sb Integer.parseInt(strb) Integer.parseInt Integer strb String ans = "NA"; ans "NA" if(1 <= sf && sf <= 12 && 1 <= sb && sb <= 12){
            ans = "AMBIGUOUS";
        }else if(1 <= sf && sf <= 12){
            ans = "MMYY";
        }else if(1 <= sb && sb <= 12){
            ans = "YYMM";    
        } 1 <= sf && sf <= 12 && 1 <= sb && sb <= 12 1 <= sb 1 <= sf && sf <= 12 && 1 <= sb && sb <= 12 1 <= sf 1 sf sf <= 12 sf 12 1 <= sb 1 sb sb <= 12 sb 12 {
            ans = "AMBIGUOUS";
        } ans = "AMBIGUOUS" ans "AMBIGUOUS" if(1 <= sf && sf <= 12){
            ans = "MMYY";
        }else if(1 <= sb && sb <= 12){
            ans = "YYMM";    
        } 1 <= sf && sf <= 12 1 <= sf 1 sf sf <= 12 sf 12 {
            ans = "MMYY";
        } ans = "MMYY" ans "MMYY" if(1 <= sb && sb <= 12){
            ans = "YYMM";    
        } 1 <= sb && sb <= 12 1 <= sb 1 sb sb <= 12 sb 12 {
            ans = "YYMM";    
        } ans = "YYMM" ans "YYMM" System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
    public static void main(String[] args) {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        
        String strf = s.substring(0,2);
        String strb = s.substring(2); 
        
        int sf = Integer.parseInt(strf);
        int sb = Integer.parseInt(strb);
        
        String ans = "NA";
        
        if(1 <= sf && sf <= 12 && 1 <= sb && sb <= 12){
            ans = "AMBIGUOUS";
        }else if(1 <= sf && sf <= 12){
            ans = "MMYY";
        }else if(1 <= sb && sb <= 12){
            ans = "YYMM";    
        }
        System.out.println(ans);  
       
    }
} public class Main {
    public static void main(String[] args) {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        
        String strf = s.substring(0,2);
        String strb = s.substring(2); 
        
        int sf = Integer.parseInt(strf);
        int sb = Integer.parseInt(strb);
        
        String ans = "NA";
        
        if(1 <= sf && sf <= 12 && 1 <= sb && sb <= 12){
            ans = "AMBIGUOUS";
        }else if(1 <= sf && sf <= 12){
            ans = "MMYY";
        }else if(1 <= sb && sb <= 12){
            ans = "YYMM";    
        }
        System.out.println(ans);  
       
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        
        String strf = s.substring(0,2);
        String strb = s.substring(2); 
        
        int sf = Integer.parseInt(strf);
        int sb = Integer.parseInt(strb);
        
        String ans = "NA";
        
        if(1 <= sf && sf <= 12 && 1 <= sb && sb <= 12){
            ans = "AMBIGUOUS";
        }else if(1 <= sf && sf <= 12){
            ans = "MMYY";
        }else if(1 <= sb && sb <= 12){
            ans = "YYMM";    
        }
        System.out.println(ans);  
       
    }
}
