s = gets

months = 1..12
a = s[0, 2].to_i
b = s[2, 2].to_i

case [months.include?(a), months.include?(b)]
when [true, true]
  puts 'AMBIGUOUS'
when [false, true]
  puts 'YYMM'
when [true, false]
  puts 'MMYY'
else
  puts 'NA'
end
