import java.util.Scanner;

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

		int a = sc.nextInt();

		int[] b = new int[4];

		b[0] = a/1000;
		b[1] = (a/100)%10;
		b[2] = (a/10)%10;
		b[3] = a%10;

		int TH = b[0]*10 + b[1];
		int TO = b[2]*10 + b[3];

		if(TH > 12) {
			if(TO > 12) System.out.print("NA");
			else if(TO <=12) {
				if(TO==0) {System.out.print("NA");
				System.exit(0);}
				System.out.print("YYMM");}

		}

		else if(TH <=12) {

			if(TH==0) {

			if(TO > 12) System.out.print("NA");
			else if(TO<=12 && TO>0)  System.out.print("YYMM");
			else if(TO==0) System.out.print("NA");
			}

			else {
				if(TO > 12) System.out.print("MMYY");
				else if(TO<=12 && TO>0) System.out.print("AMBIGUOUS");
				else if(TO==0) System.out.print("MMYY");
			}
		}
	}

}
/tmp/hf-datasets-cache/medium/datasets/42704881117311-config-parquet-and-info-qiankunmu-Project_CodeNet-896c9d36/hub/datasets--qiankunmu--Project_CodeNet_Python800_and_Java250/snapshots/c899fde44a77ba1cc14973ed3de064e4ff3aadc7/Project_CodeNet_Java250.tar.gz