#include <bits/stdc++.h>

int main()
{
	int S;
	scanf("%d", &S);
	char ans[4][16]{"AMBIGUOUS", "YYMM", "MMYY", "NA"};
	int index{};
	if (S / 100 == 0 || S / 100 >= 13)
		index++;
	if (S % 100 == 0 || S % 100 >= 13)
		index += 2;
	
	printf("%s\n", ans[index]);

	return 0;
}