d = gets.to_i

four = d/1000
three = (d-four*1000)/100
two = (d-four*1000-three*100)/10
one = d-four*1000-three*100-two*10

first = four*10 + three
second = two*10 + one

if 0 < first && first < 13 && 0 < second && second < 13
	puts 'AMBIGUOUS'
elsif 0 < first && first < 13
	puts 'MMYY'
elsif 0 < second && second < 13
	puts 'YYMM'
else
	puts 'NA'
end