import java.util.*;

class Main{
    public static void main(String argv[]) {
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();
        int first = Integer.parseInt(str.substring(0,2));
        int second = Integer.parseInt(str.substring(2, 4));

        if(first==0 || first >12){
            if(second==0 || second > 12){
                System.out.println("NA");
            }
            else{
                System.out.println("YYMM");
            }
        }
        else{
            if(second==0 || second > 12){
                System.out.println("MMYY");
            }
            else{
                System.out.println("AMBIGUOUS");
            }
        }
    }
} import java.util.*; util.* java class Main{
    public static void main(String argv[]) {
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();
        int first = Integer.parseInt(str.substring(0,2));
        int second = Integer.parseInt(str.substring(2, 4));

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

        if(first==0 || first >12){
            if(second==0 || second > 12){
                System.out.println("NA");
            }
            else{
                System.out.println("YYMM");
            }
        }
        else{
            if(second==0 || second > 12){
                System.out.println("MMYY");
            }
            else{
                System.out.println("AMBIGUOUS");
            }
        }
    } main {
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();
        int first = Integer.parseInt(str.substring(0,2));
        int second = Integer.parseInt(str.substring(2, 4));

        if(first==0 || first >12){
            if(second==0 || second > 12){
                System.out.println("NA");
            }
            else{
                System.out.println("YYMM");
            }
        }
        else{
            if(second==0 || second > 12){
                System.out.println("MMYY");
            }
            else{
                System.out.println("AMBIGUOUS");
            }
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String str = sc.nextLine(); str sc.nextLine() sc.nextLine sc int first = Integer.parseInt(str.substring(0,2)); first Integer.parseInt(str.substring(0,2)) Integer.parseInt Integer str.substring(0,2) str.substring str 0 2 int second = Integer.parseInt(str.substring(2, 4)); second Integer.parseInt(str.substring(2, 4)) Integer.parseInt Integer str.substring(2, 4) str.substring str 2 4 if(first==0 || first >12){
            if(second==0 || second > 12){
                System.out.println("NA");
            }
            else{
                System.out.println("YYMM");
            }
        }
        else{
            if(second==0 || second > 12){
                System.out.println("MMYY");
            }
            else{
                System.out.println("AMBIGUOUS");
            }
        } first==0 || first >12 first==0 first 0 first >12 first 12 {
            if(second==0 || second > 12){
                System.out.println("NA");
            }
            else{
                System.out.println("YYMM");
            }
        } if(second==0 || second > 12){
                System.out.println("NA");
            }
            else{
                System.out.println("YYMM");
            } second==0 || second > 12 second==0 second 0 second > 12 second 12 {
                System.out.println("NA");
            } System.out.println("NA") System.out.println System.out System System.out "NA" {
                System.out.println("YYMM");
            } System.out.println("YYMM") System.out.println System.out System System.out "YYMM" {
            if(second==0 || second > 12){
                System.out.println("MMYY");
            }
            else{
                System.out.println("AMBIGUOUS");
            }
        } if(second==0 || second > 12){
                System.out.println("MMYY");
            }
            else{
                System.out.println("AMBIGUOUS");
            } second==0 || second > 12 second==0 second 0 second > 12 second 12 {
                System.out.println("MMYY");
            } System.out.println("MMYY") System.out.println System.out System System.out "MMYY" {
                System.out.println("AMBIGUOUS");
            } System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" String argv[] argv
import java.util.*;

class Main{
    public static void main(String argv[]) {
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();
        int first = Integer.parseInt(str.substring(0,2));
        int second = Integer.parseInt(str.substring(2, 4));

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