n = input()
s, t = (1 <= int(n[:2]) <= 12), (1 <= int(n[2:]) <= 12)
print("AMBIGUOUS" if s and t else "YYMM" if t else "MMYY" if s else "NA") n = input() n input() input s, t = (1 <= int(n[:2]) <= 12), (1 <= int(n[2:]) <= 12) s 1 <= int(n[:2]) <= 12 1 <= int(n[:2]) 1 int(n[:2]) int n[:2] n :2 2 12 t 1 <= int(n[2:]) <= 12 1 <= int(n[2:]) 1 int(n[2:]) int n[2:] n 2: 2 12 print("AMBIGUOUS" if s and t else "YYMM" if t else "MMYY" if s else "NA") print "AMBIGUOUS" if s and t else "YYMM" if t else "MMYY" if s else "NA" s and t s t "AMBIGUOUS" "YYMM" if t else "MMYY" if s else "NA" t "YYMM" "MMYY" if s else "NA" s "MMYY" "NA" s, t = (1 <= int(n[:2]) <= 12), (1 <= int(n[2:]) <= 12) 1 <= int(n[:2]) <= 12 s n = input() input() n t = (1 <= int(n[:2]) <= 12), (1 <= int(n[2:]) <= 12) 1 <= int(n[2:]) <= 12 t
n = input()
s, t = (1 <= int(n[:2]) <= 12), (1 <= int(n[2:]) <= 12)
print("AMBIGUOUS" if s and t else "YYMM" if t else "MMYY" if s else "NA")