import java.util.Scanner;

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

        String s = sc.next();

        int first = Integer.parseInt(s.substring(0,2));
        int second = Integer.parseInt(s.substring(2,4));

        if ((first > 12 && second > 12) || (first == 0 && second > 12)
                || (first > 12 && second == 0) || (first == 0 && second == 0)) {
            System.out.println("NA");
        }else if(first <= 12 && (second > 12 || second == 0)){
            System.out.println("MMYY");
        }else if((first > 12 || first == 0) && second <= 12) {
            System.out.println("YYMM");
        }else if(first <= 12 && second <= 12){
            System.out.println("AMBIGUOUS");
        }

        sc.close();
    }
} 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 first = Integer.parseInt(s.substring(0,2));
        int second = Integer.parseInt(s.substring(2,4));

        if ((first > 12 && second > 12) || (first == 0 && second > 12)
                || (first > 12 && second == 0) || (first == 0 && second == 0)) {
            System.out.println("NA");
        }else if(first <= 12 && (second > 12 || second == 0)){
            System.out.println("MMYY");
        }else if((first > 12 || first == 0) && second <= 12) {
            System.out.println("YYMM");
        }else if(first <= 12 && second <= 12){
            System.out.println("AMBIGUOUS");
        }

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

        String s = sc.next();

        int first = Integer.parseInt(s.substring(0,2));
        int second = Integer.parseInt(s.substring(2,4));

        if ((first > 12 && second > 12) || (first == 0 && second > 12)
                || (first > 12 && second == 0) || (first == 0 && second == 0)) {
            System.out.println("NA");
        }else if(first <= 12 && (second > 12 || second == 0)){
            System.out.println("MMYY");
        }else if((first > 12 || first == 0) && second <= 12) {
            System.out.println("YYMM");
        }else if(first <= 12 && second <= 12){
            System.out.println("AMBIGUOUS");
        }

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

        String s = sc.next();

        int first = Integer.parseInt(s.substring(0,2));
        int second = Integer.parseInt(s.substring(2,4));

        if ((first > 12 && second > 12) || (first == 0 && second > 12)
                || (first > 12 && second == 0) || (first == 0 && second == 0)) {
            System.out.println("NA");
        }else if(first <= 12 && (second > 12 || second == 0)){
            System.out.println("MMYY");
        }else if((first > 12 || first == 0) && second <= 12) {
            System.out.println("YYMM");
        }else if(first <= 12 && second <= 12){
            System.out.println("AMBIGUOUS");
        }

        sc.close();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc int first = Integer.parseInt(s.substring(0,2)); first Integer.parseInt(s.substring(0,2)) Integer.parseInt Integer s.substring(0,2) s.substring s 0 2 int second = Integer.parseInt(s.substring(2,4)); second Integer.parseInt(s.substring(2,4)) Integer.parseInt Integer s.substring(2,4) s.substring s 2 4 if ((first > 12 && second > 12) || (first == 0 && second > 12)
                || (first > 12 && second == 0) || (first == 0 && second == 0)) {
            System.out.println("NA");
        }else if(first <= 12 && (second > 12 || second == 0)){
            System.out.println("MMYY");
        }else if((first > 12 || first == 0) && second <= 12) {
            System.out.println("YYMM");
        }else if(first <= 12 && second <= 12){
            System.out.println("AMBIGUOUS");
        } (first > 12 && second > 12) || (first == 0 && second > 12)
                || (first > 12 && second == 0) || (first == 0 && second == 0) (first > 12 && second == 0) (first > 12 && second > 12) || (first == 0 && second > 12)
                || (first > 12 && second == 0) || (first == 0 && second == 0) (first > 12 && second > 12) first > 12 first 12 second > 12 second 12 (first == 0 && second > 12) first == 0 first 0 second > 12 second 12 (first > 12 && second == 0) first > 12 first 12 second == 0 second 0 (first == 0 && second == 0) first == 0 first 0 second == 0 second 0 {
            System.out.println("NA");
        } System.out.println("NA") System.out.println System.out System System.out "NA" if(first <= 12 && (second > 12 || second == 0)){
            System.out.println("MMYY");
        }else if((first > 12 || first == 0) && second <= 12) {
            System.out.println("YYMM");
        }else if(first <= 12 && second <= 12){
            System.out.println("AMBIGUOUS");
        } first <= 12 && (second > 12 || second == 0) first <= 12 first 12 (second > 12 || second == 0) second > 12 second 12 second == 0 second 0 {
            System.out.println("MMYY");
        } System.out.println("MMYY") System.out.println System.out System System.out "MMYY" if((first > 12 || first == 0) && second <= 12) {
            System.out.println("YYMM");
        }else if(first <= 12 && second <= 12){
            System.out.println("AMBIGUOUS");
        } (first > 12 || first == 0) && second <= 12 (first > 12 || first == 0) first > 12 first 12 first == 0 first 0 second <= 12 second 12 {
            System.out.println("YYMM");
        } System.out.println("YYMM") System.out.println System.out System System.out "YYMM" if(first <= 12 && second <= 12){
            System.out.println("AMBIGUOUS");
        } first <= 12 && second <= 12 first <= 12 first 12 second <= 12 second 12 {
            System.out.println("AMBIGUOUS");
        } System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" sc.close() sc.close sc String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String s = sc.next();

        int first = Integer.parseInt(s.substring(0,2));
        int second = Integer.parseInt(s.substring(2,4));

        if ((first > 12 && second > 12) || (first == 0 && second > 12)
                || (first > 12 && second == 0) || (first == 0 && second == 0)) {
            System.out.println("NA");
        }else if(first <= 12 && (second > 12 || second == 0)){
            System.out.println("MMYY");
        }else if((first > 12 || first == 0) && second <= 12) {
            System.out.println("YYMM");
        }else if(first <= 12 && second <= 12){
            System.out.println("AMBIGUOUS");
        }

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

        String s = sc.next();

        int first = Integer.parseInt(s.substring(0,2));
        int second = Integer.parseInt(s.substring(2,4));

        if ((first > 12 && second > 12) || (first == 0 && second > 12)
                || (first > 12 && second == 0) || (first == 0 && second == 0)) {
            System.out.println("NA");
        }else if(first <= 12 && (second > 12 || second == 0)){
            System.out.println("MMYY");
        }else if((first > 12 || first == 0) && second <= 12) {
            System.out.println("YYMM");
        }else if(first <= 12 && second <= 12){
            System.out.println("AMBIGUOUS");
        }

        sc.close();
    }
} 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 first = Integer.parseInt(s.substring(0,2));
        int second = Integer.parseInt(s.substring(2,4));

        if ((first > 12 && second > 12) || (first == 0 && second > 12)
                || (first > 12 && second == 0) || (first == 0 && second == 0)) {
            System.out.println("NA");
        }else if(first <= 12 && (second > 12 || second == 0)){
            System.out.println("MMYY");
        }else if((first > 12 || first == 0) && second <= 12) {
            System.out.println("YYMM");
        }else if(first <= 12 && second <= 12){
            System.out.println("AMBIGUOUS");
        }

        sc.close();
    }
}
