import java.util.*;
public class Main {
    private static void prin(String ans){
    System.out.println(ans);
    }

	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)
          prin("AMBIGUOUS");
        else if(my)
          prin("MMYY");
        else if(ym)
          prin("YYMM");
        else
          prin("NA");
	}
}
 import java.util.*; util.* java public class Main {
    private static void prin(String ans){
    System.out.println(ans);
    }

	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)
          prin("AMBIGUOUS");
        else if(my)
          prin("MMYY");
        else if(ym)
          prin("YYMM");
        else
          prin("NA");
	}
} Main private static void prin(String ans){
    System.out.println(ans);
    } prin {
    System.out.println(ans);
    } System.out.println(ans) System.out.println System.out System System.out ans String ans ans 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)
          prin("AMBIGUOUS");
        else if(my)
          prin("MMYY");
        else if(ym)
          prin("YYMM");
        else
          prin("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)
          prin("AMBIGUOUS");
        else if(my)
          prin("MMYY");
        else if(ym)
          prin("YYMM");
        else
          prin("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)
          prin("AMBIGUOUS");
        else if(my)
          prin("MMYY");
        else if(ym)
          prin("YYMM");
        else
          prin("NA"); my&&ym my ym prin("AMBIGUOUS") prin "AMBIGUOUS" if(my)
          prin("MMYY");
        else if(ym)
          prin("YYMM");
        else
          prin("NA"); my prin("MMYY") prin "MMYY" if(ym)
          prin("YYMM");
        else
          prin("NA"); ym prin("YYMM") prin "YYMM" prin("NA") prin "NA" String[] args args public class Main {
    private static void prin(String ans){
    System.out.println(ans);
    }

	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)
          prin("AMBIGUOUS");
        else if(my)
          prin("MMYY");
        else if(ym)
          prin("YYMM");
        else
          prin("NA");
	}
} public class Main {
    private static void prin(String ans){
    System.out.println(ans);
    }

	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)
          prin("AMBIGUOUS");
        else if(my)
          prin("MMYY");
        else if(ym)
          prin("YYMM");
        else
          prin("NA");
	}
} Main
import java.util.*;
public class Main {
    private static void prin(String ans){
    System.out.println(ans);
    }

	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)
          prin("AMBIGUOUS");
        else if(my)
          prin("MMYY");
        else if(ym)
          prin("YYMM");
        else
          prin("NA");
	}
}

