s = io.read()
s1 = tonumber(s:sub(1, 2))
s2 = tonumber(s:sub(3, 4))
f1 = 0 < s1 and s1 <= 12
f2 = 0 < s2 and s2 <= 12
if f1 and f2 then
  print("AMBIGUOUS")
elseif f1 then
  print("MMYY")
elseif f2 then
  print("YYMM")
else
  print("NA")
end
