function main(input) {

        const bottom = input % 100;
        const top = (input - bottom) / 100;

        if (((1 > bottom) || (bottom > 12)) &&
                ((1 > top) || (top > 12))) {
                console.log('NA');
        }
        else if (bottom > 12) {
                console.log('MMYY');
        }
        else if (top > 12) {
                console.log('YYMM');
        }
        else {
                console.log('AMBIGUOUS');
        }
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));
