import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int i1 = Integer.parseInt(s.substring(0, 2));
        boolean isMM1 = (1 <= i1 && i1 <= 12);
        int i2 = Integer.parseInt(s.substring(2, 4));
        boolean isMM2 = (1 <= i2 && i2 <= 12);

        if (isMM1 && isMM2) {
            System.out.println("AMBIGUOUS");
        } else if (!isMM1 && !isMM2) {
            System.out.println("NA");
        } else if (isMM1) {
            System.out.println("MMYY");
        } else {
            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();
        int i1 = Integer.parseInt(s.substring(0, 2));
        boolean isMM1 = (1 <= i1 && i1 <= 12);
        int i2 = Integer.parseInt(s.substring(2, 4));
        boolean isMM2 = (1 <= i2 && i2 <= 12);

        if (isMM1 && isMM2) {
            System.out.println("AMBIGUOUS");
        } else if (!isMM1 && !isMM2) {
            System.out.println("NA");
        } else if (isMM1) {
            System.out.println("MMYY");
        } else {
            System.out.println("YYMM");
        }
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int i1 = Integer.parseInt(s.substring(0, 2));
        boolean isMM1 = (1 <= i1 && i1 <= 12);
        int i2 = Integer.parseInt(s.substring(2, 4));
        boolean isMM2 = (1 <= i2 && i2 <= 12);

        if (isMM1 && isMM2) {
            System.out.println("AMBIGUOUS");
        } else if (!isMM1 && !isMM2) {
            System.out.println("NA");
        } else if (isMM1) {
            System.out.println("MMYY");
        } else {
            System.out.println("YYMM");
        }
    } main {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int i1 = Integer.parseInt(s.substring(0, 2));
        boolean isMM1 = (1 <= i1 && i1 <= 12);
        int i2 = Integer.parseInt(s.substring(2, 4));
        boolean isMM2 = (1 <= i2 && i2 <= 12);

        if (isMM1 && isMM2) {
            System.out.println("AMBIGUOUS");
        } else if (!isMM1 && !isMM2) {
            System.out.println("NA");
        } else if (isMM1) {
            System.out.println("MMYY");
        } else {
            System.out.println("YYMM");
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc int i1 = Integer.parseInt(s.substring(0, 2)); i1 Integer.parseInt(s.substring(0, 2)) Integer.parseInt Integer s.substring(0, 2) s.substring s 0 2 boolean isMM1 = (1 <= i1 && i1 <= 12); isMM1 (1 <= i1 && i1 <= 12) 1 <= i1 1 i1 i1 <= 12 i1 12 int i2 = Integer.parseInt(s.substring(2, 4)); i2 Integer.parseInt(s.substring(2, 4)) Integer.parseInt Integer s.substring(2, 4) s.substring s 2 4 boolean isMM2 = (1 <= i2 && i2 <= 12); isMM2 (1 <= i2 && i2 <= 12) 1 <= i2 1 i2 i2 <= 12 i2 12 if (isMM1 && isMM2) {
            System.out.println("AMBIGUOUS");
        } else if (!isMM1 && !isMM2) {
            System.out.println("NA");
        } else if (isMM1) {
            System.out.println("MMYY");
        } else {
            System.out.println("YYMM");
        } isMM1 && isMM2 isMM1 isMM2 {
            System.out.println("AMBIGUOUS");
        } System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" if (!isMM1 && !isMM2) {
            System.out.println("NA");
        } else if (isMM1) {
            System.out.println("MMYY");
        } else {
            System.out.println("YYMM");
        } !isMM1 && !isMM2 !isMM1 isMM1 !isMM2 isMM2 {
            System.out.println("NA");
        } System.out.println("NA") System.out.println System.out System System.out "NA" if (isMM1) {
            System.out.println("MMYY");
        } else {
            System.out.println("YYMM");
        } isMM1 {
            System.out.println("MMYY");
        } System.out.println("MMYY") System.out.println System.out System System.out "MMYY" {
            System.out.println("YYMM");
        } 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();
        int i1 = Integer.parseInt(s.substring(0, 2));
        boolean isMM1 = (1 <= i1 && i1 <= 12);
        int i2 = Integer.parseInt(s.substring(2, 4));
        boolean isMM2 = (1 <= i2 && i2 <= 12);

        if (isMM1 && isMM2) {
            System.out.println("AMBIGUOUS");
        } else if (!isMM1 && !isMM2) {
            System.out.println("NA");
        } else if (isMM1) {
            System.out.println("MMYY");
        } else {
            System.out.println("YYMM");
        }
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int i1 = Integer.parseInt(s.substring(0, 2));
        boolean isMM1 = (1 <= i1 && i1 <= 12);
        int i2 = Integer.parseInt(s.substring(2, 4));
        boolean isMM2 = (1 <= i2 && i2 <= 12);

        if (isMM1 && isMM2) {
            System.out.println("AMBIGUOUS");
        } else if (!isMM1 && !isMM2) {
            System.out.println("NA");
        } else if (isMM1) {
            System.out.println("MMYY");
        } else {
            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();
        int i1 = Integer.parseInt(s.substring(0, 2));
        boolean isMM1 = (1 <= i1 && i1 <= 12);
        int i2 = Integer.parseInt(s.substring(2, 4));
        boolean isMM2 = (1 <= i2 && i2 <= 12);

        if (isMM1 && isMM2) {
            System.out.println("AMBIGUOUS");
        } else if (!isMM1 && !isMM2) {
            System.out.println("NA");
        } else if (isMM1) {
            System.out.println("MMYY");
        } else {
            System.out.println("YYMM");
        }
    }
}
