S = input()
mm = ["0"+str(x) for x in range(1,10)]+["10","11","12"]
mmyy = (S[:2] in mm)
yymm = (S[2:] in mm)
a = "NA"

if yymm and mmyy:
  a = "AMBIGUOUS"
elif yymm:
  a = "YYMM"
elif mmyy:
  a = "MMYY"
  
print(a) S = input() S input() input "0"+str(x) for x in range(1,10) for x in range(1,10) x range(1,10) range 1 10 for x in range(1,10) "0"+str(x) "0" str(x) str x mm = ["0"+str(x) for x in range(1,10)]+["10","11","12"] mm ["0"+str(x) for x in range(1,10)]+["10","11","12"] ["0"+str(x) for x in range(1,10)] ["10","11","12"] "10" "11" "12" mmyy = (S[:2] in mm) mmyy S[:2] in mm S[:2] S :2 2 mm yymm = (S[2:] in mm) yymm S[2:] in mm S[2:] S 2: 2 mm a = "NA" a "NA" if yymm and mmyy:
  a = "AMBIGUOUS"
elif yymm:
  a = "YYMM"
elif mmyy:
  a = "MMYY"
   yymm and mmyy yymm mmyy a = "AMBIGUOUS" a "AMBIGUOUS" elif yymm:
  a = "YYMM" yymm a = "YYMM" a "YYMM" elif mmyy:
  a = "MMYY"
   mmyy a = "MMYY" a "MMYY" print(a) print a yymm = (S[2:] in mm) S[2:] in mm yymm a = "NA" "NA" a S = input() input() S mm = ["0"+str(x) for x in range(1,10)]+["10","11","12"] ["0"+str(x) for x in range(1,10)]+["10","11","12"] mm a = "AMBIGUOUS" "AMBIGUOUS" a mmyy = (S[:2] in mm) S[:2] in mm mmyy a = "MMYY" "MMYY" a a = "YYMM" "YYMM" a
S = input()
mm = ["0"+str(x) for x in range(1,10)]+["10","11","12"]
mmyy = (S[:2] in mm)
yymm = (S[2:] in mm)
a = "NA"

if yymm and mmyy:
  a = "AMBIGUOUS"
elif yymm:
  a = "YYMM"
elif mmyy:
  a = "MMYY"
  
print(a)