import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        int AA = Integer.parseInt(S.substring(0, 2));
        int BB = Integer.parseInt(S.substring(2, 4));
        
        if ( (0 < AA && AA <= 12) ){
            
            if( (0 < BB && BB <= 12) ){
                System.out.println("AMBIGUOUS");
            } else {
                System.out.println("MMYY");
            }
            
        } else {
            
            if( (0 < BB && BB <= 12) ){
                System.out.println("YYMM");
            } else {
                System.out.println("NA");
            }            
            
        }
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        int AA = Integer.parseInt(S.substring(0, 2));
        int BB = Integer.parseInt(S.substring(2, 4));
        
        if ( (0 < AA && AA <= 12) ){
            
            if( (0 < BB && BB <= 12) ){
                System.out.println("AMBIGUOUS");
            } else {
                System.out.println("MMYY");
            }
            
        } else {
            
            if( (0 < BB && BB <= 12) ){
                System.out.println("YYMM");
            } else {
                System.out.println("NA");
            }            
            
        }
    }
} Main public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        int AA = Integer.parseInt(S.substring(0, 2));
        int BB = Integer.parseInt(S.substring(2, 4));
        
        if ( (0 < AA && AA <= 12) ){
            
            if( (0 < BB && BB <= 12) ){
                System.out.println("AMBIGUOUS");
            } else {
                System.out.println("MMYY");
            }
            
        } else {
            
            if( (0 < BB && BB <= 12) ){
                System.out.println("YYMM");
            } else {
                System.out.println("NA");
            }            
            
        }
    } main {
        
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        int AA = Integer.parseInt(S.substring(0, 2));
        int BB = Integer.parseInt(S.substring(2, 4));
        
        if ( (0 < AA && AA <= 12) ){
            
            if( (0 < BB && BB <= 12) ){
                System.out.println("AMBIGUOUS");
            } else {
                System.out.println("MMYY");
            }
            
        } else {
            
            if( (0 < BB && BB <= 12) ){
                System.out.println("YYMM");
            } else {
                System.out.println("NA");
            }            
            
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc int AA = Integer.parseInt(S.substring(0, 2)); AA Integer.parseInt(S.substring(0, 2)) Integer.parseInt Integer S.substring(0, 2) S.substring S 0 2 int BB = Integer.parseInt(S.substring(2, 4)); BB Integer.parseInt(S.substring(2, 4)) Integer.parseInt Integer S.substring(2, 4) S.substring S 2 4 if ( (0 < AA && AA <= 12) ){
            
            if( (0 < BB && BB <= 12) ){
                System.out.println("AMBIGUOUS");
            } else {
                System.out.println("MMYY");
            }
            
        } else {
            
            if( (0 < BB && BB <= 12) ){
                System.out.println("YYMM");
            } else {
                System.out.println("NA");
            }            
            
        } (0 < AA && AA <= 12) 0 < AA 0 AA AA <= 12 AA 12 {
            
            if( (0 < BB && BB <= 12) ){
                System.out.println("AMBIGUOUS");
            } else {
                System.out.println("MMYY");
            }
            
        } if( (0 < BB && BB <= 12) ){
                System.out.println("AMBIGUOUS");
            } else {
                System.out.println("MMYY");
            } (0 < BB && BB <= 12) 0 < BB 0 BB BB <= 12 BB 12 {
                System.out.println("AMBIGUOUS");
            } System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" {
                System.out.println("MMYY");
            } System.out.println("MMYY") System.out.println System.out System System.out "MMYY" {
            
            if( (0 < BB && BB <= 12) ){
                System.out.println("YYMM");
            } else {
                System.out.println("NA");
            }            
            
        } if( (0 < BB && BB <= 12) ){
                System.out.println("YYMM");
            } else {
                System.out.println("NA");
            } (0 < BB && BB <= 12) 0 < BB 0 BB BB <= 12 BB 12 {
                System.out.println("YYMM");
            } System.out.println("YYMM") System.out.println System.out System System.out "YYMM" {
                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) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        int AA = Integer.parseInt(S.substring(0, 2));
        int BB = Integer.parseInt(S.substring(2, 4));
        
        if ( (0 < AA && AA <= 12) ){
            
            if( (0 < BB && BB <= 12) ){
                System.out.println("AMBIGUOUS");
            } else {
                System.out.println("MMYY");
            }
            
        } else {
            
            if( (0 < BB && BB <= 12) ){
                System.out.println("YYMM");
            } else {
                System.out.println("NA");
            }            
            
        }
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        int AA = Integer.parseInt(S.substring(0, 2));
        int BB = Integer.parseInt(S.substring(2, 4));
        
        if ( (0 < AA && AA <= 12) ){
            
            if( (0 < BB && BB <= 12) ){
                System.out.println("AMBIGUOUS");
            } else {
                System.out.println("MMYY");
            }
            
        } else {
            
            if( (0 < BB && BB <= 12) ){
                System.out.println("YYMM");
            } else {
                System.out.println("NA");
            }            
            
        }
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        int AA = Integer.parseInt(S.substring(0, 2));
        int BB = Integer.parseInt(S.substring(2, 4));
        
        if ( (0 < AA && AA <= 12) ){
            
            if( (0 < BB && BB <= 12) ){
                System.out.println("AMBIGUOUS");
            } else {
                System.out.println("MMYY");
            }
            
        } else {
            
            if( (0 < BB && BB <= 12) ){
                System.out.println("YYMM");
            } else {
                System.out.println("NA");
            }            
            
        }
    }
}
