import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int s = in.nextInt();
		int num1 = s/100;
		int num2 = s%100;
		boolean month1 = false;
		boolean month2 = false;
		if(num1>=1 && num1<=12) month1 = true;
		if(num2>=1 && num2<=12) month2 = true;
		if(month1&&month2) System.out.println("AMBIGUOUS");
		else if(month1) System.out.println("MMYY");
		else if(month2) System.out.println("YYMM");
		else System.out.println("NA");
		in.close();
	}

} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int s = in.nextInt();
		int num1 = s/100;
		int num2 = s%100;
		boolean month1 = false;
		boolean month2 = false;
		if(num1>=1 && num1<=12) month1 = true;
		if(num2>=1 && num2<=12) month2 = true;
		if(month1&&month2) System.out.println("AMBIGUOUS");
		else if(month1) System.out.println("MMYY");
		else if(month2) System.out.println("YYMM");
		else System.out.println("NA");
		in.close();
	}

} Main public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int s = in.nextInt();
		int num1 = s/100;
		int num2 = s%100;
		boolean month1 = false;
		boolean month2 = false;
		if(num1>=1 && num1<=12) month1 = true;
		if(num2>=1 && num2<=12) month2 = true;
		if(month1&&month2) System.out.println("AMBIGUOUS");
		else if(month1) System.out.println("MMYY");
		else if(month2) System.out.println("YYMM");
		else System.out.println("NA");
		in.close();
	} main {
		Scanner in = new Scanner(System.in);
		int s = in.nextInt();
		int num1 = s/100;
		int num2 = s%100;
		boolean month1 = false;
		boolean month2 = false;
		if(num1>=1 && num1<=12) month1 = true;
		if(num2>=1 && num2<=12) month2 = true;
		if(month1&&month2) System.out.println("AMBIGUOUS");
		else if(month1) System.out.println("MMYY");
		else if(month2) System.out.println("YYMM");
		else System.out.println("NA");
		in.close();
	} Scanner in = new Scanner(System.in); in new Scanner(System.in) int s = in.nextInt(); s in.nextInt() in.nextInt in int num1 = s/100; num1 s/100 s 100 int num2 = s%100; num2 s%100 s 100 boolean month1 = false; month1 false boolean month2 = false; month2 false if(num1>=1 && num1<=12) month1 = true; num1>=1 && num1<=12 num1>=1 num1 1 num1<=12 num1 12 month1 = true month1 true if(num2>=1 && num2<=12) month2 = true; num2>=1 && num2<=12 num2>=1 num2 1 num2<=12 num2 12 month2 = true month2 true if(month1&&month2) System.out.println("AMBIGUOUS");
		else if(month1) System.out.println("MMYY");
		else if(month2) System.out.println("YYMM");
		else System.out.println("NA"); month1&&month2 month1 month2 System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" if(month1) System.out.println("MMYY");
		else if(month2) System.out.println("YYMM");
		else System.out.println("NA"); month1 System.out.println("MMYY") System.out.println System.out System System.out "MMYY" if(month2) System.out.println("YYMM");
		else System.out.println("NA"); month2 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" in.close() in.close in String[] args args public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int s = in.nextInt();
		int num1 = s/100;
		int num2 = s%100;
		boolean month1 = false;
		boolean month2 = false;
		if(num1>=1 && num1<=12) month1 = true;
		if(num2>=1 && num2<=12) month2 = true;
		if(month1&&month2) System.out.println("AMBIGUOUS");
		else if(month1) System.out.println("MMYY");
		else if(month2) System.out.println("YYMM");
		else System.out.println("NA");
		in.close();
	}

} public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int s = in.nextInt();
		int num1 = s/100;
		int num2 = s%100;
		boolean month1 = false;
		boolean month2 = false;
		if(num1>=1 && num1<=12) month1 = true;
		if(num2>=1 && num2<=12) month2 = true;
		if(month1&&month2) System.out.println("AMBIGUOUS");
		else if(month1) System.out.println("MMYY");
		else if(month2) System.out.println("YYMM");
		else System.out.println("NA");
		in.close();
	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int s = in.nextInt();
		int num1 = s/100;
		int num2 = s%100;
		boolean month1 = false;
		boolean month2 = false;
		if(num1>=1 && num1<=12) month1 = true;
		if(num2>=1 && num2<=12) month2 = true;
		if(month1&&month2) System.out.println("AMBIGUOUS");
		else if(month1) System.out.println("MMYY");
		else if(month2) System.out.println("YYMM");
		else System.out.println("NA");
		in.close();
	}

}
