s=input()
yy = ["%02d" % i for i in range(100)]
mm = ["%02d" % i for i in range(1, 13)]
yymm = s[:2] in yy and s[2:] in mm
mmyy = s[:2] in mm and s[2:] in yy
print(["NA","MMYY","YYMM","AMBIGUOUS"][yymm*2+mmyy]) s=input() s input() input "%02d" % i for i in range(100) for i in range(100) i range(100) range 100 for i in range(100) "%02d" % i "%02d" i yy = ["%02d" % i for i in range(100)] yy ["%02d" % i for i in range(100)] "%02d" % i for i in range(1, 13) for i in range(1, 13) i range(1, 13) range 1 13 for i in range(1, 13) "%02d" % i "%02d" i mm = ["%02d" % i for i in range(1, 13)] mm ["%02d" % i for i in range(1, 13)] yymm = s[:2] in yy and s[2:] in mm yymm s[:2] in yy and s[2:] in mm s[:2] in yy s[:2] s :2 2 yy s[2:] in mm s[2:] s 2: 2 mm mmyy = s[:2] in mm and s[2:] in yy mmyy s[:2] in mm and s[2:] in yy s[:2] in mm s[:2] s :2 2 mm s[2:] in yy s[2:] s 2: 2 yy print(["NA","MMYY","YYMM","AMBIGUOUS"][yymm*2+mmyy]) print ["NA","MMYY","YYMM","AMBIGUOUS"][yymm*2+mmyy] ["NA","MMYY","YYMM","AMBIGUOUS"] "NA" "MMYY" "YYMM" "AMBIGUOUS" yymm*2+mmyy yymm*2 yymm 2 mmyy yy = ["%02d" % i for i in range(100)] ["%02d" % i for i in range(100)] yy mmyy = s[:2] in mm and s[2:] in yy s[:2] in mm and s[2:] in yy mmyy s=input() input() s mm = ["%02d" % i for i in range(1, 13)] ["%02d" % i for i in range(1, 13)] mm yymm = s[:2] in yy and s[2:] in mm s[:2] in yy and s[2:] in mm yymm
s=input()
yy = ["%02d" % i for i in range(100)]
mm = ["%02d" % i for i in range(1, 13)]
yymm = s[:2] in yy and s[2:] in mm
mmyy = s[:2] in mm and s[2:] in yy
print(["NA","MMYY","YYMM","AMBIGUOUS"][yymm*2+mmyy])
