import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] s = sc.next().split("");
        int former = Integer.parseInt(s[0] + s[1]);
        int latter = Integer.parseInt(s[2] + s[3]);
        if ((former < 1 || former > 12)
                && (latter < 1 || latter > 12)) {
            System.out.println("NA");
            return;
        }
        if ((former >= 1 && former <= 12)
                && (latter >= 1 && latter <= 12)) {
            System.out.println("AMBIGUOUS");
            return;
        }
        if (former >= 1 && former <= 12) {
            System.out.println("MMYY");
            return;
        }
        System.out.println("YYMM");
    }

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

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] s = sc.next().split("");
        int former = Integer.parseInt(s[0] + s[1]);
        int latter = Integer.parseInt(s[2] + s[3]);
        if ((former < 1 || former > 12)
                && (latter < 1 || latter > 12)) {
            System.out.println("NA");
            return;
        }
        if ((former >= 1 && former <= 12)
                && (latter >= 1 && latter <= 12)) {
            System.out.println("AMBIGUOUS");
            return;
        }
        if (former >= 1 && former <= 12) {
            System.out.println("MMYY");
            return;
        }
        System.out.println("YYMM");
    }

} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] s = sc.next().split("");
        int former = Integer.parseInt(s[0] + s[1]);
        int latter = Integer.parseInt(s[2] + s[3]);
        if ((former < 1 || former > 12)
                && (latter < 1 || latter > 12)) {
            System.out.println("NA");
            return;
        }
        if ((former >= 1 && former <= 12)
                && (latter >= 1 && latter <= 12)) {
            System.out.println("AMBIGUOUS");
            return;
        }
        if (former >= 1 && former <= 12) {
            System.out.println("MMYY");
            return;
        }
        System.out.println("YYMM");
    } main {
        Scanner sc = new Scanner(System.in);
        String[] s = sc.next().split("");
        int former = Integer.parseInt(s[0] + s[1]);
        int latter = Integer.parseInt(s[2] + s[3]);
        if ((former < 1 || former > 12)
                && (latter < 1 || latter > 12)) {
            System.out.println("NA");
            return;
        }
        if ((former >= 1 && former <= 12)
                && (latter >= 1 && latter <= 12)) {
            System.out.println("AMBIGUOUS");
            return;
        }
        if (former >= 1 && former <= 12) {
            System.out.println("MMYY");
            return;
        }
        System.out.println("YYMM");
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String[] s = sc.next().split(""); s sc.next().split("") sc.next().split sc.next() sc.next sc "" int former = Integer.parseInt(s[0] + s[1]); former Integer.parseInt(s[0] + s[1]) Integer.parseInt Integer s[0] + s[1] s[0] s 0 s[1] s 1 int latter = Integer.parseInt(s[2] + s[3]); latter Integer.parseInt(s[2] + s[3]) Integer.parseInt Integer s[2] + s[3] s[2] s 2 s[3] s 3 if ((former < 1 || former > 12)
                && (latter < 1 || latter > 12)) {
            System.out.println("NA");
            return;
        } (former < 1 || former > 12)
                && (latter < 1 || latter > 12) (former < 1 || former > 12) former < 1 former 1 former > 12 former 12 (latter < 1 || latter > 12) latter < 1 latter 1 latter > 12 latter 12 {
            System.out.println("NA");
            return;
        } System.out.println("NA") System.out.println System.out System System.out "NA" return; if ((former >= 1 && former <= 12)
                && (latter >= 1 && latter <= 12)) {
            System.out.println("AMBIGUOUS");
            return;
        } (former >= 1 && former <= 12)
                && (latter >= 1 && latter <= 12) (former >= 1 && former <= 12) former >= 1 former 1 former <= 12 former 12 (latter >= 1 && latter <= 12) latter >= 1 latter 1 latter <= 12 latter 12 {
            System.out.println("AMBIGUOUS");
            return;
        } System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" return; if (former >= 1 && former <= 12) {
            System.out.println("MMYY");
            return;
        } former >= 1 && former <= 12 former >= 1 former 1 former <= 12 former 12 {
            System.out.println("MMYY");
            return;
        } System.out.println("MMYY") System.out.println System.out System System.out "MMYY" return; System.out.println("YYMM") System.out.println System.out System System.out "YYMM" String[] args args public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] s = sc.next().split("");
        int former = Integer.parseInt(s[0] + s[1]);
        int latter = Integer.parseInt(s[2] + s[3]);
        if ((former < 1 || former > 12)
                && (latter < 1 || latter > 12)) {
            System.out.println("NA");
            return;
        }
        if ((former >= 1 && former <= 12)
                && (latter >= 1 && latter <= 12)) {
            System.out.println("AMBIGUOUS");
            return;
        }
        if (former >= 1 && former <= 12) {
            System.out.println("MMYY");
            return;
        }
        System.out.println("YYMM");
    }

} public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] s = sc.next().split("");
        int former = Integer.parseInt(s[0] + s[1]);
        int latter = Integer.parseInt(s[2] + s[3]);
        if ((former < 1 || former > 12)
                && (latter < 1 || latter > 12)) {
            System.out.println("NA");
            return;
        }
        if ((former >= 1 && former <= 12)
                && (latter >= 1 && latter <= 12)) {
            System.out.println("AMBIGUOUS");
            return;
        }
        if (former >= 1 && former <= 12) {
            System.out.println("MMYY");
            return;
        }
        System.out.println("YYMM");
    }

} Main
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] s = sc.next().split("");
        int former = Integer.parseInt(s[0] + s[1]);
        int latter = Integer.parseInt(s[2] + s[3]);
        if ((former < 1 || former > 12)
                && (latter < 1 || latter > 12)) {
            System.out.println("NA");
            return;
        }
        if ((former >= 1 && former <= 12)
                && (latter >= 1 && latter <= 12)) {
            System.out.println("AMBIGUOUS");
            return;
        }
        if (former >= 1 && former <= 12) {
            System.out.println("MMYY");
            return;
        }
        System.out.println("YYMM");
    }

}
