import Foundation

let input_line = readLine()!
let start1 = input_line.startIndex.advancedBy(0)
let end1 = start1.advancedBy(2)
let start2 = input_line.startIndex.advancedBy(2)
let end2 = start2.advancedBy(2)

let first = Int(input_line.substringWithRange(Range(start: start1, end: end1)))!
let secound = Int(input_line.substringWithRange(Range(start: start2, end: end2)))!

if (0 < first && first <= 12) {  
	if(0 < secound && secound <= 12) {
    	print("AMBIGUOUS")
    } else {
    	print("MMYY") 
    }
} else {
	if(0 < secound && secound <= 12) {
    	print("YYMM")
    } else {
    	print("NA") 
    }
}