
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		
		
		while(scan.hasNext())
		{
			
			String s,s1 ;
			s=scan.next();
			char arr[]=s.toCharArray();
			int c1=((arr[0]-48)*10)+(arr[1]-48);
			int c2=((arr[2]-48)*10)+(arr[3]-48);
			if((c1>0 && c1<=12 && c2>=0) && (c1>=0 && c2>0 && c2<=12))
				System.out.println("AMBIGUOUS");
			else if(c1>0 && c1<=12 && c2>=0)
				System.out.println("MMYY");
			else if(c1>=0 && c2>0 && c2<=12)
				System.out.println("YYMM");
			else
				System.out.println("NA");
			
			
			
			
		}
	}

} import java.util.Scanner; Scanner java.util public class Main {
	
	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		
		
		while(scan.hasNext())
		{
			
			String s,s1 ;
			s=scan.next();
			char arr[]=s.toCharArray();
			int c1=((arr[0]-48)*10)+(arr[1]-48);
			int c2=((arr[2]-48)*10)+(arr[3]-48);
			if((c1>0 && c1<=12 && c2>=0) && (c1>=0 && c2>0 && c2<=12))
				System.out.println("AMBIGUOUS");
			else if(c1>0 && c1<=12 && c2>=0)
				System.out.println("MMYY");
			else if(c1>=0 && c2>0 && c2<=12)
				System.out.println("YYMM");
			else
				System.out.println("NA");
			
			
			
			
		}
	}

} Main public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		
		
		while(scan.hasNext())
		{
			
			String s,s1 ;
			s=scan.next();
			char arr[]=s.toCharArray();
			int c1=((arr[0]-48)*10)+(arr[1]-48);
			int c2=((arr[2]-48)*10)+(arr[3]-48);
			if((c1>0 && c1<=12 && c2>=0) && (c1>=0 && c2>0 && c2<=12))
				System.out.println("AMBIGUOUS");
			else if(c1>0 && c1<=12 && c2>=0)
				System.out.println("MMYY");
			else if(c1>=0 && c2>0 && c2<=12)
				System.out.println("YYMM");
			else
				System.out.println("NA");
			
			
			
			
		}
	} main {
		Scanner scan=new Scanner(System.in);
		
		
		while(scan.hasNext())
		{
			
			String s,s1 ;
			s=scan.next();
			char arr[]=s.toCharArray();
			int c1=((arr[0]-48)*10)+(arr[1]-48);
			int c2=((arr[2]-48)*10)+(arr[3]-48);
			if((c1>0 && c1<=12 && c2>=0) && (c1>=0 && c2>0 && c2<=12))
				System.out.println("AMBIGUOUS");
			else if(c1>0 && c1<=12 && c2>=0)
				System.out.println("MMYY");
			else if(c1>=0 && c2>0 && c2<=12)
				System.out.println("YYMM");
			else
				System.out.println("NA");
			
			
			
			
		}
	} Scanner scan=new Scanner(System.in); scan new Scanner(System.in) while(scan.hasNext())
		{
			
			String s,s1 ;
			s=scan.next();
			char arr[]=s.toCharArray();
			int c1=((arr[0]-48)*10)+(arr[1]-48);
			int c2=((arr[2]-48)*10)+(arr[3]-48);
			if((c1>0 && c1<=12 && c2>=0) && (c1>=0 && c2>0 && c2<=12))
				System.out.println("AMBIGUOUS");
			else if(c1>0 && c1<=12 && c2>=0)
				System.out.println("MMYY");
			else if(c1>=0 && c2>0 && c2<=12)
				System.out.println("YYMM");
			else
				System.out.println("NA");
			
			
			
			
		} scan.hasNext() scan.hasNext scan {
			
			String s,s1 ;
			s=scan.next();
			char arr[]=s.toCharArray();
			int c1=((arr[0]-48)*10)+(arr[1]-48);
			int c2=((arr[2]-48)*10)+(arr[3]-48);
			if((c1>0 && c1<=12 && c2>=0) && (c1>=0 && c2>0 && c2<=12))
				System.out.println("AMBIGUOUS");
			else if(c1>0 && c1<=12 && c2>=0)
				System.out.println("MMYY");
			else if(c1>=0 && c2>0 && c2<=12)
				System.out.println("YYMM");
			else
				System.out.println("NA");
			
			
			
			
		} String s s s1 ; s1 s=scan.next() s scan.next() scan.next scan char arr[]=s.toCharArray(); arr s.toCharArray() s.toCharArray s int c1=((arr[0]-48)*10)+(arr[1]-48); c1 ((arr[0]-48)*10)+(arr[1]-48) ((arr[0]-48)*10) (arr[0]-48) arr[0] arr 0 48 10 (arr[1]-48) arr[1] arr 1 48 int c2=((arr[2]-48)*10)+(arr[3]-48); c2 ((arr[2]-48)*10)+(arr[3]-48) ((arr[2]-48)*10) (arr[2]-48) arr[2] arr 2 48 10 (arr[3]-48) arr[3] arr 3 48 if((c1>0 && c1<=12 && c2>=0) && (c1>=0 && c2>0 && c2<=12))
				System.out.println("AMBIGUOUS");
			else if(c1>0 && c1<=12 && c2>=0)
				System.out.println("MMYY");
			else if(c1>=0 && c2>0 && c2<=12)
				System.out.println("YYMM");
			else
				System.out.println("NA"); (c1>0 && c1<=12 && c2>=0) && (c1>=0 && c2>0 && c2<=12) (c1>0 && c1<=12 && c2>=0) c1>0 && c1<=12 && c2>=0 c1>0 c1 0 c1<=12 c1 12 c2>=0 c2 0 (c1>=0 && c2>0 && c2<=12) c1>=0 && c2>0 && c2<=12 c1>=0 c1 0 c2>0 c2 0 c2<=12 c2 12 System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" if(c1>0 && c1<=12 && c2>=0)
				System.out.println("MMYY");
			else if(c1>=0 && c2>0 && c2<=12)
				System.out.println("YYMM");
			else
				System.out.println("NA"); c1>0 && c1<=12 && c2>=0 c1>0 && c1<=12 && c2>=0 c1>0 c1 0 c1<=12 c1 12 c2>=0 c2 0 System.out.println("MMYY") System.out.println System.out System System.out "MMYY" if(c1>=0 && c2>0 && c2<=12)
				System.out.println("YYMM");
			else
				System.out.println("NA"); c1>=0 && c2>0 && c2<=12 c1>=0 && c2>0 && c2<=12 c1>=0 c1 0 c2>0 c2 0 c2<=12 c2 12 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 scan=new Scanner(System.in);
		
		
		while(scan.hasNext())
		{
			
			String s,s1 ;
			s=scan.next();
			char arr[]=s.toCharArray();
			int c1=((arr[0]-48)*10)+(arr[1]-48);
			int c2=((arr[2]-48)*10)+(arr[3]-48);
			if((c1>0 && c1<=12 && c2>=0) && (c1>=0 && c2>0 && c2<=12))
				System.out.println("AMBIGUOUS");
			else if(c1>0 && c1<=12 && c2>=0)
				System.out.println("MMYY");
			else if(c1>=0 && c2>0 && c2<=12)
				System.out.println("YYMM");
			else
				System.out.println("NA");
			
			
			
			
		}
	}

} public class Main {
	
	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		
		
		while(scan.hasNext())
		{
			
			String s,s1 ;
			s=scan.next();
			char arr[]=s.toCharArray();
			int c1=((arr[0]-48)*10)+(arr[1]-48);
			int c2=((arr[2]-48)*10)+(arr[3]-48);
			if((c1>0 && c1<=12 && c2>=0) && (c1>=0 && c2>0 && c2<=12))
				System.out.println("AMBIGUOUS");
			else if(c1>0 && c1<=12 && c2>=0)
				System.out.println("MMYY");
			else if(c1>=0 && c2>0 && c2<=12)
				System.out.println("YYMM");
			else
				System.out.println("NA");
			
			
			
			
		}
	}

} Main

import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		
		
		while(scan.hasNext())
		{
			
			String s,s1 ;
			s=scan.next();
			char arr[]=s.toCharArray();
			int c1=((arr[0]-48)*10)+(arr[1]-48);
			int c2=((arr[2]-48)*10)+(arr[3]-48);
			if((c1>0 && c1<=12 && c2>=0) && (c1>=0 && c2>0 && c2<=12))
				System.out.println("AMBIGUOUS");
			else if(c1>0 && c1<=12 && c2>=0)
				System.out.println("MMYY");
			else if(c1>=0 && c2>0 && c2<=12)
				System.out.println("YYMM");
			else
				System.out.println("NA");
			
			
			
			
		}
	}

}
