//package atcoder;
import java.util.*;

 class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc=new Scanner(System.in);
		String s=sc.next();
		int n=Integer.parseInt(s.substring(0,2));
		int m=Integer.parseInt(s.substring(2));
		if(n>=1&&n<=12)
		{
			if(m>=1&&m<=12)
			{
				System.out.println("AMBIGUOUS");
			}
			else
			{
				System.out.println("MMYY");
			}
		}
		else
		{
			if(m>=1&&m<=12)
			{
				System.out.println("YYMM");
			}
			else
			{
				System.out.println("NA");
			}
		}

	}

} import java.util.*; util.* java class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc=new Scanner(System.in);
		String s=sc.next();
		int n=Integer.parseInt(s.substring(0,2));
		int m=Integer.parseInt(s.substring(2));
		if(n>=1&&n<=12)
		{
			if(m>=1&&m<=12)
			{
				System.out.println("AMBIGUOUS");
			}
			else
			{
				System.out.println("MMYY");
			}
		}
		else
		{
			if(m>=1&&m<=12)
			{
				System.out.println("YYMM");
			}
			else
			{
				System.out.println("NA");
			}
		}

	}

} Main public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc=new Scanner(System.in);
		String s=sc.next();
		int n=Integer.parseInt(s.substring(0,2));
		int m=Integer.parseInt(s.substring(2));
		if(n>=1&&n<=12)
		{
			if(m>=1&&m<=12)
			{
				System.out.println("AMBIGUOUS");
			}
			else
			{
				System.out.println("MMYY");
			}
		}
		else
		{
			if(m>=1&&m<=12)
			{
				System.out.println("YYMM");
			}
			else
			{
				System.out.println("NA");
			}
		}

	} main {
		// TODO Auto-generated method stub
		Scanner sc=new Scanner(System.in);
		String s=sc.next();
		int n=Integer.parseInt(s.substring(0,2));
		int m=Integer.parseInt(s.substring(2));
		if(n>=1&&n<=12)
		{
			if(m>=1&&m<=12)
			{
				System.out.println("AMBIGUOUS");
			}
			else
			{
				System.out.println("MMYY");
			}
		}
		else
		{
			if(m>=1&&m<=12)
			{
				System.out.println("YYMM");
			}
			else
			{
				System.out.println("NA");
			}
		}

	} Scanner sc=new Scanner(System.in); sc new Scanner(System.in) String s=sc.next(); s sc.next() sc.next sc int n=Integer.parseInt(s.substring(0,2)); n Integer.parseInt(s.substring(0,2)) Integer.parseInt Integer s.substring(0,2) s.substring s 0 2 int m=Integer.parseInt(s.substring(2)); m Integer.parseInt(s.substring(2)) Integer.parseInt Integer s.substring(2) s.substring s 2 if(n>=1&&n<=12)
		{
			if(m>=1&&m<=12)
			{
				System.out.println("AMBIGUOUS");
			}
			else
			{
				System.out.println("MMYY");
			}
		}
		else
		{
			if(m>=1&&m<=12)
			{
				System.out.println("YYMM");
			}
			else
			{
				System.out.println("NA");
			}
		} n>=1&&n<=12 n>=1 n 1 n<=12 n 12 {
			if(m>=1&&m<=12)
			{
				System.out.println("AMBIGUOUS");
			}
			else
			{
				System.out.println("MMYY");
			}
		} if(m>=1&&m<=12)
			{
				System.out.println("AMBIGUOUS");
			}
			else
			{
				System.out.println("MMYY");
			} m>=1&&m<=12 m>=1 m 1 m<=12 m 12 {
				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(m>=1&&m<=12)
			{
				System.out.println("YYMM");
			}
			else
			{
				System.out.println("NA");
			}
		} if(m>=1&&m<=12)
			{
				System.out.println("YYMM");
			}
			else
			{
				System.out.println("NA");
			} m>=1&&m<=12 m>=1 m 1 m<=12 m 12 {
				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" String[] args args
//package atcoder;
import java.util.*;

 class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc=new Scanner(System.in);
		String s=sc.next();
		int n=Integer.parseInt(s.substring(0,2));
		int m=Integer.parseInt(s.substring(2));
		if(n>=1&&n<=12)
		{
			if(m>=1&&m<=12)
			{
				System.out.println("AMBIGUOUS");
			}
			else
			{
				System.out.println("MMYY");
			}
		}
		else
		{
			if(m>=1&&m<=12)
			{
				System.out.println("YYMM");
			}
			else
			{
				System.out.println("NA");
			}
		}

	}

}
