import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String S = sc.next();
		
		String A = S.substring(0, 2);
		String B = S.substring(2, 4);
		
		int C = Integer.valueOf(A);
		int D = Integer.valueOf(B);
		
		if(C == 0 || (13 <= C && C <= 99))
		{
			if(D == 0 || (13 <= D && D <= 99))
			{
				System.out.println("NA");
			}else
			{
				System.out.println("YYMM");
			}
		}else
		{
			if(D == 0 || (13 <= D && D <= 99))
			{
				System.out.println("MMYY");
			}else
			{
				System.out.println("AMBIGUOUS");
			}
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String S = sc.next();
		
		String A = S.substring(0, 2);
		String B = S.substring(2, 4);
		
		int C = Integer.valueOf(A);
		int D = Integer.valueOf(B);
		
		if(C == 0 || (13 <= C && C <= 99))
		{
			if(D == 0 || (13 <= D && D <= 99))
			{
				System.out.println("NA");
			}else
			{
				System.out.println("YYMM");
			}
		}else
		{
			if(D == 0 || (13 <= D && D <= 99))
			{
				System.out.println("MMYY");
			}else
			{
				System.out.println("AMBIGUOUS");
			}
		}
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String S = sc.next();
		
		String A = S.substring(0, 2);
		String B = S.substring(2, 4);
		
		int C = Integer.valueOf(A);
		int D = Integer.valueOf(B);
		
		if(C == 0 || (13 <= C && C <= 99))
		{
			if(D == 0 || (13 <= D && D <= 99))
			{
				System.out.println("NA");
			}else
			{
				System.out.println("YYMM");
			}
		}else
		{
			if(D == 0 || (13 <= D && D <= 99))
			{
				System.out.println("MMYY");
			}else
			{
				System.out.println("AMBIGUOUS");
			}
		}
	} main {
		Scanner sc = new Scanner(System.in);

		String S = sc.next();
		
		String A = S.substring(0, 2);
		String B = S.substring(2, 4);
		
		int C = Integer.valueOf(A);
		int D = Integer.valueOf(B);
		
		if(C == 0 || (13 <= C && C <= 99))
		{
			if(D == 0 || (13 <= D && D <= 99))
			{
				System.out.println("NA");
			}else
			{
				System.out.println("YYMM");
			}
		}else
		{
			if(D == 0 || (13 <= D && D <= 99))
			{
				System.out.println("MMYY");
			}else
			{
				System.out.println("AMBIGUOUS");
			}
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc String A = S.substring(0, 2); A S.substring(0, 2) S.substring S 0 2 String B = S.substring(2, 4); B S.substring(2, 4) S.substring S 2 4 int C = Integer.valueOf(A); C Integer.valueOf(A) Integer.valueOf Integer A int D = Integer.valueOf(B); D Integer.valueOf(B) Integer.valueOf Integer B if(C == 0 || (13 <= C && C <= 99))
		{
			if(D == 0 || (13 <= D && D <= 99))
			{
				System.out.println("NA");
			}else
			{
				System.out.println("YYMM");
			}
		}else
		{
			if(D == 0 || (13 <= D && D <= 99))
			{
				System.out.println("MMYY");
			}else
			{
				System.out.println("AMBIGUOUS");
			}
		} C == 0 || (13 <= C && C <= 99) C == 0 C 0 (13 <= C && C <= 99) 13 <= C 13 C C <= 99 C 99 {
			if(D == 0 || (13 <= D && D <= 99))
			{
				System.out.println("NA");
			}else
			{
				System.out.println("YYMM");
			}
		} if(D == 0 || (13 <= D && D <= 99))
			{
				System.out.println("NA");
			}else
			{
				System.out.println("YYMM");
			} D == 0 || (13 <= D && D <= 99) D == 0 D 0 (13 <= D && D <= 99) 13 <= D 13 D D <= 99 D 99 {
				System.out.println("NA");
			} System.out.println("NA") System.out.println System.out System System.out "NA" {
				System.out.println("YYMM");
			} System.out.println("YYMM") System.out.println System.out System System.out "YYMM" {
			if(D == 0 || (13 <= D && D <= 99))
			{
				System.out.println("MMYY");
			}else
			{
				System.out.println("AMBIGUOUS");
			}
		} if(D == 0 || (13 <= D && D <= 99))
			{
				System.out.println("MMYY");
			}else
			{
				System.out.println("AMBIGUOUS");
			} D == 0 || (13 <= D && D <= 99) D == 0 D 0 (13 <= D && D <= 99) 13 <= D 13 D D <= 99 D 99 {
				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" String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String S = sc.next();
		
		String A = S.substring(0, 2);
		String B = S.substring(2, 4);
		
		int C = Integer.valueOf(A);
		int D = Integer.valueOf(B);
		
		if(C == 0 || (13 <= C && C <= 99))
		{
			if(D == 0 || (13 <= D && D <= 99))
			{
				System.out.println("NA");
			}else
			{
				System.out.println("YYMM");
			}
		}else
		{
			if(D == 0 || (13 <= D && D <= 99))
			{
				System.out.println("MMYY");
			}else
			{
				System.out.println("AMBIGUOUS");
			}
		}
	}
} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String S = sc.next();
		
		String A = S.substring(0, 2);
		String B = S.substring(2, 4);
		
		int C = Integer.valueOf(A);
		int D = Integer.valueOf(B);
		
		if(C == 0 || (13 <= C && C <= 99))
		{
			if(D == 0 || (13 <= D && D <= 99))
			{
				System.out.println("NA");
			}else
			{
				System.out.println("YYMM");
			}
		}else
		{
			if(D == 0 || (13 <= D && D <= 99))
			{
				System.out.println("MMYY");
			}else
			{
				System.out.println("AMBIGUOUS");
			}
		}
	}
} Main
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String S = sc.next();
		
		String A = S.substring(0, 2);
		String B = S.substring(2, 4);
		
		int C = Integer.valueOf(A);
		int D = Integer.valueOf(B);
		
		if(C == 0 || (13 <= C && C <= 99))
		{
			if(D == 0 || (13 <= D && D <= 99))
			{
				System.out.println("NA");
			}else
			{
				System.out.println("YYMM");
			}
		}else
		{
			if(D == 0 || (13 <= D && D <= 99))
			{
				System.out.println("MMYY");
			}else
			{
				System.out.println("AMBIGUOUS");
			}
		}
	}
}