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

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