#include <bits/stdc++.h>
using namespace std;

int main() {
	int n ;
	cin >> n ; 
	int a = n/100 , b = n%100 ;
	if(a > 0 && a <= 12 && b > 0 && b <= 12){
		cout << "AMBIGUOUS";
	}else if(a > 0 && a <= 12){
		cout << "MMYY" ;
	}else if(b > 0 && b <= 12 ){
		cout << "YYMM" ;
	}else{
		cout << "NA" ;
	}
	return 0;
}