//Java8(OpenJDK 1.8.0)
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Solve s= new Solve();
		s.solve();
	}

}
class Solve{
	 Scanner sc = new Scanner(System.in) ;
	 void solve() {
		 int S =sc.nextInt();
		 int s_1 = S/100;		//先頭2文字
		 int s_2 = S%100;		//後ろ2文字

		 if(s_1>0 && s_1<13) {
			 if(s_2>0 && s_2<13) {
				 System.out.println("AMBIGUOUS");
			 }else {
				 System.out.println("MMYY");
			 }
		 }else {
			 if(s_2>0 && s_2<13) {
				 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) {

		Solve s= new Solve();
		s.solve();
	}

} Main public static void main(String[] args) {

		Solve s= new Solve();
		s.solve();
	} main {

		Solve s= new Solve();
		s.solve();
	} Solve s= new Solve(); s new Solve() s.solve() s.solve s String[] args args class Solve{
	 Scanner sc = new Scanner(System.in) ;
	 void solve() {
		 int S =sc.nextInt();
		 int s_1 = S/100;		//先頭2文字
		 int s_2 = S%100;		//後ろ2文字

		 if(s_1>0 && s_1<13) {
			 if(s_2>0 && s_2<13) {
				 System.out.println("AMBIGUOUS");
			 }else {
				 System.out.println("MMYY");
			 }
		 }else {
			 if(s_2>0 && s_2<13) {
				 System.out.println("YYMM");
			 }else {
				 System.out.println("NA");
			 }
		 }
	 }
} Solve Scanner sc = new Scanner(System.in) ; sc new Scanner(System.in) void solve() {
		 int S =sc.nextInt();
		 int s_1 = S/100;		//先頭2文字
		 int s_2 = S%100;		//後ろ2文字

		 if(s_1>0 && s_1<13) {
			 if(s_2>0 && s_2<13) {
				 System.out.println("AMBIGUOUS");
			 }else {
				 System.out.println("MMYY");
			 }
		 }else {
			 if(s_2>0 && s_2<13) {
				 System.out.println("YYMM");
			 }else {
				 System.out.println("NA");
			 }
		 }
	 } solve {
		 int S =sc.nextInt();
		 int s_1 = S/100;		//先頭2文字
		 int s_2 = S%100;		//後ろ2文字

		 if(s_1>0 && s_1<13) {
			 if(s_2>0 && s_2<13) {
				 System.out.println("AMBIGUOUS");
			 }else {
				 System.out.println("MMYY");
			 }
		 }else {
			 if(s_2>0 && s_2<13) {
				 System.out.println("YYMM");
			 }else {
				 System.out.println("NA");
			 }
		 }
	 } int S =sc.nextInt(); S sc.nextInt() sc.nextInt sc int s_1 = S/100; s_1 S/100 S 100 int s_2 = S%100; s_2 S%100 S 100 if(s_1>0 && s_1<13) {
			 if(s_2>0 && s_2<13) {
				 System.out.println("AMBIGUOUS");
			 }else {
				 System.out.println("MMYY");
			 }
		 }else {
			 if(s_2>0 && s_2<13) {
				 System.out.println("YYMM");
			 }else {
				 System.out.println("NA");
			 }
		 } s_1>0 && s_1<13 s_1>0 s_1 0 s_1<13 s_1 13 {
			 if(s_2>0 && s_2<13) {
				 System.out.println("AMBIGUOUS");
			 }else {
				 System.out.println("MMYY");
			 }
		 } if(s_2>0 && s_2<13) {
				 System.out.println("AMBIGUOUS");
			 }else {
				 System.out.println("MMYY");
			 } s_2>0 && s_2<13 s_2>0 s_2 0 s_2<13 s_2 13 {
				 System.out.println("AMBIGUOUS");
			 } System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" {
				 System.out.println("MMYY");
			 } System.out.println("MMYY") System.out.println System.out System System.out "MMYY" {
			 if(s_2>0 && s_2<13) {
				 System.out.println("YYMM");
			 }else {
				 System.out.println("NA");
			 }
		 } if(s_2>0 && s_2<13) {
				 System.out.println("YYMM");
			 }else {
				 System.out.println("NA");
			 } s_2>0 && s_2<13 s_2>0 s_2 0 s_2<13 s_2 13 {
				 System.out.println("YYMM");
			 } System.out.println("YYMM") System.out.println System.out System System.out "YYMM" {
				 System.out.println("NA");
			 } System.out.println("NA") System.out.println System.out System System.out "NA" public class Main {

	public static void main(String[] args) {

		Solve s= new Solve();
		s.solve();
	}

} public class Main {

	public static void main(String[] args) {

		Solve s= new Solve();
		s.solve();
	}

} Main
//Java8(OpenJDK 1.8.0)
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Solve s= new Solve();
		s.solve();
	}

}
class Solve{
	 Scanner sc = new Scanner(System.in) ;
	 void solve() {
		 int S =sc.nextInt();
		 int s_1 = S/100;		//先頭2文字
		 int s_2 = S%100;		//後ろ2文字

		 if(s_1>0 && s_1<13) {
			 if(s_2>0 && s_2<13) {
				 System.out.println("AMBIGUOUS");
			 }else {
				 System.out.println("MMYY");
			 }
		 }else {
			 if(s_2>0 && s_2<13) {
				 System.out.println("YYMM");
			 }else {
				 System.out.println("NA");
			 }
		 }
	 }
}