import java.util.Scanner;

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

        show(calc(S));
    }

    private static String calc(String S) {
        int front = Integer.parseInt(S.substring(0, 2));
        int back = Integer.parseInt(S.substring(2, 4));

        if (isMonth(front)) {
            if (isMonth(back)) return "AMBIGUOUS";
            else return "MMYY";
        } else {
            if (isMonth(back)) return "YYMM";
            else return "NA";
        }
    }

    private static boolean isMonth(int n) {
        return 0 < n && n < 13;
    }

    private static String getLine(Scanner sc) { return sc.next(); }
    private static void show(String answer) {
        System.out.println(answer);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
            // main
        Scanner sc = new Scanner(System.in);
        String S = getLine(sc);

        show(calc(S));
    }

    private static String calc(String S) {
        int front = Integer.parseInt(S.substring(0, 2));
        int back = Integer.parseInt(S.substring(2, 4));

        if (isMonth(front)) {
            if (isMonth(back)) return "AMBIGUOUS";
            else return "MMYY";
        } else {
            if (isMonth(back)) return "YYMM";
            else return "NA";
        }
    }

    private static boolean isMonth(int n) {
        return 0 < n && n < 13;
    }

    private static String getLine(Scanner sc) { return sc.next(); }
    private static void show(String answer) {
        System.out.println(answer);
    }
} Main public static void main(String[] args) {
            // main
        Scanner sc = new Scanner(System.in);
        String S = getLine(sc);

        show(calc(S));
    } main {
            // main
        Scanner sc = new Scanner(System.in);
        String S = getLine(sc);

        show(calc(S));
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = getLine(sc); S getLine(sc) getLine sc show(calc(S)) show calc(S) calc S String[] args args private static String calc(String S) {
        int front = Integer.parseInt(S.substring(0, 2));
        int back = Integer.parseInt(S.substring(2, 4));

        if (isMonth(front)) {
            if (isMonth(back)) return "AMBIGUOUS";
            else return "MMYY";
        } else {
            if (isMonth(back)) return "YYMM";
            else return "NA";
        }
    } calc {
        int front = Integer.parseInt(S.substring(0, 2));
        int back = Integer.parseInt(S.substring(2, 4));

        if (isMonth(front)) {
            if (isMonth(back)) return "AMBIGUOUS";
            else return "MMYY";
        } else {
            if (isMonth(back)) return "YYMM";
            else return "NA";
        }
    } int front = Integer.parseInt(S.substring(0, 2)); front Integer.parseInt(S.substring(0, 2)) Integer.parseInt Integer S.substring(0, 2) S.substring S 0 2 int back = Integer.parseInt(S.substring(2, 4)); back Integer.parseInt(S.substring(2, 4)) Integer.parseInt Integer S.substring(2, 4) S.substring S 2 4 if (isMonth(front)) {
            if (isMonth(back)) return "AMBIGUOUS";
            else return "MMYY";
        } else {
            if (isMonth(back)) return "YYMM";
            else return "NA";
        } isMonth(front) isMonth front {
            if (isMonth(back)) return "AMBIGUOUS";
            else return "MMYY";
        } if (isMonth(back)) return "AMBIGUOUS";
            else return "MMYY"; isMonth(back) isMonth back return "AMBIGUOUS"; "AMBIGUOUS" return "MMYY"; "MMYY" {
            if (isMonth(back)) return "YYMM";
            else return "NA";
        } if (isMonth(back)) return "YYMM";
            else return "NA"; isMonth(back) isMonth back return "YYMM"; "YYMM" return "NA"; "NA" String S S private static boolean isMonth(int n) {
        return 0 < n && n < 13;
    } isMonth {
        return 0 < n && n < 13;
    } return 0 < n && n < 13; 0 < n && n < 13 0 < n 0 n n < 13 n 13 int n n private static String getLine(Scanner sc) { return sc.next(); } getLine { return sc.next(); } return sc.next(); sc.next() sc.next sc Scanner sc sc private static void show(String answer) {
        System.out.println(answer);
    } show {
        System.out.println(answer);
    } System.out.println(answer) System.out.println System.out System System.out answer String answer answer public class Main {
    public static void main(String[] args) {
            // main
        Scanner sc = new Scanner(System.in);
        String S = getLine(sc);

        show(calc(S));
    }

    private static String calc(String S) {
        int front = Integer.parseInt(S.substring(0, 2));
        int back = Integer.parseInt(S.substring(2, 4));

        if (isMonth(front)) {
            if (isMonth(back)) return "AMBIGUOUS";
            else return "MMYY";
        } else {
            if (isMonth(back)) return "YYMM";
            else return "NA";
        }
    }

    private static boolean isMonth(int n) {
        return 0 < n && n < 13;
    }

    private static String getLine(Scanner sc) { return sc.next(); }
    private static void show(String answer) {
        System.out.println(answer);
    }
} public class Main {
    public static void main(String[] args) {
            // main
        Scanner sc = new Scanner(System.in);
        String S = getLine(sc);

        show(calc(S));
    }

    private static String calc(String S) {
        int front = Integer.parseInt(S.substring(0, 2));
        int back = Integer.parseInt(S.substring(2, 4));

        if (isMonth(front)) {
            if (isMonth(back)) return "AMBIGUOUS";
            else return "MMYY";
        } else {
            if (isMonth(back)) return "YYMM";
            else return "NA";
        }
    }

    private static boolean isMonth(int n) {
        return 0 < n && n < 13;
    }

    private static String getLine(Scanner sc) { return sc.next(); }
    private static void show(String answer) {
        System.out.println(answer);
    }
} Main
import java.util.Scanner;

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

        show(calc(S));
    }

    private static String calc(String S) {
        int front = Integer.parseInt(S.substring(0, 2));
        int back = Integer.parseInt(S.substring(2, 4));

        if (isMonth(front)) {
            if (isMonth(back)) return "AMBIGUOUS";
            else return "MMYY";
        } else {
            if (isMonth(back)) return "YYMM";
            else return "NA";
        }
    }

    private static boolean isMonth(int n) {
        return 0 < n && n < 13;
    }

    private static String getLine(Scanner sc) { return sc.next(); }
    private static void show(String answer) {
        System.out.println(answer);
    }
}
