S = gets

a = S[0..1].to_i
b = S[2..3].to_i

Y = 'YYMM'
M = 'MMYY'
A = 'AMBIGUOUS'
N = 'NA'

y, m = false

if 1 <= b && b <= 12
  y = true
end

if 1 <= a && a <= 12
  m = true
end

if y && m
  puts A
elsif y
  puts Y
elsif m
  puts M
else
  puts N
end