
function Main(input) {
    var S = input[0];

    var mae = parseInt(S.substr(0, 2), 10);
    var usiro = parseInt(S.substr(2, 2), 10);

    var isMaeMM = 1 <= mae && mae <= 12;
    var isUsiroMM = 1 <= usiro && usiro <= 12;

    if (isMaeMM && isUsiroMM) {
        console.log('AMBIGUOUS');
    } else if (isMaeMM) {
        console.log('MMYY');
    } else if (isUsiroMM) {
        console.log('YYMM');
    } else {
        console.log('NA');
    }

}

Main(require("fs").readFileSync("/dev/stdin", "utf8").trim().split(/\n|\s/));