import java.util.Scanner;

public class Main {

    private static final String AMBIGUOUS = "AMBIGUOUS";
    private static final String MMYY = "MMYY";
    private static final String NA = "NA";
    private static final String YYMM = "YYMM";

    public static String process(String S) {
        String firstPart = S.substring(0, 2);
        String secondPart = S.substring(2);

        boolean isFirstPartValid = isValidMonth(firstPart);
        boolean isSecondPartValid = isValidMonth(secondPart);
        if (isFirstPartValid && isSecondPartValid) {
            return AMBIGUOUS;
        } else if (isFirstPartValid) {
            return MMYY;
        } else if (isSecondPartValid) {
            return YYMM;
        } else {
            return NA;
        }
    }

    private static boolean isValidMonth(String part) {
        try {
            Integer i = Integer.valueOf(part);
            return i > 0 && i <= 12;
        } catch (Exception e) {
            return false;
        }
    }

    // Util func

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

        String S = sc.next();

        final String result = process(S);

        output(result);
    }

    private static void output(String result) {
        System.out.println(result);
    }
} import java.util.Scanner; Scanner java.util public class Main {

    private static final String AMBIGUOUS = "AMBIGUOUS";
    private static final String MMYY = "MMYY";
    private static final String NA = "NA";
    private static final String YYMM = "YYMM";

    public static String process(String S) {
        String firstPart = S.substring(0, 2);
        String secondPart = S.substring(2);

        boolean isFirstPartValid = isValidMonth(firstPart);
        boolean isSecondPartValid = isValidMonth(secondPart);
        if (isFirstPartValid && isSecondPartValid) {
            return AMBIGUOUS;
        } else if (isFirstPartValid) {
            return MMYY;
        } else if (isSecondPartValid) {
            return YYMM;
        } else {
            return NA;
        }
    }

    private static boolean isValidMonth(String part) {
        try {
            Integer i = Integer.valueOf(part);
            return i > 0 && i <= 12;
        } catch (Exception e) {
            return false;
        }
    }

    // Util func

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

        String S = sc.next();

        final String result = process(S);

        output(result);
    }

    private static void output(String result) {
        System.out.println(result);
    }
} Main private static final String AMBIGUOUS = "AMBIGUOUS"; AMBIGUOUS "AMBIGUOUS" private static final String MMYY = "MMYY"; MMYY "MMYY" private static final String NA = "NA"; NA "NA" private static final String YYMM = "YYMM"; YYMM "YYMM" public static String process(String S) {
        String firstPart = S.substring(0, 2);
        String secondPart = S.substring(2);

        boolean isFirstPartValid = isValidMonth(firstPart);
        boolean isSecondPartValid = isValidMonth(secondPart);
        if (isFirstPartValid && isSecondPartValid) {
            return AMBIGUOUS;
        } else if (isFirstPartValid) {
            return MMYY;
        } else if (isSecondPartValid) {
            return YYMM;
        } else {
            return NA;
        }
    } process {
        String firstPart = S.substring(0, 2);
        String secondPart = S.substring(2);

        boolean isFirstPartValid = isValidMonth(firstPart);
        boolean isSecondPartValid = isValidMonth(secondPart);
        if (isFirstPartValid && isSecondPartValid) {
            return AMBIGUOUS;
        } else if (isFirstPartValid) {
            return MMYY;
        } else if (isSecondPartValid) {
            return YYMM;
        } else {
            return NA;
        }
    } String firstPart = S.substring(0, 2); firstPart S.substring(0, 2) S.substring S 0 2 String secondPart = S.substring(2); secondPart S.substring(2) S.substring S 2 boolean isFirstPartValid = isValidMonth(firstPart); isFirstPartValid isValidMonth(firstPart) isValidMonth firstPart boolean isSecondPartValid = isValidMonth(secondPart); isSecondPartValid isValidMonth(secondPart) isValidMonth secondPart if (isFirstPartValid && isSecondPartValid) {
            return AMBIGUOUS;
        } else if (isFirstPartValid) {
            return MMYY;
        } else if (isSecondPartValid) {
            return YYMM;
        } else {
            return NA;
        } isFirstPartValid && isSecondPartValid isFirstPartValid isSecondPartValid {
            return AMBIGUOUS;
        } return AMBIGUOUS; AMBIGUOUS if (isFirstPartValid) {
            return MMYY;
        } else if (isSecondPartValid) {
            return YYMM;
        } else {
            return NA;
        } isFirstPartValid {
            return MMYY;
        } return MMYY; MMYY if (isSecondPartValid) {
            return YYMM;
        } else {
            return NA;
        } isSecondPartValid {
            return YYMM;
        } return YYMM; YYMM {
            return NA;
        } return NA; NA String S S private static boolean isValidMonth(String part) {
        try {
            Integer i = Integer.valueOf(part);
            return i > 0 && i <= 12;
        } catch (Exception e) {
            return false;
        }
    } isValidMonth {
        try {
            Integer i = Integer.valueOf(part);
            return i > 0 && i <= 12;
        } catch (Exception e) {
            return false;
        }
    } try {
            Integer i = Integer.valueOf(part);
            return i > 0 && i <= 12;
        } catch (Exception e) {
            return false;
        } catch (Exception e) {
            return false;
        } Exception e {
            return false;
        } return false; false {
            Integer i = Integer.valueOf(part);
            return i > 0 && i <= 12;
        } Integer i = Integer.valueOf(part); i Integer.valueOf(part) Integer.valueOf Integer part return i > 0 && i <= 12; i > 0 && i <= 12 i > 0 i 0 i <= 12 i 12 String part part public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String S = sc.next();

        final String result = process(S);

        output(result);
    } main {
        Scanner sc = new Scanner(System.in);

        String S = sc.next();

        final String result = process(S);

        output(result);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc final String result = process(S); result process(S) process S output(result) output result String[] args args private static void output(String result) {
        System.out.println(result);
    } output {
        System.out.println(result);
    } System.out.println(result) System.out.println System.out System System.out result String result result public class Main {

    private static final String AMBIGUOUS = "AMBIGUOUS";
    private static final String MMYY = "MMYY";
    private static final String NA = "NA";
    private static final String YYMM = "YYMM";

    public static String process(String S) {
        String firstPart = S.substring(0, 2);
        String secondPart = S.substring(2);

        boolean isFirstPartValid = isValidMonth(firstPart);
        boolean isSecondPartValid = isValidMonth(secondPart);
        if (isFirstPartValid && isSecondPartValid) {
            return AMBIGUOUS;
        } else if (isFirstPartValid) {
            return MMYY;
        } else if (isSecondPartValid) {
            return YYMM;
        } else {
            return NA;
        }
    }

    private static boolean isValidMonth(String part) {
        try {
            Integer i = Integer.valueOf(part);
            return i > 0 && i <= 12;
        } catch (Exception e) {
            return false;
        }
    }

    // Util func

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

        String S = sc.next();

        final String result = process(S);

        output(result);
    }

    private static void output(String result) {
        System.out.println(result);
    }
} public class Main {

    private static final String AMBIGUOUS = "AMBIGUOUS";
    private static final String MMYY = "MMYY";
    private static final String NA = "NA";
    private static final String YYMM = "YYMM";

    public static String process(String S) {
        String firstPart = S.substring(0, 2);
        String secondPart = S.substring(2);

        boolean isFirstPartValid = isValidMonth(firstPart);
        boolean isSecondPartValid = isValidMonth(secondPart);
        if (isFirstPartValid && isSecondPartValid) {
            return AMBIGUOUS;
        } else if (isFirstPartValid) {
            return MMYY;
        } else if (isSecondPartValid) {
            return YYMM;
        } else {
            return NA;
        }
    }

    private static boolean isValidMonth(String part) {
        try {
            Integer i = Integer.valueOf(part);
            return i > 0 && i <= 12;
        } catch (Exception e) {
            return false;
        }
    }

    // Util func

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

        String S = sc.next();

        final String result = process(S);

        output(result);
    }

    private static void output(String result) {
        System.out.println(result);
    }
} Main
import java.util.Scanner;

public class Main {

    private static final String AMBIGUOUS = "AMBIGUOUS";
    private static final String MMYY = "MMYY";
    private static final String NA = "NA";
    private static final String YYMM = "YYMM";

    public static String process(String S) {
        String firstPart = S.substring(0, 2);
        String secondPart = S.substring(2);

        boolean isFirstPartValid = isValidMonth(firstPart);
        boolean isSecondPartValid = isValidMonth(secondPart);
        if (isFirstPartValid && isSecondPartValid) {
            return AMBIGUOUS;
        } else if (isFirstPartValid) {
            return MMYY;
        } else if (isSecondPartValid) {
            return YYMM;
        } else {
            return NA;
        }
    }

    private static boolean isValidMonth(String part) {
        try {
            Integer i = Integer.valueOf(part);
            return i > 0 && i <= 12;
        } catch (Exception e) {
            return false;
        }
    }

    // Util func

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

        String S = sc.next();

        final String result = process(S);

        output(result);
    }

    private static void output(String result) {
        System.out.println(result);
    }
}
