s = input()
flg1 = 1 <= int(s[:2]) <= 12
flg2 = 1 <= int(s[2:]) <= 12
l = ["NA", "YYMM", "MMYY", "AMBIGUOUS"]
print(l[(flg1 << 1) + flg2]) s = input() s input() input flg1 = 1 <= int(s[:2]) <= 12 flg1 1 <= int(s[:2]) <= 12 1 <= int(s[:2]) 1 int(s[:2]) int s[:2] s :2 2 12 flg2 = 1 <= int(s[2:]) <= 12 flg2 1 <= int(s[2:]) <= 12 1 <= int(s[2:]) 1 int(s[2:]) int s[2:] s 2: 2 12 l = ["NA", "YYMM", "MMYY", "AMBIGUOUS"] l ["NA", "YYMM", "MMYY", "AMBIGUOUS"] "NA" "YYMM" "MMYY" "AMBIGUOUS" print(l[(flg1 << 1) + flg2]) print l[(flg1 << 1) + flg2] l (flg1 << 1) + flg2 flg1 << 1 flg1 1 flg2 s = input() input() s flg2 = 1 <= int(s[2:]) <= 12 1 <= int(s[2:]) <= 12 flg2 flg1 = 1 <= int(s[:2]) <= 12 1 <= int(s[:2]) <= 12 flg1 l = ["NA", "YYMM", "MMYY", "AMBIGUOUS"] ["NA", "YYMM", "MMYY", "AMBIGUOUS"] l
s = input()
flg1 = 1 <= int(s[:2]) <= 12
flg2 = 1 <= int(s[2:]) <= 12
l = ["NA", "YYMM", "MMYY", "AMBIGUOUS"]
print(l[(flg1 << 1) + flg2])