import java.util.Scanner;
import java.util.regex.Pattern;

class Main{
	public static void main(String[]$){

		Scanner sc = new Scanner(System.in);
		String S = sc.next();

		Pattern ym = Pattern.compile("^([0-9]{2}(0[1-9]|1[0-2]))$");
		Pattern my = Pattern.compile("^((0[1-9]|1[0-2])[0-9]{2})$");
		String ans = "";

		if(ym.matcher(S).find() && my.matcher(S).find())
			ans = "AMBIGUOUS";
		else if(ym.matcher(S).find())
			ans = "YYMM";
		else if(my.matcher(S).find())
			ans = "MMYY";
		else
			ans = "NA";

		System.out.println(ans);
	}
} import java.util.Scanner; Scanner java.util import java.util.regex.Pattern; Pattern java.util.regex class Main{
	public static void main(String[]$){

		Scanner sc = new Scanner(System.in);
		String S = sc.next();

		Pattern ym = Pattern.compile("^([0-9]{2}(0[1-9]|1[0-2]))$");
		Pattern my = Pattern.compile("^((0[1-9]|1[0-2])[0-9]{2})$");
		String ans = "";

		if(ym.matcher(S).find() && my.matcher(S).find())
			ans = "AMBIGUOUS";
		else if(ym.matcher(S).find())
			ans = "YYMM";
		else if(my.matcher(S).find())
			ans = "MMYY";
		else
			ans = "NA";

		System.out.println(ans);
	}
} Main public static void main(String[]$){

		Scanner sc = new Scanner(System.in);
		String S = sc.next();

		Pattern ym = Pattern.compile("^([0-9]{2}(0[1-9]|1[0-2]))$");
		Pattern my = Pattern.compile("^((0[1-9]|1[0-2])[0-9]{2})$");
		String ans = "";

		if(ym.matcher(S).find() && my.matcher(S).find())
			ans = "AMBIGUOUS";
		else if(ym.matcher(S).find())
			ans = "YYMM";
		else if(my.matcher(S).find())
			ans = "MMYY";
		else
			ans = "NA";

		System.out.println(ans);
	} main {

		Scanner sc = new Scanner(System.in);
		String S = sc.next();

		Pattern ym = Pattern.compile("^([0-9]{2}(0[1-9]|1[0-2]))$");
		Pattern my = Pattern.compile("^((0[1-9]|1[0-2])[0-9]{2})$");
		String ans = "";

		if(ym.matcher(S).find() && my.matcher(S).find())
			ans = "AMBIGUOUS";
		else if(ym.matcher(S).find())
			ans = "YYMM";
		else if(my.matcher(S).find())
			ans = "MMYY";
		else
			ans = "NA";

		System.out.println(ans);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc Pattern ym = Pattern.compile("^([0-9]{2}(0[1-9]|1[0-2]))$"); ym Pattern.compile("^([0-9]{2}(0[1-9]|1[0-2]))$") Pattern.compile Pattern "^([0-9]{2}(0[1-9]|1[0-2]))$" Pattern my = Pattern.compile("^((0[1-9]|1[0-2])[0-9]{2})$"); my Pattern.compile("^((0[1-9]|1[0-2])[0-9]{2})$") Pattern.compile Pattern "^((0[1-9]|1[0-2])[0-9]{2})$" String ans = ""; ans "" if(ym.matcher(S).find() && my.matcher(S).find())
			ans = "AMBIGUOUS";
		else if(ym.matcher(S).find())
			ans = "YYMM";
		else if(my.matcher(S).find())
			ans = "MMYY";
		else
			ans = "NA"; ym.matcher(S).find() && my.matcher(S).find() ym.matcher(S).find() ym.matcher(S).find ym.matcher(S) ym.matcher ym S my.matcher(S).find() my.matcher(S).find my.matcher(S) my.matcher my S ans = "AMBIGUOUS" ans "AMBIGUOUS" if(ym.matcher(S).find())
			ans = "YYMM";
		else if(my.matcher(S).find())
			ans = "MMYY";
		else
			ans = "NA"; ym.matcher(S).find() ym.matcher(S).find ym.matcher(S) ym.matcher ym S ans = "YYMM" ans "YYMM" if(my.matcher(S).find())
			ans = "MMYY";
		else
			ans = "NA"; my.matcher(S).find() my.matcher(S).find my.matcher(S) my.matcher my S ans = "MMYY" ans "MMYY" ans = "NA" ans "NA" System.out.println(ans) System.out.println System.out System System.out ans String[]$ $
import java.util.Scanner;
import java.util.regex.Pattern;

class Main{
	public static void main(String[]$){

		Scanner sc = new Scanner(System.in);
		String S = sc.next();

		Pattern ym = Pattern.compile("^([0-9]{2}(0[1-9]|1[0-2]))$");
		Pattern my = Pattern.compile("^((0[1-9]|1[0-2])[0-9]{2})$");
		String ans = "";

		if(ym.matcher(S).find() && my.matcher(S).find())
			ans = "AMBIGUOUS";
		else if(ym.matcher(S).find())
			ans = "YYMM";
		else if(my.matcher(S).find())
			ans = "MMYY";
		else
			ans = "NA";

		System.out.println(ans);
	}
}
