import java.util.Scanner;

public class Main{
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int S = sc.nextInt();
	int s34 = S%100;
	int s12 = S/100;

	if((1<=s12 && s12<=12) && (1<=s34 && s34<=12)){
	    System.out.print("AMBIGUOUS");
	}else if(1<=s12 && s12<=12){
	    System.out.print("MMYY");
	}else if(1<=s34 && s34<=12){
	    System.out.print("YYMM");
	}else{
	    System.out.print("NA");
	}
    }
} import java.util.Scanner; Scanner java.util public class Main{
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int S = sc.nextInt();
	int s34 = S%100;
	int s12 = S/100;

	if((1<=s12 && s12<=12) && (1<=s34 && s34<=12)){
	    System.out.print("AMBIGUOUS");
	}else if(1<=s12 && s12<=12){
	    System.out.print("MMYY");
	}else if(1<=s34 && s34<=12){
	    System.out.print("YYMM");
	}else{
	    System.out.print("NA");
	}
    }
} Main public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int S = sc.nextInt();
	int s34 = S%100;
	int s12 = S/100;

	if((1<=s12 && s12<=12) && (1<=s34 && s34<=12)){
	    System.out.print("AMBIGUOUS");
	}else if(1<=s12 && s12<=12){
	    System.out.print("MMYY");
	}else if(1<=s34 && s34<=12){
	    System.out.print("YYMM");
	}else{
	    System.out.print("NA");
	}
    } main {
	Scanner sc = new Scanner(System.in);
	int S = sc.nextInt();
	int s34 = S%100;
	int s12 = S/100;

	if((1<=s12 && s12<=12) && (1<=s34 && s34<=12)){
	    System.out.print("AMBIGUOUS");
	}else if(1<=s12 && s12<=12){
	    System.out.print("MMYY");
	}else if(1<=s34 && s34<=12){
	    System.out.print("YYMM");
	}else{
	    System.out.print("NA");
	}
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int S = sc.nextInt(); S sc.nextInt() sc.nextInt sc int s34 = S%100; s34 S%100 S 100 int s12 = S/100; s12 S/100 S 100 if((1<=s12 && s12<=12) && (1<=s34 && s34<=12)){
	    System.out.print("AMBIGUOUS");
	}else if(1<=s12 && s12<=12){
	    System.out.print("MMYY");
	}else if(1<=s34 && s34<=12){
	    System.out.print("YYMM");
	}else{
	    System.out.print("NA");
	} (1<=s12 && s12<=12) && (1<=s34 && s34<=12) (1<=s12 && s12<=12) 1<=s12 1 s12 s12<=12 s12 12 (1<=s34 && s34<=12) 1<=s34 1 s34 s34<=12 s34 12 {
	    System.out.print("AMBIGUOUS");
	} System.out.print("AMBIGUOUS") System.out.print System.out System System.out "AMBIGUOUS" if(1<=s12 && s12<=12){
	    System.out.print("MMYY");
	}else if(1<=s34 && s34<=12){
	    System.out.print("YYMM");
	}else{
	    System.out.print("NA");
	} 1<=s12 && s12<=12 1<=s12 1 s12 s12<=12 s12 12 {
	    System.out.print("MMYY");
	} System.out.print("MMYY") System.out.print System.out System System.out "MMYY" if(1<=s34 && s34<=12){
	    System.out.print("YYMM");
	}else{
	    System.out.print("NA");
	} 1<=s34 && s34<=12 1<=s34 1 s34 s34<=12 s34 12 {
	    System.out.print("YYMM");
	} System.out.print("YYMM") System.out.print System.out System System.out "YYMM" {
	    System.out.print("NA");
	} System.out.print("NA") System.out.print 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 S = sc.nextInt();
	int s34 = S%100;
	int s12 = S/100;

	if((1<=s12 && s12<=12) && (1<=s34 && s34<=12)){
	    System.out.print("AMBIGUOUS");
	}else if(1<=s12 && s12<=12){
	    System.out.print("MMYY");
	}else if(1<=s34 && s34<=12){
	    System.out.print("YYMM");
	}else{
	    System.out.print("NA");
	}
    }
} public class Main{
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int S = sc.nextInt();
	int s34 = S%100;
	int s12 = S/100;

	if((1<=s12 && s12<=12) && (1<=s34 && s34<=12)){
	    System.out.print("AMBIGUOUS");
	}else if(1<=s12 && s12<=12){
	    System.out.print("MMYY");
	}else if(1<=s34 && s34<=12){
	    System.out.print("YYMM");
	}else{
	    System.out.print("NA");
	}
    }
} Main
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int S = sc.nextInt();
	int s34 = S%100;
	int s12 = S/100;

	if((1<=s12 && s12<=12) && (1<=s34 && s34<=12)){
	    System.out.print("AMBIGUOUS");
	}else if(1<=s12 && s12<=12){
	    System.out.print("MMYY");
	}else if(1<=s34 && s34<=12){
	    System.out.print("YYMM");
	}else{
	    System.out.print("NA");
	}
    }
}