import java.util.*;
import java.lang.String;

public class Main {

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

        String str = sc.nextLine();
        String strArr[] = str.split("");
        int numArr[] = new int[4];

        for (int i = 0; i < 4; i++){
            numArr[i] = Integer.valueOf(strArr[i]);
        }

        Boolean isYYMM = false;
        Boolean iSMMYY = false;

        isYYMM = isYYMM(numArr);
        iSMMYY = isMMYY(numArr);

        if (isYYMM && iSMMYY) {
            System.out.println("AMBIGUOUS");
        } else if (isYYMM) {
            System.out.println("YYMM");
        } else if (iSMMYY) {
            System.out.println("MMYY");
        } else {
            System.out.println("NA");
        }
    }

    static Boolean isYYMM(int[] numArr) {
        Boolean isYYMM = true;
        String month = Integer.toString(numArr[2]) + Integer.toString(numArr[3]);

        if (Integer.valueOf(month) > 12) {
            isYYMM = false;
        } else if (Integer.valueOf(month) == 0) {
            isYYMM = false;
        }
        return isYYMM;
    }

    static Boolean isMMYY(int[] numArr) {
        Boolean isMMYY = true;
        String month = Integer.toString(numArr[0]) + Integer.toString(numArr[1]);

        if (Integer.valueOf(month) > 12) {
            isMMYY = false;
        } else if (Integer.valueOf(month) == 0) {
            isMMYY = false;
        }

        return isMMYY;
    }
} import java.util.*; util.* java import java.lang.String; String java.lang public class Main {

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

        String str = sc.nextLine();
        String strArr[] = str.split("");
        int numArr[] = new int[4];

        for (int i = 0; i < 4; i++){
            numArr[i] = Integer.valueOf(strArr[i]);
        }

        Boolean isYYMM = false;
        Boolean iSMMYY = false;

        isYYMM = isYYMM(numArr);
        iSMMYY = isMMYY(numArr);

        if (isYYMM && iSMMYY) {
            System.out.println("AMBIGUOUS");
        } else if (isYYMM) {
            System.out.println("YYMM");
        } else if (iSMMYY) {
            System.out.println("MMYY");
        } else {
            System.out.println("NA");
        }
    }

    static Boolean isYYMM(int[] numArr) {
        Boolean isYYMM = true;
        String month = Integer.toString(numArr[2]) + Integer.toString(numArr[3]);

        if (Integer.valueOf(month) > 12) {
            isYYMM = false;
        } else if (Integer.valueOf(month) == 0) {
            isYYMM = false;
        }
        return isYYMM;
    }

    static Boolean isMMYY(int[] numArr) {
        Boolean isMMYY = true;
        String month = Integer.toString(numArr[0]) + Integer.toString(numArr[1]);

        if (Integer.valueOf(month) > 12) {
            isMMYY = false;
        } else if (Integer.valueOf(month) == 0) {
            isMMYY = false;
        }

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

        String str = sc.nextLine();
        String strArr[] = str.split("");
        int numArr[] = new int[4];

        for (int i = 0; i < 4; i++){
            numArr[i] = Integer.valueOf(strArr[i]);
        }

        Boolean isYYMM = false;
        Boolean iSMMYY = false;

        isYYMM = isYYMM(numArr);
        iSMMYY = isMMYY(numArr);

        if (isYYMM && iSMMYY) {
            System.out.println("AMBIGUOUS");
        } else if (isYYMM) {
            System.out.println("YYMM");
        } else if (iSMMYY) {
            System.out.println("MMYY");
        } else {
            System.out.println("NA");
        }
    } main {
        Scanner sc = new Scanner(System.in);

        String str = sc.nextLine();
        String strArr[] = str.split("");
        int numArr[] = new int[4];

        for (int i = 0; i < 4; i++){
            numArr[i] = Integer.valueOf(strArr[i]);
        }

        Boolean isYYMM = false;
        Boolean iSMMYY = false;

        isYYMM = isYYMM(numArr);
        iSMMYY = isMMYY(numArr);

        if (isYYMM && iSMMYY) {
            System.out.println("AMBIGUOUS");
        } else if (isYYMM) {
            System.out.println("YYMM");
        } else if (iSMMYY) {
            System.out.println("MMYY");
        } else {
            System.out.println("NA");
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String str = sc.nextLine(); str sc.nextLine() sc.nextLine sc String strArr[] = str.split(""); strArr str.split("") str.split str "" int numArr[] = new int[4]; numArr new int[4] 4 for (int i = 0; i < 4; i++){
            numArr[i] = Integer.valueOf(strArr[i]);
        } int i = 0; int i = 0; i 0 i < 4 i 4 i++ i++ i {
            numArr[i] = Integer.valueOf(strArr[i]);
        } {
            numArr[i] = Integer.valueOf(strArr[i]);
        } numArr[i] = Integer.valueOf(strArr[i]) numArr[i] numArr i Integer.valueOf(strArr[i]) Integer.valueOf Integer strArr[i] strArr i Boolean isYYMM = false; isYYMM false Boolean iSMMYY = false; iSMMYY false isYYMM = isYYMM(numArr) isYYMM isYYMM(numArr) isYYMM numArr iSMMYY = isMMYY(numArr) iSMMYY isMMYY(numArr) isMMYY numArr if (isYYMM && iSMMYY) {
            System.out.println("AMBIGUOUS");
        } else if (isYYMM) {
            System.out.println("YYMM");
        } else if (iSMMYY) {
            System.out.println("MMYY");
        } else {
            System.out.println("NA");
        } isYYMM && iSMMYY isYYMM iSMMYY {
            System.out.println("AMBIGUOUS");
        } System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" if (isYYMM) {
            System.out.println("YYMM");
        } else if (iSMMYY) {
            System.out.println("MMYY");
        } else {
            System.out.println("NA");
        } isYYMM {
            System.out.println("YYMM");
        } System.out.println("YYMM") System.out.println System.out System System.out "YYMM" if (iSMMYY) {
            System.out.println("MMYY");
        } else {
            System.out.println("NA");
        } iSMMYY {
            System.out.println("MMYY");
        } System.out.println("MMYY") System.out.println System.out System System.out "MMYY" {
            System.out.println("NA");
        } System.out.println("NA") System.out.println System.out System System.out "NA" String[] args args static Boolean isYYMM(int[] numArr) {
        Boolean isYYMM = true;
        String month = Integer.toString(numArr[2]) + Integer.toString(numArr[3]);

        if (Integer.valueOf(month) > 12) {
            isYYMM = false;
        } else if (Integer.valueOf(month) == 0) {
            isYYMM = false;
        }
        return isYYMM;
    } isYYMM {
        Boolean isYYMM = true;
        String month = Integer.toString(numArr[2]) + Integer.toString(numArr[3]);

        if (Integer.valueOf(month) > 12) {
            isYYMM = false;
        } else if (Integer.valueOf(month) == 0) {
            isYYMM = false;
        }
        return isYYMM;
    } Boolean isYYMM = true; isYYMM true String month = Integer.toString(numArr[2]) + Integer.toString(numArr[3]); month Integer.toString(numArr[2]) + Integer.toString(numArr[3]) Integer.toString(numArr[2]) Integer.toString Integer numArr[2] numArr 2 Integer.toString(numArr[3]) Integer.toString Integer numArr[3] numArr 3 if (Integer.valueOf(month) > 12) {
            isYYMM = false;
        } else if (Integer.valueOf(month) == 0) {
            isYYMM = false;
        } Integer.valueOf(month) > 12 Integer.valueOf(month) Integer.valueOf Integer month 12 {
            isYYMM = false;
        } isYYMM = false isYYMM false if (Integer.valueOf(month) == 0) {
            isYYMM = false;
        } Integer.valueOf(month) == 0 Integer.valueOf(month) Integer.valueOf Integer month 0 {
            isYYMM = false;
        } isYYMM = false isYYMM false return isYYMM; isYYMM int[] numArr numArr static Boolean isMMYY(int[] numArr) {
        Boolean isMMYY = true;
        String month = Integer.toString(numArr[0]) + Integer.toString(numArr[1]);

        if (Integer.valueOf(month) > 12) {
            isMMYY = false;
        } else if (Integer.valueOf(month) == 0) {
            isMMYY = false;
        }

        return isMMYY;
    } isMMYY {
        Boolean isMMYY = true;
        String month = Integer.toString(numArr[0]) + Integer.toString(numArr[1]);

        if (Integer.valueOf(month) > 12) {
            isMMYY = false;
        } else if (Integer.valueOf(month) == 0) {
            isMMYY = false;
        }

        return isMMYY;
    } Boolean isMMYY = true; isMMYY true String month = Integer.toString(numArr[0]) + Integer.toString(numArr[1]); month Integer.toString(numArr[0]) + Integer.toString(numArr[1]) Integer.toString(numArr[0]) Integer.toString Integer numArr[0] numArr 0 Integer.toString(numArr[1]) Integer.toString Integer numArr[1] numArr 1 if (Integer.valueOf(month) > 12) {
            isMMYY = false;
        } else if (Integer.valueOf(month) == 0) {
            isMMYY = false;
        } Integer.valueOf(month) > 12 Integer.valueOf(month) Integer.valueOf Integer month 12 {
            isMMYY = false;
        } isMMYY = false isMMYY false if (Integer.valueOf(month) == 0) {
            isMMYY = false;
        } Integer.valueOf(month) == 0 Integer.valueOf(month) Integer.valueOf Integer month 0 {
            isMMYY = false;
        } isMMYY = false isMMYY false return isMMYY; isMMYY int[] numArr numArr public class Main {

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

        String str = sc.nextLine();
        String strArr[] = str.split("");
        int numArr[] = new int[4];

        for (int i = 0; i < 4; i++){
            numArr[i] = Integer.valueOf(strArr[i]);
        }

        Boolean isYYMM = false;
        Boolean iSMMYY = false;

        isYYMM = isYYMM(numArr);
        iSMMYY = isMMYY(numArr);

        if (isYYMM && iSMMYY) {
            System.out.println("AMBIGUOUS");
        } else if (isYYMM) {
            System.out.println("YYMM");
        } else if (iSMMYY) {
            System.out.println("MMYY");
        } else {
            System.out.println("NA");
        }
    }

    static Boolean isYYMM(int[] numArr) {
        Boolean isYYMM = true;
        String month = Integer.toString(numArr[2]) + Integer.toString(numArr[3]);

        if (Integer.valueOf(month) > 12) {
            isYYMM = false;
        } else if (Integer.valueOf(month) == 0) {
            isYYMM = false;
        }
        return isYYMM;
    }

    static Boolean isMMYY(int[] numArr) {
        Boolean isMMYY = true;
        String month = Integer.toString(numArr[0]) + Integer.toString(numArr[1]);

        if (Integer.valueOf(month) > 12) {
            isMMYY = false;
        } else if (Integer.valueOf(month) == 0) {
            isMMYY = false;
        }

        return isMMYY;
    }
} public class Main {

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

        String str = sc.nextLine();
        String strArr[] = str.split("");
        int numArr[] = new int[4];

        for (int i = 0; i < 4; i++){
            numArr[i] = Integer.valueOf(strArr[i]);
        }

        Boolean isYYMM = false;
        Boolean iSMMYY = false;

        isYYMM = isYYMM(numArr);
        iSMMYY = isMMYY(numArr);

        if (isYYMM && iSMMYY) {
            System.out.println("AMBIGUOUS");
        } else if (isYYMM) {
            System.out.println("YYMM");
        } else if (iSMMYY) {
            System.out.println("MMYY");
        } else {
            System.out.println("NA");
        }
    }

    static Boolean isYYMM(int[] numArr) {
        Boolean isYYMM = true;
        String month = Integer.toString(numArr[2]) + Integer.toString(numArr[3]);

        if (Integer.valueOf(month) > 12) {
            isYYMM = false;
        } else if (Integer.valueOf(month) == 0) {
            isYYMM = false;
        }
        return isYYMM;
    }

    static Boolean isMMYY(int[] numArr) {
        Boolean isMMYY = true;
        String month = Integer.toString(numArr[0]) + Integer.toString(numArr[1]);

        if (Integer.valueOf(month) > 12) {
            isMMYY = false;
        } else if (Integer.valueOf(month) == 0) {
            isMMYY = false;
        }

        return isMMYY;
    }
} Main
import java.util.*;
import java.lang.String;

public class Main {

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

        String str = sc.nextLine();
        String strArr[] = str.split("");
        int numArr[] = new int[4];

        for (int i = 0; i < 4; i++){
            numArr[i] = Integer.valueOf(strArr[i]);
        }

        Boolean isYYMM = false;
        Boolean iSMMYY = false;

        isYYMM = isYYMM(numArr);
        iSMMYY = isMMYY(numArr);

        if (isYYMM && iSMMYY) {
            System.out.println("AMBIGUOUS");
        } else if (isYYMM) {
            System.out.println("YYMM");
        } else if (iSMMYY) {
            System.out.println("MMYY");
        } else {
            System.out.println("NA");
        }
    }

    static Boolean isYYMM(int[] numArr) {
        Boolean isYYMM = true;
        String month = Integer.toString(numArr[2]) + Integer.toString(numArr[3]);

        if (Integer.valueOf(month) > 12) {
            isYYMM = false;
        } else if (Integer.valueOf(month) == 0) {
            isYYMM = false;
        }
        return isYYMM;
    }

    static Boolean isMMYY(int[] numArr) {
        Boolean isMMYY = true;
        String month = Integer.toString(numArr[0]) + Integer.toString(numArr[1]);

        if (Integer.valueOf(month) > 12) {
            isMMYY = false;
        } else if (Integer.valueOf(month) == 0) {
            isMMYY = false;
        }

        return isMMYY;
    }
}