import java.util.*;

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

        String s = sc.next();
        String ans = "";

        int f = Integer.parseInt(s.substring(0, 2));
        int l = Integer.parseInt(s.substring(2, 4));

        //System.out.println(f);
        //System.out.println(l);


        if (f < 1 || 12 < f) {
            if (l < 1 || 12 < l) {
                ans = "NA";
            } else {
                ans = "YYMM";
            }
        } else {
            if (l < 1 || 12 < l) {
                ans = "MMYY";
            } else {
                ans = "AMBIGUOUS";
            }
        }
        System.out.println(ans);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);

        String s = sc.next();
        String ans = "";

        int f = Integer.parseInt(s.substring(0, 2));
        int l = Integer.parseInt(s.substring(2, 4));

        //System.out.println(f);
        //System.out.println(l);


        if (f < 1 || 12 < f) {
            if (l < 1 || 12 < l) {
                ans = "NA";
            } else {
                ans = "YYMM";
            }
        } else {
            if (l < 1 || 12 < l) {
                ans = "MMYY";
            } else {
                ans = "AMBIGUOUS";
            }
        }
        System.out.println(ans);
    }
} Main public static void main(String args[]){
        Scanner sc = new Scanner(System.in);

        String s = sc.next();
        String ans = "";

        int f = Integer.parseInt(s.substring(0, 2));
        int l = Integer.parseInt(s.substring(2, 4));

        //System.out.println(f);
        //System.out.println(l);


        if (f < 1 || 12 < f) {
            if (l < 1 || 12 < l) {
                ans = "NA";
            } else {
                ans = "YYMM";
            }
        } else {
            if (l < 1 || 12 < l) {
                ans = "MMYY";
            } else {
                ans = "AMBIGUOUS";
            }
        }
        System.out.println(ans);
    } main {
        Scanner sc = new Scanner(System.in);

        String s = sc.next();
        String ans = "";

        int f = Integer.parseInt(s.substring(0, 2));
        int l = Integer.parseInt(s.substring(2, 4));

        //System.out.println(f);
        //System.out.println(l);


        if (f < 1 || 12 < f) {
            if (l < 1 || 12 < l) {
                ans = "NA";
            } else {
                ans = "YYMM";
            }
        } else {
            if (l < 1 || 12 < l) {
                ans = "MMYY";
            } else {
                ans = "AMBIGUOUS";
            }
        }
        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 ans = ""; ans "" int f = Integer.parseInt(s.substring(0, 2)); f Integer.parseInt(s.substring(0, 2)) Integer.parseInt Integer s.substring(0, 2) s.substring s 0 2 int l = Integer.parseInt(s.substring(2, 4)); l Integer.parseInt(s.substring(2, 4)) Integer.parseInt Integer s.substring(2, 4) s.substring s 2 4 if (f < 1 || 12 < f) {
            if (l < 1 || 12 < l) {
                ans = "NA";
            } else {
                ans = "YYMM";
            }
        } else {
            if (l < 1 || 12 < l) {
                ans = "MMYY";
            } else {
                ans = "AMBIGUOUS";
            }
        } f < 1 || 12 < f f < 1 f 1 12 < f 12 f {
            if (l < 1 || 12 < l) {
                ans = "NA";
            } else {
                ans = "YYMM";
            }
        } if (l < 1 || 12 < l) {
                ans = "NA";
            } else {
                ans = "YYMM";
            } l < 1 || 12 < l l < 1 l 1 12 < l 12 l {
                ans = "NA";
            } ans = "NA" ans "NA" {
                ans = "YYMM";
            } ans = "YYMM" ans "YYMM" {
            if (l < 1 || 12 < l) {
                ans = "MMYY";
            } else {
                ans = "AMBIGUOUS";
            }
        } if (l < 1 || 12 < l) {
                ans = "MMYY";
            } else {
                ans = "AMBIGUOUS";
            } l < 1 || 12 < l l < 1 l 1 12 < l 12 l {
                ans = "MMYY";
            } ans = "MMYY" ans "MMYY" {
                ans = "AMBIGUOUS";
            } ans = "AMBIGUOUS" ans "AMBIGUOUS" 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[]){
        Scanner sc = new Scanner(System.in);

        String s = sc.next();
        String ans = "";

        int f = Integer.parseInt(s.substring(0, 2));
        int l = Integer.parseInt(s.substring(2, 4));

        //System.out.println(f);
        //System.out.println(l);


        if (f < 1 || 12 < f) {
            if (l < 1 || 12 < l) {
                ans = "NA";
            } else {
                ans = "YYMM";
            }
        } else {
            if (l < 1 || 12 < l) {
                ans = "MMYY";
            } else {
                ans = "AMBIGUOUS";
            }
        }
        System.out.println(ans);
    }
} public class Main {
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);

        String s = sc.next();
        String ans = "";

        int f = Integer.parseInt(s.substring(0, 2));
        int l = Integer.parseInt(s.substring(2, 4));

        //System.out.println(f);
        //System.out.println(l);


        if (f < 1 || 12 < f) {
            if (l < 1 || 12 < l) {
                ans = "NA";
            } else {
                ans = "YYMM";
            }
        } else {
            if (l < 1 || 12 < l) {
                ans = "MMYY";
            } else {
                ans = "AMBIGUOUS";
            }
        }
        System.out.println(ans);
    }
} Main
import java.util.*;

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

        String s = sc.next();
        String ans = "";

        int f = Integer.parseInt(s.substring(0, 2));
        int l = Integer.parseInt(s.substring(2, 4));

        //System.out.println(f);
        //System.out.println(l);


        if (f < 1 || 12 < f) {
            if (l < 1 || 12 < l) {
                ans = "NA";
            } else {
                ans = "YYMM";
            }
        } else {
            if (l < 1 || 12 < l) {
                ans = "MMYY";
            } else {
                ans = "AMBIGUOUS";
            }
        }
        System.out.println(ans);
    }
}
