import java.util.Scanner;

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

        String S = sc.next();
        sc.close();

        String firstString = S.substring(0, 2);
        String lastString = S.substring(2, 4);

        String result = "NA";
        int count = 0;
        if (isYY(firstString)) {
            if (isMM(lastString)) {
                result = "YYMM";
                count++;
            }
        }
        if (isMM(firstString)) {
            if (isYY(lastString)) {
                result = "MMYY";
                count++;
            }
        }
        if (count == 2) {
            result = "AMBIGUOUS";
        }
        System.out.println(result);
    }
    public static boolean isYY(String string) {

        boolean flag = false;
        if (string.matches("[0-9]{2}")) {
            flag = true;
        }
        return flag;
    }
    public static boolean isMM(String string) {

        boolean flag = false;
        if (string.matches("0[1-9]{1}") || string.matches("1[0-2]{1}")) {
            flag = true;
        }
        return flag;
    }
} import java.util.Scanner; Scanner java.util class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String S = sc.next();
        sc.close();

        String firstString = S.substring(0, 2);
        String lastString = S.substring(2, 4);

        String result = "NA";
        int count = 0;
        if (isYY(firstString)) {
            if (isMM(lastString)) {
                result = "YYMM";
                count++;
            }
        }
        if (isMM(firstString)) {
            if (isYY(lastString)) {
                result = "MMYY";
                count++;
            }
        }
        if (count == 2) {
            result = "AMBIGUOUS";
        }
        System.out.println(result);
    }
    public static boolean isYY(String string) {

        boolean flag = false;
        if (string.matches("[0-9]{2}")) {
            flag = true;
        }
        return flag;
    }
    public static boolean isMM(String string) {

        boolean flag = false;
        if (string.matches("0[1-9]{1}") || string.matches("1[0-2]{1}")) {
            flag = true;
        }
        return flag;
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String S = sc.next();
        sc.close();

        String firstString = S.substring(0, 2);
        String lastString = S.substring(2, 4);

        String result = "NA";
        int count = 0;
        if (isYY(firstString)) {
            if (isMM(lastString)) {
                result = "YYMM";
                count++;
            }
        }
        if (isMM(firstString)) {
            if (isYY(lastString)) {
                result = "MMYY";
                count++;
            }
        }
        if (count == 2) {
            result = "AMBIGUOUS";
        }
        System.out.println(result);
    } main {
        Scanner sc = new Scanner(System.in);

        String S = sc.next();
        sc.close();

        String firstString = S.substring(0, 2);
        String lastString = S.substring(2, 4);

        String result = "NA";
        int count = 0;
        if (isYY(firstString)) {
            if (isMM(lastString)) {
                result = "YYMM";
                count++;
            }
        }
        if (isMM(firstString)) {
            if (isYY(lastString)) {
                result = "MMYY";
                count++;
            }
        }
        if (count == 2) {
            result = "AMBIGUOUS";
        }
        System.out.println(result);
    } 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 String firstString = S.substring(0, 2); firstString S.substring(0, 2) S.substring S 0 2 String lastString = S.substring(2, 4); lastString S.substring(2, 4) S.substring S 2 4 String result = "NA"; result "NA" int count = 0; count 0 if (isYY(firstString)) {
            if (isMM(lastString)) {
                result = "YYMM";
                count++;
            }
        } isYY(firstString) isYY firstString {
            if (isMM(lastString)) {
                result = "YYMM";
                count++;
            }
        } if (isMM(lastString)) {
                result = "YYMM";
                count++;
            } isMM(lastString) isMM lastString {
                result = "YYMM";
                count++;
            } result = "YYMM" result "YYMM" count++ count if (isMM(firstString)) {
            if (isYY(lastString)) {
                result = "MMYY";
                count++;
            }
        } isMM(firstString) isMM firstString {
            if (isYY(lastString)) {
                result = "MMYY";
                count++;
            }
        } if (isYY(lastString)) {
                result = "MMYY";
                count++;
            } isYY(lastString) isYY lastString {
                result = "MMYY";
                count++;
            } result = "MMYY" result "MMYY" count++ count if (count == 2) {
            result = "AMBIGUOUS";
        } count == 2 count 2 {
            result = "AMBIGUOUS";
        } result = "AMBIGUOUS" result "AMBIGUOUS" System.out.println(result) System.out.println System.out System System.out result String[] args args public static boolean isYY(String string) {

        boolean flag = false;
        if (string.matches("[0-9]{2}")) {
            flag = true;
        }
        return flag;
    } isYY {

        boolean flag = false;
        if (string.matches("[0-9]{2}")) {
            flag = true;
        }
        return flag;
    } boolean flag = false; flag false if (string.matches("[0-9]{2}")) {
            flag = true;
        } string.matches("[0-9]{2}") string.matches string "[0-9]{2}" {
            flag = true;
        } flag = true flag true return flag; flag String string string public static boolean isMM(String string) {

        boolean flag = false;
        if (string.matches("0[1-9]{1}") || string.matches("1[0-2]{1}")) {
            flag = true;
        }
        return flag;
    } isMM {

        boolean flag = false;
        if (string.matches("0[1-9]{1}") || string.matches("1[0-2]{1}")) {
            flag = true;
        }
        return flag;
    } boolean flag = false; flag false if (string.matches("0[1-9]{1}") || string.matches("1[0-2]{1}")) {
            flag = true;
        } string.matches("0[1-9]{1}") || string.matches("1[0-2]{1}") string.matches("0[1-9]{1}") string.matches string "0[1-9]{1}" string.matches("1[0-2]{1}") string.matches string "1[0-2]{1}" {
            flag = true;
        } flag = true flag true return flag; flag String string string
import java.util.Scanner;

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

        String S = sc.next();
        sc.close();

        String firstString = S.substring(0, 2);
        String lastString = S.substring(2, 4);

        String result = "NA";
        int count = 0;
        if (isYY(firstString)) {
            if (isMM(lastString)) {
                result = "YYMM";
                count++;
            }
        }
        if (isMM(firstString)) {
            if (isYY(lastString)) {
                result = "MMYY";
                count++;
            }
        }
        if (count == 2) {
            result = "AMBIGUOUS";
        }
        System.out.println(result);
    }
    public static boolean isYY(String string) {

        boolean flag = false;
        if (string.matches("[0-9]{2}")) {
            flag = true;
        }
        return flag;
    }
    public static boolean isMM(String string) {

        boolean flag = false;
        if (string.matches("0[1-9]{1}") || string.matches("1[0-2]{1}")) {
            flag = true;
        }
        return flag;
    }
}