input = gets.chomp.to_i
left = input/100
right = input%100

def month?(num)
  if 1 <= num && num <=12
    return true
  else
    return false
  end
end

if month?(left)
  if month?(right)
    puts "AMBIGUOUS"
  else
    puts "MMYY"
  end
else
  if month?(right)
    puts "YYMM"
  else
    puts "NA"
  end
end