"use strict";
const Main = (input) => {
	let xs = input.trim().split(',').toString();
    let A = Number(xs[0] + xs[1]);
    let B = Number(xs[2] + xs[3]);
    
    if (1 <= A && A <= 12 && 1 <= B && B <= 12) {
    	console.log("AMBIGUOUS");
    } else if (1 <= A && A <= 12 && (B > 12 || B === 0)) {
    	console.log("MMYY");
    } else if ((A > 12 || A === 0) && 1 <= B && B <= 12) {
    	console.log("YYMM");
    } else {
    	console.log("NA");
    }
}
Main(require('fs').readFileSync('/dev/stdin','utf8'));