const Main = input => {
    input = input[0].split('');
    const l = input[0]+input[1], r = input[2]+input[3];
    if (l == 0 || l > 12) {
        if (r == 0 || r > 12) {
            console.log('NA');
        } else {
            console.log('YYMM');
        }
    } else {
        if (r == 0 || r > 12) {
            console.log('MMYY');
        } else {
            console.log('AMBIGUOUS');
        }
    }
};
Main(require("fs").readFileSync("/dev/stdin", "utf8").split('\n'));