import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        sc.close();
        
        int xx = Integer.parseInt(s.substring(0,2));
        int yy = Integer.parseInt(s.substring(2,4));
        String ret = "";
        boolean xIsMonth = 1 <= xx && xx <= 12;
        boolean yIsMonth = 1 <= yy && yy <= 12;
        if(xIsMonth && yIsMonth) {
            ret = "AMBIGUOUS";
        } else if(xIsMonth && !yIsMonth) {
            ret = "MMYY";
        } else if(!xIsMonth && yIsMonth) {
            ret = "YYMM";
        } else {
            ret = "NA";
        }
        System.out.println(ret);
    }
} 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();
        sc.close();
        
        int xx = Integer.parseInt(s.substring(0,2));
        int yy = Integer.parseInt(s.substring(2,4));
        String ret = "";
        boolean xIsMonth = 1 <= xx && xx <= 12;
        boolean yIsMonth = 1 <= yy && yy <= 12;
        if(xIsMonth && yIsMonth) {
            ret = "AMBIGUOUS";
        } else if(xIsMonth && !yIsMonth) {
            ret = "MMYY";
        } else if(!xIsMonth && yIsMonth) {
            ret = "YYMM";
        } else {
            ret = "NA";
        }
        System.out.println(ret);
    }
} Main public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        sc.close();
        
        int xx = Integer.parseInt(s.substring(0,2));
        int yy = Integer.parseInt(s.substring(2,4));
        String ret = "";
        boolean xIsMonth = 1 <= xx && xx <= 12;
        boolean yIsMonth = 1 <= yy && yy <= 12;
        if(xIsMonth && yIsMonth) {
            ret = "AMBIGUOUS";
        } else if(xIsMonth && !yIsMonth) {
            ret = "MMYY";
        } else if(!xIsMonth && yIsMonth) {
            ret = "YYMM";
        } else {
            ret = "NA";
        }
        System.out.println(ret);
    } main {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        sc.close();
        
        int xx = Integer.parseInt(s.substring(0,2));
        int yy = Integer.parseInt(s.substring(2,4));
        String ret = "";
        boolean xIsMonth = 1 <= xx && xx <= 12;
        boolean yIsMonth = 1 <= yy && yy <= 12;
        if(xIsMonth && yIsMonth) {
            ret = "AMBIGUOUS";
        } else if(xIsMonth && !yIsMonth) {
            ret = "MMYY";
        } else if(!xIsMonth && yIsMonth) {
            ret = "YYMM";
        } else {
            ret = "NA";
        }
        System.out.println(ret);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc sc.close() sc.close sc int xx = Integer.parseInt(s.substring(0,2)); xx Integer.parseInt(s.substring(0,2)) Integer.parseInt Integer s.substring(0,2) s.substring s 0 2 int yy = Integer.parseInt(s.substring(2,4)); yy Integer.parseInt(s.substring(2,4)) Integer.parseInt Integer s.substring(2,4) s.substring s 2 4 String ret = ""; ret "" boolean xIsMonth = 1 <= xx && xx <= 12; xIsMonth 1 <= xx && xx <= 12 1 <= xx 1 xx xx <= 12 xx 12 boolean yIsMonth = 1 <= yy && yy <= 12; yIsMonth 1 <= yy && yy <= 12 1 <= yy 1 yy yy <= 12 yy 12 if(xIsMonth && yIsMonth) {
            ret = "AMBIGUOUS";
        } else if(xIsMonth && !yIsMonth) {
            ret = "MMYY";
        } else if(!xIsMonth && yIsMonth) {
            ret = "YYMM";
        } else {
            ret = "NA";
        } xIsMonth && yIsMonth xIsMonth yIsMonth {
            ret = "AMBIGUOUS";
        } ret = "AMBIGUOUS" ret "AMBIGUOUS" if(xIsMonth && !yIsMonth) {
            ret = "MMYY";
        } else if(!xIsMonth && yIsMonth) {
            ret = "YYMM";
        } else {
            ret = "NA";
        } xIsMonth && !yIsMonth xIsMonth !yIsMonth yIsMonth {
            ret = "MMYY";
        } ret = "MMYY" ret "MMYY" if(!xIsMonth && yIsMonth) {
            ret = "YYMM";
        } else {
            ret = "NA";
        } !xIsMonth && yIsMonth !xIsMonth xIsMonth yIsMonth {
            ret = "YYMM";
        } ret = "YYMM" ret "YYMM" {
            ret = "NA";
        } ret = "NA" ret "NA" System.out.println(ret) System.out.println System.out System System.out ret String[] args args public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        sc.close();
        
        int xx = Integer.parseInt(s.substring(0,2));
        int yy = Integer.parseInt(s.substring(2,4));
        String ret = "";
        boolean xIsMonth = 1 <= xx && xx <= 12;
        boolean yIsMonth = 1 <= yy && yy <= 12;
        if(xIsMonth && yIsMonth) {
            ret = "AMBIGUOUS";
        } else if(xIsMonth && !yIsMonth) {
            ret = "MMYY";
        } else if(!xIsMonth && yIsMonth) {
            ret = "YYMM";
        } else {
            ret = "NA";
        }
        System.out.println(ret);
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        sc.close();
        
        int xx = Integer.parseInt(s.substring(0,2));
        int yy = Integer.parseInt(s.substring(2,4));
        String ret = "";
        boolean xIsMonth = 1 <= xx && xx <= 12;
        boolean yIsMonth = 1 <= yy && yy <= 12;
        if(xIsMonth && yIsMonth) {
            ret = "AMBIGUOUS";
        } else if(xIsMonth && !yIsMonth) {
            ret = "MMYY";
        } else if(!xIsMonth && yIsMonth) {
            ret = "YYMM";
        } else {
            ret = "NA";
        }
        System.out.println(ret);
    }
} 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();
        sc.close();
        
        int xx = Integer.parseInt(s.substring(0,2));
        int yy = Integer.parseInt(s.substring(2,4));
        String ret = "";
        boolean xIsMonth = 1 <= xx && xx <= 12;
        boolean yIsMonth = 1 <= yy && yy <= 12;
        if(xIsMonth && yIsMonth) {
            ret = "AMBIGUOUS";
        } else if(xIsMonth && !yIsMonth) {
            ret = "MMYY";
        } else if(!xIsMonth && yIsMonth) {
            ret = "YYMM";
        } else {
            ret = "NA";
        }
        System.out.println(ret);
    }
}
