s = gets
 first = (s[0]+s[1]).to_i
 second = (s[2]+s[3]).to_i
 firstm = (first > 0 && first <= 12)
 firsty = (first >= 0)
 secondm = (second > 0 && second <= 12)
 secondy = (second >= 0)
if firstm && firsty && secondm && secondy
  puts "AMBIGUOUS"
elsif firstm && secondy
  puts "MMYY"
elsif firsty && secondm
  puts "YYMM"
else
  puts "NA"
end