import java.util.*;
import static java.lang.System.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String date = sc.next();
		int num = Integer.parseInt(date);
		int a = num / 100;
		int b = num % 100;
		boolean isYYMM = true;
		boolean isMMYY = true;
		if (a < 1 || a > 12)
			isMMYY = false;
		if (b < 1 || b > 12)
			isYYMM = false;
		if (isYYMM && isMMYY)
			out.println("AMBIGUOUS");
		else if (isYYMM && !isMMYY)
			out.println("YYMM");
		else if (!isYYMM && isMMYY)
			out.println("MMYY");
		else
			out.println("NA");
		
	}
} import java.util.*; util.* java import static java.lang.System.*; import static java.lang.System.*; import static java.lang.System.*; public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String date = sc.next();
		int num = Integer.parseInt(date);
		int a = num / 100;
		int b = num % 100;
		boolean isYYMM = true;
		boolean isMMYY = true;
		if (a < 1 || a > 12)
			isMMYY = false;
		if (b < 1 || b > 12)
			isYYMM = false;
		if (isYYMM && isMMYY)
			out.println("AMBIGUOUS");
		else if (isYYMM && !isMMYY)
			out.println("YYMM");
		else if (!isYYMM && isMMYY)
			out.println("MMYY");
		else
			out.println("NA");
		
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String date = sc.next();
		int num = Integer.parseInt(date);
		int a = num / 100;
		int b = num % 100;
		boolean isYYMM = true;
		boolean isMMYY = true;
		if (a < 1 || a > 12)
			isMMYY = false;
		if (b < 1 || b > 12)
			isYYMM = false;
		if (isYYMM && isMMYY)
			out.println("AMBIGUOUS");
		else if (isYYMM && !isMMYY)
			out.println("YYMM");
		else if (!isYYMM && isMMYY)
			out.println("MMYY");
		else
			out.println("NA");
		
	} main {
		Scanner sc = new Scanner(System.in);
		String date = sc.next();
		int num = Integer.parseInt(date);
		int a = num / 100;
		int b = num % 100;
		boolean isYYMM = true;
		boolean isMMYY = true;
		if (a < 1 || a > 12)
			isMMYY = false;
		if (b < 1 || b > 12)
			isYYMM = false;
		if (isYYMM && isMMYY)
			out.println("AMBIGUOUS");
		else if (isYYMM && !isMMYY)
			out.println("YYMM");
		else if (!isYYMM && isMMYY)
			out.println("MMYY");
		else
			out.println("NA");
		
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String date = sc.next(); date sc.next() sc.next sc int num = Integer.parseInt(date); num Integer.parseInt(date) Integer.parseInt Integer date int a = num / 100; a num / 100 num 100 int b = num % 100; b num % 100 num 100 boolean isYYMM = true; isYYMM true boolean isMMYY = true; isMMYY true if (a < 1 || a > 12)
			isMMYY = false; a < 1 || a > 12 a < 1 a 1 a > 12 a 12 isMMYY = false isMMYY false if (b < 1 || b > 12)
			isYYMM = false; b < 1 || b > 12 b < 1 b 1 b > 12 b 12 isYYMM = false isYYMM false if (isYYMM && isMMYY)
			out.println("AMBIGUOUS");
		else if (isYYMM && !isMMYY)
			out.println("YYMM");
		else if (!isYYMM && isMMYY)
			out.println("MMYY");
		else
			out.println("NA"); isYYMM && isMMYY isYYMM isMMYY out.println("AMBIGUOUS") out.println out "AMBIGUOUS" if (isYYMM && !isMMYY)
			out.println("YYMM");
		else if (!isYYMM && isMMYY)
			out.println("MMYY");
		else
			out.println("NA"); isYYMM && !isMMYY isYYMM !isMMYY isMMYY out.println("YYMM") out.println out "YYMM" if (!isYYMM && isMMYY)
			out.println("MMYY");
		else
			out.println("NA"); !isYYMM && isMMYY !isYYMM isYYMM isMMYY out.println("MMYY") out.println out "MMYY" out.println("NA") out.println out "NA" String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String date = sc.next();
		int num = Integer.parseInt(date);
		int a = num / 100;
		int b = num % 100;
		boolean isYYMM = true;
		boolean isMMYY = true;
		if (a < 1 || a > 12)
			isMMYY = false;
		if (b < 1 || b > 12)
			isYYMM = false;
		if (isYYMM && isMMYY)
			out.println("AMBIGUOUS");
		else if (isYYMM && !isMMYY)
			out.println("YYMM");
		else if (!isYYMM && isMMYY)
			out.println("MMYY");
		else
			out.println("NA");
		
	}
} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String date = sc.next();
		int num = Integer.parseInt(date);
		int a = num / 100;
		int b = num % 100;
		boolean isYYMM = true;
		boolean isMMYY = true;
		if (a < 1 || a > 12)
			isMMYY = false;
		if (b < 1 || b > 12)
			isYYMM = false;
		if (isYYMM && isMMYY)
			out.println("AMBIGUOUS");
		else if (isYYMM && !isMMYY)
			out.println("YYMM");
		else if (!isYYMM && isMMYY)
			out.println("MMYY");
		else
			out.println("NA");
		
	}
} Main
import java.util.*;
import static java.lang.System.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String date = sc.next();
		int num = Integer.parseInt(date);
		int a = num / 100;
		int b = num % 100;
		boolean isYYMM = true;
		boolean isMMYY = true;
		if (a < 1 || a > 12)
			isMMYY = false;
		if (b < 1 || b > 12)
			isYYMM = false;
		if (isYYMM && isMMYY)
			out.println("AMBIGUOUS");
		else if (isYYMM && !isMMYY)
			out.println("YYMM");
		else if (!isYYMM && isMMYY)
			out.println("MMYY");
		else
			out.println("NA");
		
	}
}