import java.util.*;
class Main{
     public static void main(String []args){
        Scanner sc= new Scanner(System.in);
        int S=sc.nextInt();
        if(S<0){
                System.out.println("NA");
                return;
            }
        if(S%100<13&&S%100!=0){
            
            if(S/100<13&&S/100!=0){
                System.out.println("AMBIGUOUS");
                return;
            }
            System.out.println("YYMM");
            return;
        }
        if(S/100<13&&S/100!=0){
            System.out.println("MMYY");
        
            return;
        }
        System.out.println("NA");
        
        
        
        
        
     }
} import java.util.*; util.* java class Main{
     public static void main(String []args){
        Scanner sc= new Scanner(System.in);
        int S=sc.nextInt();
        if(S<0){
                System.out.println("NA");
                return;
            }
        if(S%100<13&&S%100!=0){
            
            if(S/100<13&&S/100!=0){
                System.out.println("AMBIGUOUS");
                return;
            }
            System.out.println("YYMM");
            return;
        }
        if(S/100<13&&S/100!=0){
            System.out.println("MMYY");
        
            return;
        }
        System.out.println("NA");
        
        
        
        
        
     }
} Main public static void main(String []args){
        Scanner sc= new Scanner(System.in);
        int S=sc.nextInt();
        if(S<0){
                System.out.println("NA");
                return;
            }
        if(S%100<13&&S%100!=0){
            
            if(S/100<13&&S/100!=0){
                System.out.println("AMBIGUOUS");
                return;
            }
            System.out.println("YYMM");
            return;
        }
        if(S/100<13&&S/100!=0){
            System.out.println("MMYY");
        
            return;
        }
        System.out.println("NA");
        
        
        
        
        
     } main {
        Scanner sc= new Scanner(System.in);
        int S=sc.nextInt();
        if(S<0){
                System.out.println("NA");
                return;
            }
        if(S%100<13&&S%100!=0){
            
            if(S/100<13&&S/100!=0){
                System.out.println("AMBIGUOUS");
                return;
            }
            System.out.println("YYMM");
            return;
        }
        if(S/100<13&&S/100!=0){
            System.out.println("MMYY");
        
            return;
        }
        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 if(S<0){
                System.out.println("NA");
                return;
            } S<0 S 0 {
                System.out.println("NA");
                return;
            } System.out.println("NA") System.out.println System.out System System.out "NA" return; if(S%100<13&&S%100!=0){
            
            if(S/100<13&&S/100!=0){
                System.out.println("AMBIGUOUS");
                return;
            }
            System.out.println("YYMM");
            return;
        } S%100<13&&S%100!=0 S%100<13 S%100 S 100 13 S%100!=0 S%100 S 100 0 {
            
            if(S/100<13&&S/100!=0){
                System.out.println("AMBIGUOUS");
                return;
            }
            System.out.println("YYMM");
            return;
        } if(S/100<13&&S/100!=0){
                System.out.println("AMBIGUOUS");
                return;
            } S/100<13&&S/100!=0 S/100<13 S/100 S 100 13 S/100!=0 S/100 S 100 0 {
                System.out.println("AMBIGUOUS");
                return;
            } System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" return; System.out.println("YYMM") System.out.println System.out System System.out "YYMM" return; if(S/100<13&&S/100!=0){
            System.out.println("MMYY");
        
            return;
        } S/100<13&&S/100!=0 S/100<13 S/100 S 100 13 S/100!=0 S/100 S 100 0 {
            System.out.println("MMYY");
        
            return;
        } System.out.println("MMYY") System.out.println System.out System System.out "MMYY" return; System.out.println("NA") System.out.println System.out System System.out "NA" String []args args
import java.util.*;
class Main{
     public static void main(String []args){
        Scanner sc= new Scanner(System.in);
        int S=sc.nextInt();
        if(S<0){
                System.out.println("NA");
                return;
            }
        if(S%100<13&&S%100!=0){
            
            if(S/100<13&&S/100!=0){
                System.out.println("AMBIGUOUS");
                return;
            }
            System.out.println("YYMM");
            return;
        }
        if(S/100<13&&S/100!=0){
            System.out.println("MMYY");
        
            return;
        }
        System.out.println("NA");
        
        
        
        
        
     }
}