import java.util.Scanner;


class Solve{
	static int INF = 10000;
	
	 public void solve() {
		 Scanner sc = new Scanner(System.in) ;
		 int S = sc.nextInt();
		 int f=S/100;
		 int b = S%10+((S/10)%10)*10;
		 
		 if(b>0 &&b<=12) {
			 
			 if(f==0||f>12) {
				 System.out.println("YYMM");
				 
			 }else {
				 System.out.println("AMBIGUOUS");
			 }
		 }else if(f>=1&&f<=12) {
			 if(b==0||b>12) {
				 System.out.println("MMYY");
			 }else {
				 System.out.println("AMBIGUOUS");
			 }
		 }else {
			 System.out.println("NA");
		 }
		 
		 

;
	}
}





public class Main {

	public static void main(String[] args) {

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

	}
} import java.util.Scanner; Scanner java.util class Solve{
	static int INF = 10000;
	
	 public void solve() {
		 Scanner sc = new Scanner(System.in) ;
		 int S = sc.nextInt();
		 int f=S/100;
		 int b = S%10+((S/10)%10)*10;
		 
		 if(b>0 &&b<=12) {
			 
			 if(f==0||f>12) {
				 System.out.println("YYMM");
				 
			 }else {
				 System.out.println("AMBIGUOUS");
			 }
		 }else if(f>=1&&f<=12) {
			 if(b==0||b>12) {
				 System.out.println("MMYY");
			 }else {
				 System.out.println("AMBIGUOUS");
			 }
		 }else {
			 System.out.println("NA");
		 }
		 
		 

;
	}
} Solve static int INF = 10000; INF 10000 public void solve() {
		 Scanner sc = new Scanner(System.in) ;
		 int S = sc.nextInt();
		 int f=S/100;
		 int b = S%10+((S/10)%10)*10;
		 
		 if(b>0 &&b<=12) {
			 
			 if(f==0||f>12) {
				 System.out.println("YYMM");
				 
			 }else {
				 System.out.println("AMBIGUOUS");
			 }
		 }else if(f>=1&&f<=12) {
			 if(b==0||b>12) {
				 System.out.println("MMYY");
			 }else {
				 System.out.println("AMBIGUOUS");
			 }
		 }else {
			 System.out.println("NA");
		 }
		 
		 

;
	} solve {
		 Scanner sc = new Scanner(System.in) ;
		 int S = sc.nextInt();
		 int f=S/100;
		 int b = S%10+((S/10)%10)*10;
		 
		 if(b>0 &&b<=12) {
			 
			 if(f==0||f>12) {
				 System.out.println("YYMM");
				 
			 }else {
				 System.out.println("AMBIGUOUS");
			 }
		 }else if(f>=1&&f<=12) {
			 if(b==0||b>12) {
				 System.out.println("MMYY");
			 }else {
				 System.out.println("AMBIGUOUS");
			 }
		 }else {
			 System.out.println("NA");
		 }
		 
		 

;
	} Scanner sc = new Scanner(System.in) ; sc new Scanner(System.in) int S = sc.nextInt(); S sc.nextInt() sc.nextInt sc int f=S/100; f S/100 S 100 int b = S%10+((S/10)%10)*10; b S%10+((S/10)%10)*10 S%10 S 10 ((S/10)%10)*10 ((S/10)%10) (S/10) S 10 10 10 if(b>0 &&b<=12) {
			 
			 if(f==0||f>12) {
				 System.out.println("YYMM");
				 
			 }else {
				 System.out.println("AMBIGUOUS");
			 }
		 }else if(f>=1&&f<=12) {
			 if(b==0||b>12) {
				 System.out.println("MMYY");
			 }else {
				 System.out.println("AMBIGUOUS");
			 }
		 }else {
			 System.out.println("NA");
		 } b>0 &&b<=12 b>0 b 0 b<=12 b 12 {
			 
			 if(f==0||f>12) {
				 System.out.println("YYMM");
				 
			 }else {
				 System.out.println("AMBIGUOUS");
			 }
		 } if(f==0||f>12) {
				 System.out.println("YYMM");
				 
			 }else {
				 System.out.println("AMBIGUOUS");
			 } f==0||f>12 f==0 f 0 f>12 f 12 {
				 System.out.println("YYMM");
				 
			 } System.out.println("YYMM") System.out.println System.out System System.out "YYMM" {
				 System.out.println("AMBIGUOUS");
			 } System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" if(f>=1&&f<=12) {
			 if(b==0||b>12) {
				 System.out.println("MMYY");
			 }else {
				 System.out.println("AMBIGUOUS");
			 }
		 }else {
			 System.out.println("NA");
		 } f>=1&&f<=12 f>=1 f 1 f<=12 f 12 {
			 if(b==0||b>12) {
				 System.out.println("MMYY");
			 }else {
				 System.out.println("AMBIGUOUS");
			 }
		 } if(b==0||b>12) {
				 System.out.println("MMYY");
			 }else {
				 System.out.println("AMBIGUOUS");
			 } b==0||b>12 b==0 b 0 b>12 b 12 {
				 System.out.println("MMYY");
			 } System.out.println("MMYY") System.out.println System.out System System.out "MMYY" {
				 System.out.println("AMBIGUOUS");
			 } System.out.println("AMBIGUOUS") System.out.println System.out System System.out "AMBIGUOUS" {
			 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();

	}
} 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 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
import java.util.Scanner;


class Solve{
	static int INF = 10000;
	
	 public void solve() {
		 Scanner sc = new Scanner(System.in) ;
		 int S = sc.nextInt();
		 int f=S/100;
		 int b = S%10+((S/10)%10)*10;
		 
		 if(b>0 &&b<=12) {
			 
			 if(f==0||f>12) {
				 System.out.println("YYMM");
				 
			 }else {
				 System.out.println("AMBIGUOUS");
			 }
		 }else if(f>=1&&f<=12) {
			 if(b==0||b>12) {
				 System.out.println("MMYY");
			 }else {
				 System.out.println("AMBIGUOUS");
			 }
		 }else {
			 System.out.println("NA");
		 }
		 
		 

;
	}
}





public class Main {

	public static void main(String[] args) {

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

	}
}