s = gets

x = s.slice(0,2).to_i
y = s.slice(2, 2).to_i

if (12<x && y==0) || (x==0 && 12<y)
  puts "NA"
elsif x > 0 && x<13 && y > 12 && y<100
  puts "MMYY"
elsif x <= 99 && y > 0 && y <= 12
  puts "YYMM"
else
  puts "AMBIGUOUS"
end