let s = stdin.ReadLine()
let f = int s.[0..1]
let b = int s.[2..3]

if f = 0 || b = 0 || (f > 12 && b > 12) then "NA"
elif f < 13 && b < 13 then "AMBIGUOUS"
elif f < 13 then "MMYY"
else "YYMM"
|> printfn "%s"
