import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
        int upp = N/100;
        int downn = N%100;
        boolean my = ((1<=upp)&&(upp<=12));
        boolean ym = ((1<=downn)&&(downn<=12));
        
        if (my&&ym)
          System.out.println("AMBIGUOUS");
        else if(my)
          System.out.println("MMYY");
        else if(ym)
          System.out.println("YYMM");
        else
          System.out.println("NA");
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
        int upp = N/100;
        int downn = N%100;
        boolean my = ((1<=upp)&&(upp<=12));
        boolean ym = ((1<=downn)&&(downn<=12));
        
        if (my&&ym)
          System.out.println("AMBIGUOUS");
        else if(my)
          System.out.println("MMYY");
        else if(ym)
          System.out.println("YYMM");
        else
          System.out.println("NA");
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
        int upp = N/100;
        int downn = N%100;
        boolean my = ((1<=upp)&&(upp<=12));
        boolean ym = ((1<=downn)&&(downn<=12));
        
        if (my&&ym)
          System.out.println("AMBIGUOUS");
        else if(my)
          System.out.println("MMYY");
        else if(ym)
          System.out.println("YYMM");
        else
          System.out.println("NA");
	} main {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
        int upp = N/100;
        int downn = N%100;
        boolean my = ((1<=upp)&&(upp<=12));
        boolean ym = ((1<=downn)&&(downn<=12));
        
        if (my&&ym)
          System.out.println("AMBIGUOUS");
        else if(my)
          System.out.println("MMYY");
        else if(ym)
          System.out.println("YYMM");
        else
          System.out.println("NA");
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int upp = N/100; upp N/100 N 100 int downn = N%100; downn N%100 N 100 boolean my = ((1<=upp)&&(upp<=12)); my ((1<=upp)&&(upp<=12)) (1<=upp) 1 upp (upp<=12) upp 12 boolean ym = ((1<=downn)&&(downn<=12)); ym ((1<=downn)&&(downn<=12)) (1<=downn) 1 downn (downn<=12) downn 12 if (my&&ym)
          System.out.println("AMBIGUOUS");
        else if(my)
          System.out.println("MMYY");
        else if(ym)
          System.out.println("YYMM");
        else
          System.out.println("NA"); my&&ym my ym System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" if(my)
          System.out.println("MMYY");
        else if(ym)
          System.out.println("YYMM");
        else
          System.out.println("NA"); my System.out.println("MMYY") System.out.println System.out System System.out "MMYY" if(ym)
          System.out.println("YYMM");
        else
          System.out.println("NA"); ym System.out.println("YYMM") System.out.println System.out System System.out "YYMM" System.out.println("NA") System.out.println System.out System System.out "NA" String[] args args public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
        int upp = N/100;
        int downn = N%100;
        boolean my = ((1<=upp)&&(upp<=12));
        boolean ym = ((1<=downn)&&(downn<=12));
        
        if (my&&ym)
          System.out.println("AMBIGUOUS");
        else if(my)
          System.out.println("MMYY");
        else if(ym)
          System.out.println("YYMM");
        else
          System.out.println("NA");
	}
} public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
        int upp = N/100;
        int downn = N%100;
        boolean my = ((1<=upp)&&(upp<=12));
        boolean ym = ((1<=downn)&&(downn<=12));
        
        if (my&&ym)
          System.out.println("AMBIGUOUS");
        else if(my)
          System.out.println("MMYY");
        else if(ym)
          System.out.println("YYMM");
        else
          System.out.println("NA");
	}
} Main
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
        int upp = N/100;
        int downn = N%100;
        boolean my = ((1<=upp)&&(upp<=12));
        boolean ym = ((1<=downn)&&(downn<=12));
        
        if (my&&ym)
          System.out.println("AMBIGUOUS");
        else if(my)
          System.out.println("MMYY");
        else if(ym)
          System.out.println("YYMM");
        else
          System.out.println("NA");
	}
}