#!/usr/bin/env ruby

s = gets.chomp
l = s[0, 2].to_i
r = s[2, 2].to_i
if 1 <= l && l <= 12 then
  if 1 <= r && r <= 12 then
    puts  "AMBIGUOUS"
  else
      puts "MMYY"
  end
else
  if 1 <= r && r <= 12 then
    puts "YYMM"
  else
    puts "NA"
  end
end

