number = gets.chomp
aa = number[0] + number[1]
bb = number[2] + number[3]

if ("01" <= aa && aa <= "12") && ("01" <= bb && bb <= "12")
  puts "AMBIGUOUS"
elsif "01" <= aa && aa <= "12"
  puts "MMYY"
elsif "01" <= bb && bb <= "12"
  puts "YYMM"
else
  puts "NA"
end
