import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String str = sc.next();

        String s1 = str.substring(0, 2);
        String s2 = str.substring(2, 4);

        int s1i = Integer.valueOf(s1);
        int s2i = Integer.valueOf(s2);

        boolean s1IsM = 0 < s1i && s1i < 13;
        boolean s2IsM = 0 < s2i && s2i < 13;

        String result;

        if (s1IsM && s2IsM) {
            result = "AMBIGUOUS";
        } else if (!s1IsM && s2IsM) {
            result = "YYMM";
        } else if (s1IsM) {
            result = "MMYY";
        } else {
            result = "NA";
        }

        System.out.println(result);
    }

} import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String str = sc.next();

        String s1 = str.substring(0, 2);
        String s2 = str.substring(2, 4);

        int s1i = Integer.valueOf(s1);
        int s2i = Integer.valueOf(s2);

        boolean s1IsM = 0 < s1i && s1i < 13;
        boolean s2IsM = 0 < s2i && s2i < 13;

        String result;

        if (s1IsM && s2IsM) {
            result = "AMBIGUOUS";
        } else if (!s1IsM && s2IsM) {
            result = "YYMM";
        } else if (s1IsM) {
            result = "MMYY";
        } else {
            result = "NA";
        }

        System.out.println(result);
    }

} Main public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String str = sc.next();

        String s1 = str.substring(0, 2);
        String s2 = str.substring(2, 4);

        int s1i = Integer.valueOf(s1);
        int s2i = Integer.valueOf(s2);

        boolean s1IsM = 0 < s1i && s1i < 13;
        boolean s2IsM = 0 < s2i && s2i < 13;

        String result;

        if (s1IsM && s2IsM) {
            result = "AMBIGUOUS";
        } else if (!s1IsM && s2IsM) {
            result = "YYMM";
        } else if (s1IsM) {
            result = "MMYY";
        } else {
            result = "NA";
        }

        System.out.println(result);
    } main {

        Scanner sc = new Scanner(System.in);
        String str = sc.next();

        String s1 = str.substring(0, 2);
        String s2 = str.substring(2, 4);

        int s1i = Integer.valueOf(s1);
        int s2i = Integer.valueOf(s2);

        boolean s1IsM = 0 < s1i && s1i < 13;
        boolean s2IsM = 0 < s2i && s2i < 13;

        String result;

        if (s1IsM && s2IsM) {
            result = "AMBIGUOUS";
        } else if (!s1IsM && s2IsM) {
            result = "YYMM";
        } else if (s1IsM) {
            result = "MMYY";
        } else {
            result = "NA";
        }

        System.out.println(result);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String str = sc.next(); str sc.next() sc.next sc String s1 = str.substring(0, 2); s1 str.substring(0, 2) str.substring str 0 2 String s2 = str.substring(2, 4); s2 str.substring(2, 4) str.substring str 2 4 int s1i = Integer.valueOf(s1); s1i Integer.valueOf(s1) Integer.valueOf Integer s1 int s2i = Integer.valueOf(s2); s2i Integer.valueOf(s2) Integer.valueOf Integer s2 boolean s1IsM = 0 < s1i && s1i < 13; s1IsM 0 < s1i && s1i < 13 0 < s1i 0 s1i s1i < 13 s1i 13 boolean s2IsM = 0 < s2i && s2i < 13; s2IsM 0 < s2i && s2i < 13 0 < s2i 0 s2i s2i < 13 s2i 13 String result; result if (s1IsM && s2IsM) {
            result = "AMBIGUOUS";
        } else if (!s1IsM && s2IsM) {
            result = "YYMM";
        } else if (s1IsM) {
            result = "MMYY";
        } else {
            result = "NA";
        } s1IsM && s2IsM s1IsM s2IsM {
            result = "AMBIGUOUS";
        } result = "AMBIGUOUS" result "AMBIGUOUS" if (!s1IsM && s2IsM) {
            result = "YYMM";
        } else if (s1IsM) {
            result = "MMYY";
        } else {
            result = "NA";
        } !s1IsM && s2IsM !s1IsM s1IsM s2IsM {
            result = "YYMM";
        } result = "YYMM" result "YYMM" if (s1IsM) {
            result = "MMYY";
        } else {
            result = "NA";
        } s1IsM {
            result = "MMYY";
        } result = "MMYY" result "MMYY" {
            result = "NA";
        } result = "NA" result "NA" System.out.println(result) System.out.println System.out System System.out result String[] args args public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String str = sc.next();

        String s1 = str.substring(0, 2);
        String s2 = str.substring(2, 4);

        int s1i = Integer.valueOf(s1);
        int s2i = Integer.valueOf(s2);

        boolean s1IsM = 0 < s1i && s1i < 13;
        boolean s2IsM = 0 < s2i && s2i < 13;

        String result;

        if (s1IsM && s2IsM) {
            result = "AMBIGUOUS";
        } else if (!s1IsM && s2IsM) {
            result = "YYMM";
        } else if (s1IsM) {
            result = "MMYY";
        } else {
            result = "NA";
        }

        System.out.println(result);
    }

} public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String str = sc.next();

        String s1 = str.substring(0, 2);
        String s2 = str.substring(2, 4);

        int s1i = Integer.valueOf(s1);
        int s2i = Integer.valueOf(s2);

        boolean s1IsM = 0 < s1i && s1i < 13;
        boolean s2IsM = 0 < s2i && s2i < 13;

        String result;

        if (s1IsM && s2IsM) {
            result = "AMBIGUOUS";
        } else if (!s1IsM && s2IsM) {
            result = "YYMM";
        } else if (s1IsM) {
            result = "MMYY";
        } else {
            result = "NA";
        }

        System.out.println(result);
    }

} Main
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String str = sc.next();

        String s1 = str.substring(0, 2);
        String s2 = str.substring(2, 4);

        int s1i = Integer.valueOf(s1);
        int s2i = Integer.valueOf(s2);

        boolean s1IsM = 0 < s1i && s1i < 13;
        boolean s2IsM = 0 < s2i && s2i < 13;

        String result;

        if (s1IsM && s2IsM) {
            result = "AMBIGUOUS";
        } else if (!s1IsM && s2IsM) {
            result = "YYMM";
        } else if (s1IsM) {
            result = "MMYY";
        } else {
            result = "NA";
        }

        System.out.println(result);
    }

}