import java.util.*;
class Main{
	public static void main(String[] args){
    	Scanner scan = new Scanner(System.in);
      	int word = scan.nextInt();
      	int last = word%100;
        int first = (word - last)/100;
      	
      	if(jadmon(last)*jadmon(first) == 1){
        	System.out.println("AMBIGUOUS");
        } else if(jadmon(first)== 1 && jadmon(last)==0){
        	System.out.println("MMYY");
        } else if(jadmon(first)==0 && jadmon(last) == 1){
        	System.out.println("YYMM");
        } else {
        	System.out.println("NA");
        }
      	
    }
  	public static int jadmon(int n){
    	if(n>0 && n<13){
        	return 1;
        } else {
        	return 0;
        }
    }
} import java.util.*; util.* java class Main{
	public static void main(String[] args){
    	Scanner scan = new Scanner(System.in);
      	int word = scan.nextInt();
      	int last = word%100;
        int first = (word - last)/100;
      	
      	if(jadmon(last)*jadmon(first) == 1){
        	System.out.println("AMBIGUOUS");
        } else if(jadmon(first)== 1 && jadmon(last)==0){
        	System.out.println("MMYY");
        } else if(jadmon(first)==0 && jadmon(last) == 1){
        	System.out.println("YYMM");
        } else {
        	System.out.println("NA");
        }
      	
    }
  	public static int jadmon(int n){
    	if(n>0 && n<13){
        	return 1;
        } else {
        	return 0;
        }
    }
} Main public static void main(String[] args){
    	Scanner scan = new Scanner(System.in);
      	int word = scan.nextInt();
      	int last = word%100;
        int first = (word - last)/100;
      	
      	if(jadmon(last)*jadmon(first) == 1){
        	System.out.println("AMBIGUOUS");
        } else if(jadmon(first)== 1 && jadmon(last)==0){
        	System.out.println("MMYY");
        } else if(jadmon(first)==0 && jadmon(last) == 1){
        	System.out.println("YYMM");
        } else {
        	System.out.println("NA");
        }
      	
    } main {
    	Scanner scan = new Scanner(System.in);
      	int word = scan.nextInt();
      	int last = word%100;
        int first = (word - last)/100;
      	
      	if(jadmon(last)*jadmon(first) == 1){
        	System.out.println("AMBIGUOUS");
        } else if(jadmon(first)== 1 && jadmon(last)==0){
        	System.out.println("MMYY");
        } else if(jadmon(first)==0 && jadmon(last) == 1){
        	System.out.println("YYMM");
        } else {
        	System.out.println("NA");
        }
      	
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int word = scan.nextInt(); word scan.nextInt() scan.nextInt scan int last = word%100; last word%100 word 100 int first = (word - last)/100; first (word - last)/100 (word - last) word last 100 if(jadmon(last)*jadmon(first) == 1){
        	System.out.println("AMBIGUOUS");
        } else if(jadmon(first)== 1 && jadmon(last)==0){
        	System.out.println("MMYY");
        } else if(jadmon(first)==0 && jadmon(last) == 1){
        	System.out.println("YYMM");
        } else {
        	System.out.println("NA");
        } jadmon(last)*jadmon(first) == 1 jadmon(last)*jadmon(first) jadmon(last) jadmon last jadmon(first) jadmon first 1 {
        	System.out.println("AMBIGUOUS");
        } System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" if(jadmon(first)== 1 && jadmon(last)==0){
        	System.out.println("MMYY");
        } else if(jadmon(first)==0 && jadmon(last) == 1){
        	System.out.println("YYMM");
        } else {
        	System.out.println("NA");
        } jadmon(first)== 1 && jadmon(last)==0 jadmon(first)== 1 jadmon(first) jadmon first 1 jadmon(last)==0 jadmon(last) jadmon last 0 {
        	System.out.println("MMYY");
        } System.out.println("MMYY") System.out.println System.out System System.out "MMYY" if(jadmon(first)==0 && jadmon(last) == 1){
        	System.out.println("YYMM");
        } else {
        	System.out.println("NA");
        } jadmon(first)==0 && jadmon(last) == 1 jadmon(first)==0 jadmon(first) jadmon first 0 jadmon(last) == 1 jadmon(last) jadmon last 1 {
        	System.out.println("YYMM");
        } System.out.println("YYMM") System.out.println System.out System System.out "YYMM" {
        	System.out.println("NA");
        } System.out.println("NA") System.out.println System.out System System.out "NA" String[] args args public static int jadmon(int n){
    	if(n>0 && n<13){
        	return 1;
        } else {
        	return 0;
        }
    } jadmon {
    	if(n>0 && n<13){
        	return 1;
        } else {
        	return 0;
        }
    } if(n>0 && n<13){
        	return 1;
        } else {
        	return 0;
        } n>0 && n<13 n>0 n 0 n<13 n 13 {
        	return 1;
        } return 1; 1 {
        	return 0;
        } return 0; 0 int n n
import java.util.*;
class Main{
	public static void main(String[] args){
    	Scanner scan = new Scanner(System.in);
      	int word = scan.nextInt();
      	int last = word%100;
        int first = (word - last)/100;
      	
      	if(jadmon(last)*jadmon(first) == 1){
        	System.out.println("AMBIGUOUS");
        } else if(jadmon(first)== 1 && jadmon(last)==0){
        	System.out.println("MMYY");
        } else if(jadmon(first)==0 && jadmon(last) == 1){
        	System.out.println("YYMM");
        } else {
        	System.out.println("NA");
        }
      	
    }
  	public static int jadmon(int n){
    	if(n>0 && n<13){
        	return 1;
        } else {
        	return 0;
        }
    }
}
