s = gets
ll = s[0] + s[1]
rr = s[2] + s[3]


if ll.to_i.between?(01,12 ) 
    if rr.to_i.between?(01, 12)
      puts "AMBIGUOS"
  else
      puts "MMYY"
  end
elsif rr.to_i.between?(01, 12)
    puts "YYMM"
else
    puts "NA"
end