import java.util.*;

class Main
{
	public static void main(String[] args)
	{
		String S,str1,str2;
		Scanner sc = new Scanner(System.in);
		S = sc.next();
		
		str1 = S.substring(0,2);
		str2 = S.substring(2);
		
		int a = Integer.parseInt(str1);
		int b = Integer.parseInt(str2);
				
		if((a>12 && b>12) || (a==0 && b>12) || (a>12 && b==0) || (a==0 && b==0))	System.out.println("NA");
		else if((a<=12 && b>12) || (a<=12 && b==0))	System.out.println("MMYY");
		else if((a>12 && b<=12) || (a==0 && b<=12))	System.out.println("YYMM");
		else	System.out.println("AMBIGUOUS");
	}
} import java.util.*; util.* java class Main
{
	public static void main(String[] args)
	{
		String S,str1,str2;
		Scanner sc = new Scanner(System.in);
		S = sc.next();
		
		str1 = S.substring(0,2);
		str2 = S.substring(2);
		
		int a = Integer.parseInt(str1);
		int b = Integer.parseInt(str2);
				
		if((a>12 && b>12) || (a==0 && b>12) || (a>12 && b==0) || (a==0 && b==0))	System.out.println("NA");
		else if((a<=12 && b>12) || (a<=12 && b==0))	System.out.println("MMYY");
		else if((a>12 && b<=12) || (a==0 && b<=12))	System.out.println("YYMM");
		else	System.out.println("AMBIGUOUS");
	}
} Main public static void main(String[] args)
	{
		String S,str1,str2;
		Scanner sc = new Scanner(System.in);
		S = sc.next();
		
		str1 = S.substring(0,2);
		str2 = S.substring(2);
		
		int a = Integer.parseInt(str1);
		int b = Integer.parseInt(str2);
				
		if((a>12 && b>12) || (a==0 && b>12) || (a>12 && b==0) || (a==0 && b==0))	System.out.println("NA");
		else if((a<=12 && b>12) || (a<=12 && b==0))	System.out.println("MMYY");
		else if((a>12 && b<=12) || (a==0 && b<=12))	System.out.println("YYMM");
		else	System.out.println("AMBIGUOUS");
	} main {
		String S,str1,str2;
		Scanner sc = new Scanner(System.in);
		S = sc.next();
		
		str1 = S.substring(0,2);
		str2 = S.substring(2);
		
		int a = Integer.parseInt(str1);
		int b = Integer.parseInt(str2);
				
		if((a>12 && b>12) || (a==0 && b>12) || (a>12 && b==0) || (a==0 && b==0))	System.out.println("NA");
		else if((a<=12 && b>12) || (a<=12 && b==0))	System.out.println("MMYY");
		else if((a>12 && b<=12) || (a==0 && b<=12))	System.out.println("YYMM");
		else	System.out.println("AMBIGUOUS");
	} String S S str1 str1 str2; str2 Scanner sc = new Scanner(System.in); sc new Scanner(System.in) S = sc.next() S sc.next() sc.next sc str1 = S.substring(0,2) str1 S.substring(0,2) S.substring S 0 2 str2 = S.substring(2) str2 S.substring(2) S.substring S 2 int a = Integer.parseInt(str1); a Integer.parseInt(str1) Integer.parseInt Integer str1 int b = Integer.parseInt(str2); b Integer.parseInt(str2) Integer.parseInt Integer str2 if((a>12 && b>12) || (a==0 && b>12) || (a>12 && b==0) || (a==0 && b==0))	System.out.println("NA");
		else if((a<=12 && b>12) || (a<=12 && b==0))	System.out.println("MMYY");
		else if((a>12 && b<=12) || (a==0 && b<=12))	System.out.println("YYMM");
		else	System.out.println("AMBIGUOUS"); (a>12 && b>12) || (a==0 && b>12) || (a>12 && b==0) || (a==0 && b==0) (a>12 && b==0) (a>12 && b>12) || (a==0 && b>12) || (a>12 && b==0) || (a==0 && b==0) (a>12 && b>12) a>12 a 12 b>12 b 12 (a==0 && b>12) a==0 a 0 b>12 b 12 (a>12 && b==0) a>12 a 12 b==0 b 0 (a==0 && b==0) a==0 a 0 b==0 b 0 System.out.println("NA") System.out.println System.out System System.out "NA" if((a<=12 && b>12) || (a<=12 && b==0))	System.out.println("MMYY");
		else if((a>12 && b<=12) || (a==0 && b<=12))	System.out.println("YYMM");
		else	System.out.println("AMBIGUOUS"); (a<=12 && b>12) || (a<=12 && b==0) (a<=12 && b>12) a<=12 a 12 b>12 b 12 (a<=12 && b==0) a<=12 a 12 b==0 b 0 System.out.println("MMYY") System.out.println System.out System System.out "MMYY" if((a>12 && b<=12) || (a==0 && b<=12))	System.out.println("YYMM");
		else	System.out.println("AMBIGUOUS"); (a>12 && b<=12) || (a==0 && b<=12) (a>12 && b<=12) a>12 a 12 b<=12 b 12 (a==0 && b<=12) a==0 a 0 b<=12 b 12 System.out.println("YYMM") System.out.println System.out System System.out "YYMM" System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" String[] args args
import java.util.*;

class Main
{
	public static void main(String[] args)
	{
		String S,str1,str2;
		Scanner sc = new Scanner(System.in);
		S = sc.next();
		
		str1 = S.substring(0,2);
		str2 = S.substring(2);
		
		int a = Integer.parseInt(str1);
		int b = Integer.parseInt(str2);
				
		if((a>12 && b>12) || (a==0 && b>12) || (a>12 && b==0) || (a==0 && b==0))	System.out.println("NA");
		else if((a<=12 && b>12) || (a<=12 && b==0))	System.out.println("MMYY");
		else if((a>12 && b<=12) || (a==0 && b<=12))	System.out.println("YYMM");
		else	System.out.println("AMBIGUOUS");
	}
}