S = gets.to_i
yy43 = 0; mm43 = 0
yy21 = 0; mm21 = 0
yy43 = 1 if S % 100 >= 0 && S % 100 <= 99
mm43 = 1 if S % 100 >= 1 && S % 100 <= 12
yy21 = 1 if S / 100 >= 0 && S / 100 <= 99
mm21 = 1 if S / 100 >= 1 && S / 100 <= 12
if yy21 == 1 && mm43 == 1 && mm21 == 1 && yy43 == 1
  puts 'AMBIGUOUS'
elsif mm21 == 1 && yy43 == 1
  puts 'MMYY'
elsif yy21 == 1 && mm43 == 1
  puts 'YYMM'
else
  puts 'NA'
end