s = input()
a, b = int(s[:2]), int(s[2:])
r = ["AMBIGUOUS", "YYMM", "MMYY", "NA"]
print(r[(0 if (0 < b < 13) else 2) + (0 if (0 < a < 13) else 1)]) 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 r = ["AMBIGUOUS", "YYMM", "MMYY", "NA"] r ["AMBIGUOUS", "YYMM", "MMYY", "NA"] "AMBIGUOUS" "YYMM" "MMYY" "NA" print(r[(0 if (0 < b < 13) else 2) + (0 if (0 < a < 13) else 1)]) print r[(0 if (0 < b < 13) else 2) + (0 if (0 < a < 13) else 1)] r (0 if (0 < b < 13) else 2) + (0 if (0 < a < 13) else 1) 0 if (0 < b < 13) else 2 0 < b < 13 0 < b 0 b 13 0 2 0 if (0 < a < 13) else 1 0 < a < 13 0 < a 0 a 13 0 1 s = input() input() s r = ["AMBIGUOUS", "YYMM", "MMYY", "NA"] ["AMBIGUOUS", "YYMM", "MMYY", "NA"] r a, b = int(s[:2]), int(s[2:]) int(s[:2]) a b = int(s[:2]), int(s[2:]) int(s[2:]) b
s = input()
a, b = int(s[:2]), int(s[2:])
r = ["AMBIGUOUS", "YYMM", "MMYY", "NA"]
print(r[(0 if (0 < b < 13) else 2) + (0 if (0 < a < 13) else 1)])