s = gets.strip

if s[0..1].to_i == 0 || s[2..3].to_i == 0
  print 'NA'
elsif s[0..1].to_i <= 12 && s[2..3].to_i <= 12
  print 'AMBIGUOUS'
elsif s[0..1].to_i <= 12
  print 'MMYY'
elsif s[2..3].to_i <= 12
  print 'YYMM'
else
  print 'NA'
end