import java.util.*;

public class Main{
    public static void main(String args[]){
        Scanner scanner = new Scanner(System.in);

        String S = scanner.next();

        int first2 = Integer.parseInt(S.substring(0,2));
        int last2 = Integer.parseInt(S.substring(2,4));
        String result = "";
        if(1<=first2 && first2<=12){
            if(1<=last2 && last2<=12){
                result = "AMBIGUOUS";
            }else{
                result = "MMYY";
            }
        }else{
            if(1<=last2 && last2<=12){
                result = "YYMM";
            }else{
                result = "NA";
            }
        }

        System.out.println(result);
    }
} import java.util.*; util.* java public class Main{
    public static void main(String args[]){
        Scanner scanner = new Scanner(System.in);

        String S = scanner.next();

        int first2 = Integer.parseInt(S.substring(0,2));
        int last2 = Integer.parseInt(S.substring(2,4));
        String result = "";
        if(1<=first2 && first2<=12){
            if(1<=last2 && last2<=12){
                result = "AMBIGUOUS";
            }else{
                result = "MMYY";
            }
        }else{
            if(1<=last2 && last2<=12){
                result = "YYMM";
            }else{
                result = "NA";
            }
        }

        System.out.println(result);
    }
} Main public static void main(String args[]){
        Scanner scanner = new Scanner(System.in);

        String S = scanner.next();

        int first2 = Integer.parseInt(S.substring(0,2));
        int last2 = Integer.parseInt(S.substring(2,4));
        String result = "";
        if(1<=first2 && first2<=12){
            if(1<=last2 && last2<=12){
                result = "AMBIGUOUS";
            }else{
                result = "MMYY";
            }
        }else{
            if(1<=last2 && last2<=12){
                result = "YYMM";
            }else{
                result = "NA";
            }
        }

        System.out.println(result);
    } main {
        Scanner scanner = new Scanner(System.in);

        String S = scanner.next();

        int first2 = Integer.parseInt(S.substring(0,2));
        int last2 = Integer.parseInt(S.substring(2,4));
        String result = "";
        if(1<=first2 && first2<=12){
            if(1<=last2 && last2<=12){
                result = "AMBIGUOUS";
            }else{
                result = "MMYY";
            }
        }else{
            if(1<=last2 && last2<=12){
                result = "YYMM";
            }else{
                result = "NA";
            }
        }

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

        String S = scanner.next();

        int first2 = Integer.parseInt(S.substring(0,2));
        int last2 = Integer.parseInt(S.substring(2,4));
        String result = "";
        if(1<=first2 && first2<=12){
            if(1<=last2 && last2<=12){
                result = "AMBIGUOUS";
            }else{
                result = "MMYY";
            }
        }else{
            if(1<=last2 && last2<=12){
                result = "YYMM";
            }else{
                result = "NA";
            }
        }

        System.out.println(result);
    }
} public class Main{
    public static void main(String args[]){
        Scanner scanner = new Scanner(System.in);

        String S = scanner.next();

        int first2 = Integer.parseInt(S.substring(0,2));
        int last2 = Integer.parseInt(S.substring(2,4));
        String result = "";
        if(1<=first2 && first2<=12){
            if(1<=last2 && last2<=12){
                result = "AMBIGUOUS";
            }else{
                result = "MMYY";
            }
        }else{
            if(1<=last2 && last2<=12){
                result = "YYMM";
            }else{
                result = "NA";
            }
        }

        System.out.println(result);
    }
} Main
import java.util.*;

public class Main{
    public static void main(String args[]){
        Scanner scanner = new Scanner(System.in);

        String S = scanner.next();

        int first2 = Integer.parseInt(S.substring(0,2));
        int last2 = Integer.parseInt(S.substring(2,4));
        String result = "";
        if(1<=first2 && first2<=12){
            if(1<=last2 && last2<=12){
                result = "AMBIGUOUS";
            }else{
                result = "MMYY";
            }
        }else{
            if(1<=last2 && last2<=12){
                result = "YYMM";
            }else{
                result = "NA";
            }
        }

        System.out.println(result);
    }
}