local mce, mfl, msq, mmi, mma = math.ceil, math.floor, math.sqrt, math.min, math.max
local s = io.read()
local a, b = s:match("(%d%d)(%d%d)")
a, b = tonumber(a), tonumber(b)
local my, ym = false, false
if(1 <= a and a <= 12) then
  my = true
end
if(1 <= b and b <= 12) then
  ym = true
end
if my and ym then print("AMBIGUOUS")
elseif my then print("MMYY")
elseif ym then print("YYMM")
else print("NA")
end
