def fn(x)
  if x >= 1 && x <= 12
    return true
  else
    return false
  end
end

s0 = gets.chars.map(&:to_i)
s1 = s0[0] * 10 + s0[1]
s2 = s0[2] * 10 + s0[3]

if fn(s1) && fn(s2)
  puts :AMBIGUOUS

elsif fn(s1)
  puts :MMYY

elsif fn(s2)
  puts :YYMM

else
  puts :NA

end
