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;
    }
}
/tmp/hf-datasets-cache/medium/datasets/42704881117311-config-parquet-and-info-qiankunmu-Project_CodeNet-896c9d36/hub/datasets--qiankunmu--Project_CodeNet_Python800_and_Java250/snapshots/c899fde44a77ba1cc14973ed3de064e4ff3aadc7/Project_CodeNet_Java250.tar.gz