S = gets.chomp
s = []
s[0], s[1] = S[0..1].to_i, S[2..3].to_i
yymm = [s[0] >= 1 , s[1] >= 1 , s[1] <= 12].all?
mmyy = [s[1] >= 1 , s[0] >= 1 , s[0] <= 12].all?

puts case [yymm, mmyy]
when [true, true] then
    "AMBIGUOUS"
when [true, false] then
    "YYMM"
when [false, true] then
    "MMYY"
when [false, false] then
    "NA"
end