x=int(input())
f=x//100
d=x%100
ff=bool(1)
dd=bool(1)
if f==0 or f>12:
  ff=0
if d==0 or d>12:
  dd=0

if ff==1 and dd==1:
  print("AMBIGUOUS")
elif ff==0 and dd==0:
  print("NA")
else:
  if ff==1 and dd==0:
    print("MMYY")
  else:
    print("YYMM") x=int(input()) x int(input()) int input() input f=x//100 f x//100 x 100 d=x%100 d x%100 x 100 ff=bool(1) ff bool(1) bool 1 dd=bool(1) dd bool(1) bool 1 if f==0 or f>12:
  ff=0 f==0 or f>12 f==0 f 0 f>12 f 12 ff=0 ff 0 if d==0 or d>12:
  dd=0 d==0 or d>12 d==0 d 0 d>12 d 12 dd=0 dd 0 if ff==1 and dd==1:
  print("AMBIGUOUS")
elif ff==0 and dd==0:
  print("NA")
else:
  if ff==1 and dd==0:
    print("MMYY")
  else:
    print("YYMM") ff==1 and dd==1 ff==1 ff 1 dd==1 dd 1 print("AMBIGUOUS") print "AMBIGUOUS" elif ff==0 and dd==0:
  print("NA") ff==0 and dd==0 ff==0 ff 0 dd==0 dd 0 print("NA") print "NA" if ff==1 and dd==0:
    print("MMYY")
  else:
    print("YYMM") ff==1 and dd==0 ff==1 ff 1 dd==0 dd 0 print("MMYY") print "MMYY" print("YYMM") print "YYMM" d=x%100 x%100 d f=x//100 x//100 f ff=bool(1) bool(1) ff dd=0 0 dd x=int(input()) int(input()) x ff=0 0 ff dd=bool(1) bool(1) dd
x=int(input())
f=x//100
d=x%100
ff=bool(1)
dd=bool(1)
if f==0 or f>12:
  ff=0
if d==0 or d>12:
  dd=0

if ff==1 and dd==1:
  print("AMBIGUOUS")
elif ff==0 and dd==0:
  print("NA")
else:
  if ff==1 and dd==0:
    print("MMYY")
  else:
    print("YYMM")