import java.util.*;
 
public class Main{
	public static void main(String[] args){
    	Scanner scan = new Scanner(System.in);
      	int N = scan.nextInt();
      	int upper  = N / 100;
      	int down = N % 100;
      	if(down == 0 || down > 13){//tsuki ga ato janai
          	if(upper == 0 || upper > 12){
        		System.out.print("NA");
            }
          	else {
            	System.out.print("MMYY");
            }
        }
      	if(0 < down && down < 13){
        	if(0 < upper && upper < 13){
            	System.out.print("AMBIGUOUS");
            }
          	else {
            	System.out.print("YYMM");
            }
        }
      	
    }
 
} import java.util.*; util.* java public class Main{
	public static void main(String[] args){
    	Scanner scan = new Scanner(System.in);
      	int N = scan.nextInt();
      	int upper  = N / 100;
      	int down = N % 100;
      	if(down == 0 || down > 13){//tsuki ga ato janai
          	if(upper == 0 || upper > 12){
        		System.out.print("NA");
            }
          	else {
            	System.out.print("MMYY");
            }
        }
      	if(0 < down && down < 13){
        	if(0 < upper && upper < 13){
            	System.out.print("AMBIGUOUS");
            }
          	else {
            	System.out.print("YYMM");
            }
        }
      	
    }
 
} Main public static void main(String[] args){
    	Scanner scan = new Scanner(System.in);
      	int N = scan.nextInt();
      	int upper  = N / 100;
      	int down = N % 100;
      	if(down == 0 || down > 13){//tsuki ga ato janai
          	if(upper == 0 || upper > 12){
        		System.out.print("NA");
            }
          	else {
            	System.out.print("MMYY");
            }
        }
      	if(0 < down && down < 13){
        	if(0 < upper && upper < 13){
            	System.out.print("AMBIGUOUS");
            }
          	else {
            	System.out.print("YYMM");
            }
        }
      	
    } main {
    	Scanner scan = new Scanner(System.in);
      	int N = scan.nextInt();
      	int upper  = N / 100;
      	int down = N % 100;
      	if(down == 0 || down > 13){//tsuki ga ato janai
          	if(upper == 0 || upper > 12){
        		System.out.print("NA");
            }
          	else {
            	System.out.print("MMYY");
            }
        }
      	if(0 < down && down < 13){
        	if(0 < upper && upper < 13){
            	System.out.print("AMBIGUOUS");
            }
          	else {
            	System.out.print("YYMM");
            }
        }
      	
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int N = scan.nextInt(); N scan.nextInt() scan.nextInt scan int upper  = N / 100; upper N / 100 N 100 int down = N % 100; down N % 100 N 100 if(down == 0 || down > 13){//tsuki ga ato janai
          	if(upper == 0 || upper > 12){
        		System.out.print("NA");
            }
          	else {
            	System.out.print("MMYY");
            }
        } down == 0 || down > 13 down == 0 down 0 down > 13 down 13 {//tsuki ga ato janai
          	if(upper == 0 || upper > 12){
        		System.out.print("NA");
            }
          	else {
            	System.out.print("MMYY");
            }
        } if(upper == 0 || upper > 12){
        		System.out.print("NA");
            }
          	else {
            	System.out.print("MMYY");
            } upper == 0 || upper > 12 upper == 0 upper 0 upper > 12 upper 12 {
        		System.out.print("NA");
            } System.out.print("NA") System.out.print System.out System System.out "NA" {
            	System.out.print("MMYY");
            } System.out.print("MMYY") System.out.print System.out System System.out "MMYY" if(0 < down && down < 13){
        	if(0 < upper && upper < 13){
            	System.out.print("AMBIGUOUS");
            }
          	else {
            	System.out.print("YYMM");
            }
        } 0 < down && down < 13 0 < down 0 down down < 13 down 13 {
        	if(0 < upper && upper < 13){
            	System.out.print("AMBIGUOUS");
            }
          	else {
            	System.out.print("YYMM");
            }
        } if(0 < upper && upper < 13){
            	System.out.print("AMBIGUOUS");
            }
          	else {
            	System.out.print("YYMM");
            } 0 < upper && upper < 13 0 < upper 0 upper upper < 13 upper 13 {
            	System.out.print("AMBIGUOUS");
            } System.out.print("AMBIGUOUS") System.out.print System.out System System.out "AMBIGUOUS" {
            	System.out.print("YYMM");
            } System.out.print("YYMM") System.out.print System.out System System.out "YYMM" String[] args args public class Main{
	public static void main(String[] args){
    	Scanner scan = new Scanner(System.in);
      	int N = scan.nextInt();
      	int upper  = N / 100;
      	int down = N % 100;
      	if(down == 0 || down > 13){//tsuki ga ato janai
          	if(upper == 0 || upper > 12){
        		System.out.print("NA");
            }
          	else {
            	System.out.print("MMYY");
            }
        }
      	if(0 < down && down < 13){
        	if(0 < upper && upper < 13){
            	System.out.print("AMBIGUOUS");
            }
          	else {
            	System.out.print("YYMM");
            }
        }
      	
    }
 
} public class Main{
	public static void main(String[] args){
    	Scanner scan = new Scanner(System.in);
      	int N = scan.nextInt();
      	int upper  = N / 100;
      	int down = N % 100;
      	if(down == 0 || down > 13){//tsuki ga ato janai
          	if(upper == 0 || upper > 12){
        		System.out.print("NA");
            }
          	else {
            	System.out.print("MMYY");
            }
        }
      	if(0 < down && down < 13){
        	if(0 < upper && upper < 13){
            	System.out.print("AMBIGUOUS");
            }
          	else {
            	System.out.print("YYMM");
            }
        }
      	
    }
 
} Main
import java.util.*;
 
public class Main{
	public static void main(String[] args){
    	Scanner scan = new Scanner(System.in);
      	int N = scan.nextInt();
      	int upper  = N / 100;
      	int down = N % 100;
      	if(down == 0 || down > 13){//tsuki ga ato janai
          	if(upper == 0 || upper > 12){
        		System.out.print("NA");
            }
          	else {
            	System.out.print("MMYY");
            }
        }
      	if(0 < down && down < 13){
        	if(0 < upper && upper < 13){
            	System.out.print("AMBIGUOUS");
            }
          	else {
            	System.out.print("YYMM");
            }
        }
      	
    }
 
}