s = input()
a,b = int(s[:2]),int(s[2:])
yymm = False
mmyy = False
if b > 0 and b <= 12:
  yymm = True
if a <= 12 and 0 < a:
  mmyy = True
if yymm and mmyy:
  print("AMBIGUOUS")
elif yymm:
  print("YYMM")
elif mmyy:
  print("MMYY")
else:
  print("NA") s = input() s input() input a,b = int(s[:2]),int(s[2:]) a int(s[:2]) int s[:2] s :2 2 b int(s[2:]) int s[2:] s 2: 2 yymm = False yymm False mmyy = False mmyy False if b > 0 and b <= 12:
  yymm = True b > 0 and b <= 12 b > 0 b 0 b <= 12 b 12 yymm = True yymm True if a <= 12 and 0 < a:
  mmyy = True a <= 12 and 0 < a a <= 12 a 12 0 < a 0 a mmyy = True mmyy True if yymm and mmyy:
  print("AMBIGUOUS")
elif yymm:
  print("YYMM")
elif mmyy:
  print("MMYY")
else:
  print("NA") yymm and mmyy yymm mmyy print("AMBIGUOUS") print "AMBIGUOUS" elif yymm:
  print("YYMM") yymm print("YYMM") print "YYMM" elif mmyy:
  print("MMYY") mmyy print("MMYY") print "MMYY" print("NA") print "NA" b = int(s[:2]),int(s[2:]) int(s[2:]) b a,b = int(s[:2]),int(s[2:]) int(s[:2]) a yymm = True True yymm s = input() input() s mmyy = False False mmyy mmyy = True True mmyy yymm = False False yymm
s = input()
a,b = int(s[:2]),int(s[2:])
yymm = False
mmyy = False
if b > 0 and b <= 12:
  yymm = True
if a <= 12 and 0 < a:
  mmyy = True
if yymm and mmyy:
  print("AMBIGUOUS")
elif yymm:
  print("YYMM")
elif mmyy:
  print("MMYY")
else:
  print("NA")