import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        sc.close();

        int left = Integer.parseInt(s.substring(0, 2));
        int right = Integer.parseInt(s.substring(2));

        String ans;
        if (isBetween1and12(left)) {
            if (isBetween1and12(right)) {
                ans = "AMBIGUOUS";
            } else {
                ans = "MMYY";
            }
        } else {
            if (isBetween1and12(right)) {
                ans = "YYMM";
            } else {
                ans = "NA";
            }
        }

        System.out.println(ans);
    }

    static boolean isBetween1and12(int i) {
        return 1 <= i && i <= 12;
    }
} import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        sc.close();

        int left = Integer.parseInt(s.substring(0, 2));
        int right = Integer.parseInt(s.substring(2));

        String ans;
        if (isBetween1and12(left)) {
            if (isBetween1and12(right)) {
                ans = "AMBIGUOUS";
            } else {
                ans = "MMYY";
            }
        } else {
            if (isBetween1and12(right)) {
                ans = "YYMM";
            } else {
                ans = "NA";
            }
        }

        System.out.println(ans);
    }

    static boolean isBetween1and12(int i) {
        return 1 <= i && i <= 12;
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        sc.close();

        int left = Integer.parseInt(s.substring(0, 2));
        int right = Integer.parseInt(s.substring(2));

        String ans;
        if (isBetween1and12(left)) {
            if (isBetween1and12(right)) {
                ans = "AMBIGUOUS";
            } else {
                ans = "MMYY";
            }
        } else {
            if (isBetween1and12(right)) {
                ans = "YYMM";
            } else {
                ans = "NA";
            }
        }

        System.out.println(ans);
    } main {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        sc.close();

        int left = Integer.parseInt(s.substring(0, 2));
        int right = Integer.parseInt(s.substring(2));

        String ans;
        if (isBetween1and12(left)) {
            if (isBetween1and12(right)) {
                ans = "AMBIGUOUS";
            } else {
                ans = "MMYY";
            }
        } else {
            if (isBetween1and12(right)) {
                ans = "YYMM";
            } else {
                ans = "NA";
            }
        }

        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 sc.close() sc.close sc int left = Integer.parseInt(s.substring(0, 2)); left Integer.parseInt(s.substring(0, 2)) Integer.parseInt Integer s.substring(0, 2) s.substring s 0 2 int right = Integer.parseInt(s.substring(2)); right Integer.parseInt(s.substring(2)) Integer.parseInt Integer s.substring(2) s.substring s 2 String ans; ans if (isBetween1and12(left)) {
            if (isBetween1and12(right)) {
                ans = "AMBIGUOUS";
            } else {
                ans = "MMYY";
            }
        } else {
            if (isBetween1and12(right)) {
                ans = "YYMM";
            } else {
                ans = "NA";
            }
        } isBetween1and12(left) isBetween1and12 left {
            if (isBetween1and12(right)) {
                ans = "AMBIGUOUS";
            } else {
                ans = "MMYY";
            }
        } if (isBetween1and12(right)) {
                ans = "AMBIGUOUS";
            } else {
                ans = "MMYY";
            } isBetween1and12(right) isBetween1and12 right {
                ans = "AMBIGUOUS";
            } ans = "AMBIGUOUS" ans "AMBIGUOUS" {
                ans = "MMYY";
            } ans = "MMYY" ans "MMYY" {
            if (isBetween1and12(right)) {
                ans = "YYMM";
            } else {
                ans = "NA";
            }
        } if (isBetween1and12(right)) {
                ans = "YYMM";
            } else {
                ans = "NA";
            } isBetween1and12(right) isBetween1and12 right {
                ans = "YYMM";
            } ans = "YYMM" ans "YYMM" {
                ans = "NA";
            } ans = "NA" ans "NA" System.out.println(ans) System.out.println System.out System System.out ans String[] args args static boolean isBetween1and12(int i) {
        return 1 <= i && i <= 12;
    } isBetween1and12 {
        return 1 <= i && i <= 12;
    } return 1 <= i && i <= 12; 1 <= i && i <= 12 1 <= i 1 i i <= 12 i 12 int i i public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        sc.close();

        int left = Integer.parseInt(s.substring(0, 2));
        int right = Integer.parseInt(s.substring(2));

        String ans;
        if (isBetween1and12(left)) {
            if (isBetween1and12(right)) {
                ans = "AMBIGUOUS";
            } else {
                ans = "MMYY";
            }
        } else {
            if (isBetween1and12(right)) {
                ans = "YYMM";
            } else {
                ans = "NA";
            }
        }

        System.out.println(ans);
    }

    static boolean isBetween1and12(int i) {
        return 1 <= i && i <= 12;
    }
} public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        sc.close();

        int left = Integer.parseInt(s.substring(0, 2));
        int right = Integer.parseInt(s.substring(2));

        String ans;
        if (isBetween1and12(left)) {
            if (isBetween1and12(right)) {
                ans = "AMBIGUOUS";
            } else {
                ans = "MMYY";
            }
        } else {
            if (isBetween1and12(right)) {
                ans = "YYMM";
            } else {
                ans = "NA";
            }
        }

        System.out.println(ans);
    }

    static boolean isBetween1and12(int i) {
        return 1 <= i && i <= 12;
    }
} Main
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        sc.close();

        int left = Integer.parseInt(s.substring(0, 2));
        int right = Integer.parseInt(s.substring(2));

        String ans;
        if (isBetween1and12(left)) {
            if (isBetween1and12(right)) {
                ans = "AMBIGUOUS";
            } else {
                ans = "MMYY";
            }
        } else {
            if (isBetween1and12(right)) {
                ans = "YYMM";
            } else {
                ans = "NA";
            }
        }

        System.out.println(ans);
    }

    static boolean isBetween1and12(int i) {
        return 1 <= i && i <= 12;
    }
}
