input = require('fs').readFileSync('/dev/stdin', 'utf8')
lines = input.split('\n') 
s = lines.shift() * 1
a = ~~(s / 100)
b = s % 100 

if (a == 0 || b == 0) {
    console.log('NA')
} else {
    if (a <= 12) {
        if (b <= 12 ) {
            console.log('AMBIGUOUS')
        } else {
            console.log('MMYY')
        } 
    } else if (b <= 12) {
        console.log('YYMM')
    } else {
        console.log('NA')
    }
}
