function main(input) {

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

        const isMonth = m => (1 <= m) && (m <= 12);
        const isBottomInMonth = isMonth(bottom);
        const isTopInMonth = isMonth(top);

        if ((!isBottomInMonth) && (!isTopInMonth)) {
                console.log('NA');
        }
        else if ((isBottomInMonth) && (isTopInMonth)) {
                console.log('AMBIGUOUS');
        }
        else if (isBottomInMonth) {
                console.log('YYMM');
        }
        else {
                console.log('MMYY');
        }
}

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