import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner std = new Scanner(System.in);
        String text = std.next();
        String first = text.substring(0, 2);
        String last = text.substring(2);
        Integer firstValue = Integer.parseInt(first);
        Integer lastValue = Integer.parseInt(last);

        String format;
        if (availableMonth(firstValue) && availableMonth(lastValue)) {
            format = "AMBIGUOUS";
        } else if (availableMonth(firstValue)) {
            format = "MMYY";
        } else if (availableMonth(lastValue)) {
            format = "YYMM";
        } else {
            format = "NA";
        }

        System.out.println(format);
    }

    static boolean availableMonth(int val) {
        return val >= 1 && val <= 12;
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner std = new Scanner(System.in);
        String text = std.next();
        String first = text.substring(0, 2);
        String last = text.substring(2);
        Integer firstValue = Integer.parseInt(first);
        Integer lastValue = Integer.parseInt(last);

        String format;
        if (availableMonth(firstValue) && availableMonth(lastValue)) {
            format = "AMBIGUOUS";
        } else if (availableMonth(firstValue)) {
            format = "MMYY";
        } else if (availableMonth(lastValue)) {
            format = "YYMM";
        } else {
            format = "NA";
        }

        System.out.println(format);
    }

    static boolean availableMonth(int val) {
        return val >= 1 && val <= 12;
    }
} Main public static void main(String[] args) {
        Scanner std = new Scanner(System.in);
        String text = std.next();
        String first = text.substring(0, 2);
        String last = text.substring(2);
        Integer firstValue = Integer.parseInt(first);
        Integer lastValue = Integer.parseInt(last);

        String format;
        if (availableMonth(firstValue) && availableMonth(lastValue)) {
            format = "AMBIGUOUS";
        } else if (availableMonth(firstValue)) {
            format = "MMYY";
        } else if (availableMonth(lastValue)) {
            format = "YYMM";
        } else {
            format = "NA";
        }

        System.out.println(format);
    } main {
        Scanner std = new Scanner(System.in);
        String text = std.next();
        String first = text.substring(0, 2);
        String last = text.substring(2);
        Integer firstValue = Integer.parseInt(first);
        Integer lastValue = Integer.parseInt(last);

        String format;
        if (availableMonth(firstValue) && availableMonth(lastValue)) {
            format = "AMBIGUOUS";
        } else if (availableMonth(firstValue)) {
            format = "MMYY";
        } else if (availableMonth(lastValue)) {
            format = "YYMM";
        } else {
            format = "NA";
        }

        System.out.println(format);
    } Scanner std = new Scanner(System.in); std new Scanner(System.in) String text = std.next(); text std.next() std.next std String first = text.substring(0, 2); first text.substring(0, 2) text.substring text 0 2 String last = text.substring(2); last text.substring(2) text.substring text 2 Integer firstValue = Integer.parseInt(first); firstValue Integer.parseInt(first) Integer.parseInt Integer first Integer lastValue = Integer.parseInt(last); lastValue Integer.parseInt(last) Integer.parseInt Integer last String format; format if (availableMonth(firstValue) && availableMonth(lastValue)) {
            format = "AMBIGUOUS";
        } else if (availableMonth(firstValue)) {
            format = "MMYY";
        } else if (availableMonth(lastValue)) {
            format = "YYMM";
        } else {
            format = "NA";
        } availableMonth(firstValue) && availableMonth(lastValue) availableMonth(firstValue) availableMonth firstValue availableMonth(lastValue) availableMonth lastValue {
            format = "AMBIGUOUS";
        } format = "AMBIGUOUS" format "AMBIGUOUS" if (availableMonth(firstValue)) {
            format = "MMYY";
        } else if (availableMonth(lastValue)) {
            format = "YYMM";
        } else {
            format = "NA";
        } availableMonth(firstValue) availableMonth firstValue {
            format = "MMYY";
        } format = "MMYY" format "MMYY" if (availableMonth(lastValue)) {
            format = "YYMM";
        } else {
            format = "NA";
        } availableMonth(lastValue) availableMonth lastValue {
            format = "YYMM";
        } format = "YYMM" format "YYMM" {
            format = "NA";
        } format = "NA" format "NA" System.out.println(format) System.out.println System.out System System.out format String[] args args static boolean availableMonth(int val) {
        return val >= 1 && val <= 12;
    } availableMonth {
        return val >= 1 && val <= 12;
    } return val >= 1 && val <= 12; val >= 1 && val <= 12 val >= 1 val 1 val <= 12 val 12 int val val public class Main {
    public static void main(String[] args) {
        Scanner std = new Scanner(System.in);
        String text = std.next();
        String first = text.substring(0, 2);
        String last = text.substring(2);
        Integer firstValue = Integer.parseInt(first);
        Integer lastValue = Integer.parseInt(last);

        String format;
        if (availableMonth(firstValue) && availableMonth(lastValue)) {
            format = "AMBIGUOUS";
        } else if (availableMonth(firstValue)) {
            format = "MMYY";
        } else if (availableMonth(lastValue)) {
            format = "YYMM";
        } else {
            format = "NA";
        }

        System.out.println(format);
    }

    static boolean availableMonth(int val) {
        return val >= 1 && val <= 12;
    }
} public class Main {
    public static void main(String[] args) {
        Scanner std = new Scanner(System.in);
        String text = std.next();
        String first = text.substring(0, 2);
        String last = text.substring(2);
        Integer firstValue = Integer.parseInt(first);
        Integer lastValue = Integer.parseInt(last);

        String format;
        if (availableMonth(firstValue) && availableMonth(lastValue)) {
            format = "AMBIGUOUS";
        } else if (availableMonth(firstValue)) {
            format = "MMYY";
        } else if (availableMonth(lastValue)) {
            format = "YYMM";
        } else {
            format = "NA";
        }

        System.out.println(format);
    }

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

public class Main {
    public static void main(String[] args) {
        Scanner std = new Scanner(System.in);
        String text = std.next();
        String first = text.substring(0, 2);
        String last = text.substring(2);
        Integer firstValue = Integer.parseInt(first);
        Integer lastValue = Integer.parseInt(last);

        String format;
        if (availableMonth(firstValue) && availableMonth(lastValue)) {
            format = "AMBIGUOUS";
        } else if (availableMonth(firstValue)) {
            format = "MMYY";
        } else if (availableMonth(lastValue)) {
            format = "YYMM";
        } else {
            format = "NA";
        }

        System.out.println(format);
    }

    static boolean availableMonth(int val) {
        return val >= 1 && val <= 12;
    }
}
